| 1 | /* $Id: menu.cpp,v 1.3 1999-09-15 23:20:39 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Win32 menu API functions for OS/2 | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1998 Sander van Leeuwen | 
|---|
| 7 | * Copyright 1998 Patrick Haller | 
|---|
| 8 | * | 
|---|
| 9 | * Parts ported from Wine: (ChangeMenuA/W) | 
|---|
| 10 | * Copyright 1993 Martin Ayotte | 
|---|
| 11 | * Copyright 1994 Alexandre Julliard | 
|---|
| 12 | * Copyright 1997 Morten Welinder | 
|---|
| 13 | * | 
|---|
| 14 | * | 
|---|
| 15 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 16 | * | 
|---|
| 17 | */ | 
|---|
| 18 | #include "user32.h" | 
|---|
| 19 |  | 
|---|
| 20 | //****************************************************************************** | 
|---|
| 21 | //****************************************************************************** | 
|---|
| 22 | HMENU WIN32API GetMenu( HWND arg1) | 
|---|
| 23 | { | 
|---|
| 24 | #ifdef DEBUG | 
|---|
| 25 | HMENU rc; | 
|---|
| 26 |  | 
|---|
| 27 | rc = O32_GetMenu(arg1); | 
|---|
| 28 | WriteLog("USER32:  GetMenu %X returned %d\n", arg1, rc); | 
|---|
| 29 | return rc; | 
|---|
| 30 | #else | 
|---|
| 31 | return O32_GetMenu(arg1); | 
|---|
| 32 | #endif | 
|---|
| 33 | } | 
|---|
| 34 | //****************************************************************************** | 
|---|
| 35 | //****************************************************************************** | 
|---|
| 36 | DWORD WIN32API GetMenuCheckMarkDimensions(void) | 
|---|
| 37 | { | 
|---|
| 38 | #ifdef DEBUG | 
|---|
| 39 | WriteLog("USER32:  GetMenuCheckMarkDimensions\n"); | 
|---|
| 40 | #endif | 
|---|
| 41 | return O32_GetMenuCheckMarkDimensions(); | 
|---|
| 42 | } | 
|---|
| 43 | //****************************************************************************** | 
|---|
| 44 | //****************************************************************************** | 
|---|
| 45 | int WIN32API GetMenuItemCount( HMENU arg1) | 
|---|
| 46 | { | 
|---|
| 47 | #ifdef DEBUG | 
|---|
| 48 | WriteLog("USER32:  GetMenuItemCount\n"); | 
|---|
| 49 | #endif | 
|---|
| 50 | return O32_GetMenuItemCount(arg1); | 
|---|
| 51 | } | 
|---|
| 52 | //****************************************************************************** | 
|---|
| 53 | //****************************************************************************** | 
|---|
| 54 | UINT WIN32API GetMenuItemID( HMENU arg1, int  arg2) | 
|---|
| 55 | { | 
|---|
| 56 | #ifdef DEBUG | 
|---|
| 57 | WriteLog("USER32:  GetMenuItemID\n"); | 
|---|
| 58 | #endif | 
|---|
| 59 | return O32_GetMenuItemID(arg1, arg2); | 
|---|
| 60 | } | 
|---|
| 61 | //****************************************************************************** | 
|---|
| 62 | //****************************************************************************** | 
|---|
| 63 | UINT WIN32API GetMenuState( HMENU arg1, UINT arg2, UINT  arg3) | 
|---|
| 64 | { | 
|---|
| 65 | #ifdef DEBUG | 
|---|
| 66 | WriteLog("USER32:  GetMenuState\n"); | 
|---|
| 67 | #endif | 
|---|
| 68 | return O32_GetMenuState(arg1, arg2, arg3); | 
|---|
| 69 | } | 
|---|
| 70 | //****************************************************************************** | 
|---|
| 71 | //****************************************************************************** | 
|---|
| 72 | int WIN32API GetMenuStringA( HMENU arg1, UINT arg2, LPSTR arg3, int arg4, UINT  arg5) | 
|---|
| 73 | { | 
|---|
| 74 | #ifdef DEBUG | 
|---|
| 75 | WriteLog("USER32:  GetMenuString\n"); | 
|---|
| 76 | #endif | 
|---|
| 77 | return O32_GetMenuString(arg1, arg2, arg3, arg4, arg5); | 
|---|
| 78 | } | 
|---|
| 79 | //****************************************************************************** | 
|---|
| 80 | //****************************************************************************** | 
|---|
| 81 | int WIN32API GetMenuStringW(HMENU hmenu, UINT idItem, LPWSTR lpsz, int cchMax, UINT fuFlags) | 
|---|
| 82 | { | 
|---|
| 83 | char *astring = (char *)malloc(cchMax); | 
|---|
| 84 | int   rc; | 
|---|
| 85 |  | 
|---|
| 86 | dprintf(("USER32:  OS2GetMenuStringW\n")); | 
|---|
| 87 | rc = O32_GetMenuString(hmenu, idItem, astring, cchMax, fuFlags); | 
|---|
| 88 | free(astring); | 
|---|
| 89 | if(rc) { | 
|---|
| 90 | dprintf(("USER32: OS2GetMenuStringW %s\n", astring)); | 
|---|
| 91 | AsciiToUnicode(astring, lpsz); | 
|---|
| 92 | } | 
|---|
| 93 | else lpsz[0] = 0; | 
|---|
| 94 | return(rc); | 
|---|
| 95 | } | 
|---|
| 96 | //****************************************************************************** | 
|---|
| 97 | //****************************************************************************** | 
|---|
| 98 | BOOL WIN32API SetMenu( HWND arg1, HMENU  arg2) | 
|---|
| 99 | { | 
|---|
| 100 | #ifdef DEBUG | 
|---|
| 101 | WriteLog("USER32:  OS2SetMenu\n"); | 
|---|
| 102 | #endif | 
|---|
| 103 | return O32_SetMenu(arg1, arg2); | 
|---|
| 104 | } | 
|---|
| 105 | //****************************************************************************** | 
|---|
| 106 | //****************************************************************************** | 
|---|
| 107 | BOOL WIN32API SetMenuItemBitmaps( HMENU arg1, UINT arg2, UINT arg3, HBITMAP arg4, HBITMAP  arg5) | 
|---|
| 108 | { | 
|---|
| 109 | #ifdef DEBUG | 
|---|
| 110 | WriteLog("USER32:  OS2SetMenuItemBitmaps\n"); | 
|---|
| 111 | #endif | 
|---|
| 112 | return O32_SetMenuItemBitmaps(arg1, arg2, arg3, arg4, arg5); | 
|---|
| 113 | } | 
|---|
| 114 | //****************************************************************************** | 
|---|
| 115 | //****************************************************************************** | 
|---|
| 116 | HMENU WIN32API GetSubMenu(HWND arg1, int  arg2) | 
|---|
| 117 | { | 
|---|
| 118 | #ifdef DEBUG | 
|---|
| 119 | WriteLog("USER32:  GetSubMenu\n"); | 
|---|
| 120 | #endif | 
|---|
| 121 | return O32_GetSubMenu(arg1, arg2); | 
|---|
| 122 | } | 
|---|
| 123 | //****************************************************************************** | 
|---|
| 124 | //****************************************************************************** | 
|---|
| 125 | HMENU WIN32API GetSystemMenu( HWND arg1, BOOL  arg2) | 
|---|
| 126 | { | 
|---|
| 127 | #ifdef DEBUG | 
|---|
| 128 | WriteLog("USER32:  GetSystemMenu\n"); | 
|---|
| 129 | #endif | 
|---|
| 130 | return O32_GetSystemMenu(arg1, arg2); | 
|---|
| 131 | } | 
|---|
| 132 | //****************************************************************************** | 
|---|
| 133 | //****************************************************************************** | 
|---|
| 134 | BOOL WIN32API IsMenu( HMENU arg1) | 
|---|
| 135 | { | 
|---|
| 136 | #ifdef DEBUG | 
|---|
| 137 | WriteLog("USER32:  IsMenu\n"); | 
|---|
| 138 | #endif | 
|---|
| 139 | return O32_IsMenu(arg1); | 
|---|
| 140 | } | 
|---|
| 141 | //****************************************************************************** | 
|---|
| 142 | //****************************************************************************** | 
|---|
| 143 | BOOL WIN32API TrackPopupMenu(HMENU arg1, UINT arg2, int arg3, int arg4, int arg5, HWND arg6, const RECT *  arg7) | 
|---|
| 144 | { | 
|---|
| 145 | #ifdef DEBUG | 
|---|
| 146 | WriteLog("USER32:  TrackPopupMenu\n"); | 
|---|
| 147 | #endif | 
|---|
| 148 | return O32_TrackPopupMenu(arg1, arg2, arg3, arg4, arg5, arg6, arg7); | 
|---|
| 149 | } | 
|---|
| 150 | //****************************************************************************** | 
|---|
| 151 | //****************************************************************************** | 
|---|
| 152 | BOOL WIN32API TrackPopupMenuEx(HMENU hmenu, UINT flags, int X, int Y, HWND hwnd, LPTPMPARAMS lpPM) | 
|---|
| 153 | { | 
|---|
| 154 | RECT *rect = NULL; | 
|---|
| 155 |  | 
|---|
| 156 | #ifdef DEBUG | 
|---|
| 157 | WriteLog("USER32:  TrackPopupMenuEx, not completely implemented\n"); | 
|---|
| 158 | #endif | 
|---|
| 159 | if(lpPM->cbSize != 0) | 
|---|
| 160 | rect = &lpPM->rcExclude; | 
|---|
| 161 |  | 
|---|
| 162 | return O32_TrackPopupMenu(hmenu, flags, X, Y, 0, hwnd, rect); | 
|---|
| 163 | } | 
|---|
| 164 | //****************************************************************************** | 
|---|
| 165 | //****************************************************************************** | 
|---|
| 166 | BOOL WIN32API AppendMenuA(HMENU hMenu, UINT uFlags, UINT ulDNewItem, | 
|---|
| 167 | LPCSTR lpNewItem) | 
|---|
| 168 | { | 
|---|
| 169 | #ifdef DEBUG | 
|---|
| 170 | BOOL rc; | 
|---|
| 171 |  | 
|---|
| 172 | WriteLog("USER32:  OS2AppendMenuA uFlags = %X\n", uFlags); | 
|---|
| 173 |  | 
|---|
| 174 | if(uFlags & MF_STRING || uFlags == 0) | 
|---|
| 175 | WriteLog("USER32:  OS2AppendMenuA %s\n", lpNewItem); | 
|---|
| 176 |  | 
|---|
| 177 | rc = O32_AppendMenu(hMenu, uFlags, ulDNewItem, lpNewItem); | 
|---|
| 178 | WriteLog("USER32:  OS2AppendMenuA returned %d\n", rc); | 
|---|
| 179 | return rc; | 
|---|
| 180 | #else | 
|---|
| 181 | return O32_AppendMenu(hMenu, uFlags, ulDNewItem, lpNewItem); | 
|---|
| 182 | #endif | 
|---|
| 183 | } | 
|---|
| 184 | //****************************************************************************** | 
|---|
| 185 | //****************************************************************************** | 
|---|
| 186 | BOOL WIN32API AppendMenuW( HMENU arg1, UINT arg2, UINT arg3, LPCWSTR  arg4) | 
|---|
| 187 | { | 
|---|
| 188 | BOOL  rc; | 
|---|
| 189 | char *astring = NULL; | 
|---|
| 190 |  | 
|---|
| 191 | #ifdef DEBUG | 
|---|
| 192 | WriteLog("USER32:  OS2AppendMenuW\n"); | 
|---|
| 193 | #endif | 
|---|
| 194 | if(arg2 & MF_STRING  && (int)arg4 >> 16 != 0) | 
|---|
| 195 | astring = UnicodeToAsciiString((LPWSTR)arg4); | 
|---|
| 196 | else | 
|---|
| 197 | astring = (char *) arg4; | 
|---|
| 198 |  | 
|---|
| 199 | rc = O32_AppendMenu(arg1, arg2, arg3, astring); | 
|---|
| 200 | if(arg2 & MF_STRING  && (int)arg4 >> 16 != 0) | 
|---|
| 201 | FreeAsciiString(astring); | 
|---|
| 202 | return(rc); | 
|---|
| 203 | } | 
|---|
| 204 | //****************************************************************************** | 
|---|
| 205 | //****************************************************************************** | 
|---|
| 206 | DWORD WIN32API CheckMenuItem( HMENU arg1, UINT arg2, UINT  arg3) | 
|---|
| 207 | { | 
|---|
| 208 | #ifdef DEBUG | 
|---|
| 209 | WriteLog("USER32:  OS2CheckMenuItem\n"); | 
|---|
| 210 | #endif | 
|---|
| 211 | return O32_CheckMenuItem(arg1, arg2, arg3); | 
|---|
| 212 | } | 
|---|
| 213 | //****************************************************************************** | 
|---|
| 214 | //****************************************************************************** | 
|---|
| 215 | HMENU WIN32API CreateMenu(void) | 
|---|
| 216 | { | 
|---|
| 217 | #ifdef DEBUG | 
|---|
| 218 | HMENU rc; | 
|---|
| 219 |  | 
|---|
| 220 | rc = O32_CreateMenu(); | 
|---|
| 221 | WriteLog("USER32:  OS2CreateMenu returned %d\n", rc); | 
|---|
| 222 | return(rc); | 
|---|
| 223 | #else | 
|---|
| 224 | return(O32_CreateMenu()); | 
|---|
| 225 | #endif | 
|---|
| 226 | } | 
|---|
| 227 | //****************************************************************************** | 
|---|
| 228 | //****************************************************************************** | 
|---|
| 229 | HMENU WIN32API CreatePopupMenu(void) | 
|---|
| 230 | { | 
|---|
| 231 | #ifdef DEBUG | 
|---|
| 232 | WriteLog("USER32:  OS2CreatePopupMenu\n"); | 
|---|
| 233 | #endif | 
|---|
| 234 | return O32_CreatePopupMenu(); | 
|---|
| 235 | } | 
|---|
| 236 | //****************************************************************************** | 
|---|
| 237 | //****************************************************************************** | 
|---|
| 238 | BOOL WIN32API EnableMenuItem( HMENU arg1, UINT arg2, UINT  arg3) | 
|---|
| 239 | { | 
|---|
| 240 | #ifdef DEBUG | 
|---|
| 241 | WriteLog("USER32:  OS2EnableMenuItem\n"); | 
|---|
| 242 | #endif | 
|---|
| 243 | return O32_EnableMenuItem(arg1, arg2, arg3); | 
|---|
| 244 | } | 
|---|
| 245 | //****************************************************************************** | 
|---|
| 246 | //****************************************************************************** | 
|---|
| 247 | BOOL WIN32API ModifyMenuA( HMENU arg1, UINT arg2, UINT arg3, UINT arg4, LPCSTR  arg5) | 
|---|
| 248 | { | 
|---|
| 249 | #ifdef DEBUG | 
|---|
| 250 | WriteLog("USER32:  OS2ModifyMenuA\n"); | 
|---|
| 251 | #endif | 
|---|
| 252 | return O32_ModifyMenu(arg1, arg2, arg3, arg4, arg5); | 
|---|
| 253 | } | 
|---|
| 254 | //****************************************************************************** | 
|---|
| 255 | //****************************************************************************** | 
|---|
| 256 | BOOL WIN32API ModifyMenuW( HMENU arg1, UINT arg2, UINT arg3, UINT arg4, LPCWSTR arg5) | 
|---|
| 257 | { | 
|---|
| 258 | BOOL  rc; | 
|---|
| 259 | char *astring = NULL; | 
|---|
| 260 |  | 
|---|
| 261 | #ifdef DEBUG | 
|---|
| 262 | WriteLog("USER32: OS2ModifyMenuW %s\n", astring); | 
|---|
| 263 | #endif | 
|---|
| 264 | if(arg3 & MF_STRING  && (int)arg5 >> 16 != 0) | 
|---|
| 265 | astring = UnicodeToAsciiString((LPWSTR)arg5); | 
|---|
| 266 | else | 
|---|
| 267 | astring = (char *) arg5; | 
|---|
| 268 |  | 
|---|
| 269 | rc = O32_ModifyMenu(arg1, arg2, arg3, arg4, astring); | 
|---|
| 270 | if(arg3 & MF_STRING  && (int)arg5 >> 16 != 0) | 
|---|
| 271 | FreeAsciiString(astring); | 
|---|
| 272 | return(rc); | 
|---|
| 273 | } | 
|---|
| 274 | //****************************************************************************** | 
|---|
| 275 | //****************************************************************************** | 
|---|
| 276 | BOOL WIN32API RemoveMenu( HMENU arg1, UINT arg2, UINT  arg3) | 
|---|
| 277 | { | 
|---|
| 278 | #ifdef DEBUG | 
|---|
| 279 | WriteLog("USER32:  OS2RemoveMenu\n"); | 
|---|
| 280 | #endif | 
|---|
| 281 | return O32_RemoveMenu(arg1, arg2, arg3); | 
|---|
| 282 | } | 
|---|
| 283 | //****************************************************************************** | 
|---|
| 284 | //****************************************************************************** | 
|---|
| 285 | BOOL WIN32API DeleteMenu( HMENU arg1, UINT arg2, UINT  arg3) | 
|---|
| 286 | { | 
|---|
| 287 | #ifdef DEBUG | 
|---|
| 288 | WriteLog("USER32:  OS2DeleteMenu\n"); | 
|---|
| 289 | #endif | 
|---|
| 290 | return O32_DeleteMenu(arg1, arg2, arg3); | 
|---|
| 291 | } | 
|---|
| 292 | //****************************************************************************** | 
|---|
| 293 | //****************************************************************************** | 
|---|
| 294 | BOOL WIN32API DestroyMenu( HMENU arg1) | 
|---|
| 295 | { | 
|---|
| 296 | #ifdef DEBUG | 
|---|
| 297 | WriteLog("USER32:  OS2DestroyMenu\n"); | 
|---|
| 298 | #endif | 
|---|
| 299 | return O32_DestroyMenu(arg1); | 
|---|
| 300 | } | 
|---|
| 301 | //****************************************************************************** | 
|---|
| 302 | //****************************************************************************** | 
|---|
| 303 | BOOL WIN32API HiliteMenuItem( HWND arg1, HMENU arg2, UINT arg3, UINT  arg4) | 
|---|
| 304 | { | 
|---|
| 305 | #ifdef DEBUG | 
|---|
| 306 | WriteLog("USER32:  OS2HiliteMenuItem\n"); | 
|---|
| 307 | #endif | 
|---|
| 308 | return O32_HiliteMenuItem(arg1, arg2, arg3, arg4); | 
|---|
| 309 | } | 
|---|
| 310 | //****************************************************************************** | 
|---|
| 311 | //****************************************************************************** | 
|---|
| 312 | BOOL WIN32API InsertMenuA( HMENU arg1, UINT arg2, UINT arg3, UINT arg4, LPCSTR  arg5) | 
|---|
| 313 | { | 
|---|
| 314 | #ifdef DEBUG | 
|---|
| 315 | WriteLog("USER32:  OS2InsertMenuA\n"); | 
|---|
| 316 | #endif | 
|---|
| 317 | return O32_InsertMenu(arg1, arg2, arg3, arg4, arg5); | 
|---|
| 318 | } | 
|---|
| 319 | //****************************************************************************** | 
|---|
| 320 | //****************************************************************************** | 
|---|
| 321 | BOOL WIN32API InsertMenuW(HMENU arg1, UINT arg2, UINT arg3, UINT arg4, LPCWSTR arg5) | 
|---|
| 322 | { | 
|---|
| 323 | BOOL  rc; | 
|---|
| 324 | char *astring = NULL; | 
|---|
| 325 |  | 
|---|
| 326 | #ifdef DEBUG | 
|---|
| 327 | WriteLog("USER32:  OS2InsertMenuW %s\n", astring); | 
|---|
| 328 | #endif | 
|---|
| 329 | if(arg3 & MF_STRING  && (int)arg5 >> 16 != 0) | 
|---|
| 330 | astring = UnicodeToAsciiString((LPWSTR)arg5); | 
|---|
| 331 | else | 
|---|
| 332 | astring = (char *) arg5; | 
|---|
| 333 |  | 
|---|
| 334 | rc = O32_InsertMenu(arg1, arg2, arg3, arg4, astring); | 
|---|
| 335 | if(arg3 & MF_STRING  && (int)arg5 >> 16 != 0) | 
|---|
| 336 | FreeAsciiString(astring); | 
|---|
| 337 | return(rc); | 
|---|
| 338 | } | 
|---|
| 339 | //****************************************************************************** | 
|---|
| 340 | //****************************************************************************** | 
|---|
| 341 | BOOL WIN32API SetMenuContextHelpId(HMENU hmenu, DWORD dwContextHelpId) | 
|---|
| 342 | { | 
|---|
| 343 | #ifdef DEBUG | 
|---|
| 344 | WriteLog("USER32:  OS2SetMenuContextHelpId, not implemented\n"); | 
|---|
| 345 | #endif | 
|---|
| 346 | return(TRUE); | 
|---|
| 347 | } | 
|---|
| 348 | //****************************************************************************** | 
|---|
| 349 | //****************************************************************************** | 
|---|
| 350 | DWORD WIN32API GetMenuContextHelpId(HMENU hmenu) | 
|---|
| 351 | { | 
|---|
| 352 | #ifdef DEBUG | 
|---|
| 353 | WriteLog("USER32:  OS2GetMenuContextHelpId, not implemented\n"); | 
|---|
| 354 | #endif | 
|---|
| 355 | return(0); | 
|---|
| 356 | } | 
|---|
| 357 | //****************************************************************************** | 
|---|
| 358 | //****************************************************************************** | 
|---|
| 359 | BOOL WIN32API CheckMenuRadioItem(HMENU hmenu, UINT idFirst, UINT idLast, | 
|---|
| 360 | UINT idCheck, UINT uFlags) | 
|---|
| 361 | { | 
|---|
| 362 | #ifdef DEBUG | 
|---|
| 363 | WriteLog("USER32:  OS2CheckMenuRadioItem, not implemented\n"); | 
|---|
| 364 | #endif | 
|---|
| 365 | return(TRUE); | 
|---|
| 366 | } | 
|---|
| 367 | //****************************************************************************** | 
|---|
| 368 | //Stolen from Wine (controls\menu.c) | 
|---|
| 369 | //****************************************************************************** | 
|---|
| 370 | BOOL WIN32API ChangeMenuA(HMENU hMenu, UINT pos, LPCSTR data, UINT id, UINT flags) | 
|---|
| 371 | { | 
|---|
| 372 | #ifdef DEBUG | 
|---|
| 373 | WriteLog("USER32:  ChangeMenuA flags %X\n", flags); | 
|---|
| 374 | #endif | 
|---|
| 375 | if (flags & MF_APPEND) return AppendMenuA(hMenu, flags & ~MF_APPEND, | 
|---|
| 376 | id, data ); | 
|---|
| 377 | if (flags & MF_DELETE) return DeleteMenu(hMenu, pos, flags & ~MF_DELETE); | 
|---|
| 378 | if (flags & MF_CHANGE) return ModifyMenuA(hMenu, pos, flags & ~MF_CHANGE, | 
|---|
| 379 | id, data ); | 
|---|
| 380 | if (flags & MF_REMOVE) return RemoveMenu(hMenu, | 
|---|
| 381 | flags & MF_BYPOSITION ? pos : id, | 
|---|
| 382 | flags & ~MF_REMOVE ); | 
|---|
| 383 | /* Default: MF_INSERT */ | 
|---|
| 384 | return InsertMenuA( hMenu, pos, flags, id, data ); | 
|---|
| 385 | } | 
|---|
| 386 | //****************************************************************************** | 
|---|
| 387 | //Stolen from Wine (controls\menu.c) | 
|---|
| 388 | //****************************************************************************** | 
|---|
| 389 | BOOL WIN32API ChangeMenuW(HMENU hMenu, UINT pos, LPCWSTR data, | 
|---|
| 390 | UINT id, UINT flags ) | 
|---|
| 391 | { | 
|---|
| 392 | #ifdef DEBUG | 
|---|
| 393 | WriteLog("USER32:  ChangeMenuW flags %X\n", flags); | 
|---|
| 394 | #endif | 
|---|
| 395 | if (flags & MF_APPEND) return AppendMenuW(hMenu, flags & ~MF_APPEND, | 
|---|
| 396 | id, data ); | 
|---|
| 397 | if (flags & MF_DELETE) return DeleteMenu(hMenu, pos, flags & ~MF_DELETE); | 
|---|
| 398 | if (flags & MF_CHANGE) return ModifyMenuW(hMenu, pos, flags & ~MF_CHANGE, | 
|---|
| 399 | id, data ); | 
|---|
| 400 | if (flags & MF_REMOVE) return RemoveMenu(hMenu, | 
|---|
| 401 | flags & MF_BYPOSITION ? pos : id, | 
|---|
| 402 | flags & ~MF_REMOVE ); | 
|---|
| 403 | /* Default: MF_INSERT */ | 
|---|
| 404 | return InsertMenuW(hMenu, pos, flags, id, data); | 
|---|
| 405 | } | 
|---|
| 406 | //****************************************************************************** | 
|---|
| 407 | //****************************************************************************** | 
|---|
| 408 | BOOL WIN32API SetMenuItemInfoA(HMENU hmenu, UINT par1, BOOL par2, | 
|---|
| 409 | const MENUITEMINFOA * lpMenuItemInfo) | 
|---|
| 410 | { | 
|---|
| 411 | #ifdef DEBUG | 
|---|
| 412 | WriteLog("USER32:  SetMenuItemInfoA, faked\n"); | 
|---|
| 413 | #endif | 
|---|
| 414 | return(TRUE); | 
|---|
| 415 | } | 
|---|
| 416 | /***************************************************************************** | 
|---|
| 417 | * Name      : BOOL WIN32API SetMenuItemInfoW | 
|---|
| 418 | * Purpose   : The SetMenuItemInfo function changes information about a menu item. | 
|---|
| 419 | * Parameters: | 
|---|
| 420 | * Variables : | 
|---|
| 421 | * Result    : If the function succeeds, the return value is TRUE. | 
|---|
| 422 | *             If the function fails, the return value is FALSE. To get extended | 
|---|
| 423 | *               error information, use the GetLastError function. | 
|---|
| 424 | * Remark    : | 
|---|
| 425 | * Status    : UNTESTED STUB | 
|---|
| 426 | * | 
|---|
| 427 | * Author    : Patrick Haller [Thu, 1998/02/26 11:55] | 
|---|
| 428 | *****************************************************************************/ | 
|---|
| 429 |  | 
|---|
| 430 | BOOL WIN32API SetMenuItemInfoW(HMENU            hMenu, | 
|---|
| 431 | UINT             uItem, | 
|---|
| 432 | BOOL             fByPosition, | 
|---|
| 433 | const MENUITEMINFOW *lpmmi) | 
|---|
| 434 | { | 
|---|
| 435 | dprintf(("USER32:SetMenuItemInfoW (%08xh,%08xh,%08xh,%08x) not implemented.\n", | 
|---|
| 436 | hMenu, | 
|---|
| 437 | uItem, | 
|---|
| 438 | fByPosition, | 
|---|
| 439 | lpmmi)); | 
|---|
| 440 |  | 
|---|
| 441 | return (SetMenuItemInfoA(hMenu, | 
|---|
| 442 | uItem, | 
|---|
| 443 | fByPosition, | 
|---|
| 444 | (const MENUITEMINFOA *)lpmmi)); | 
|---|
| 445 | } | 
|---|
| 446 | //****************************************************************************** | 
|---|
| 447 | //****************************************************************************** | 
|---|
| 448 | BOOL WIN32API SetMenuDefaultItem(HMENU hmenu, UINT uItem, UINT fByPos ) | 
|---|
| 449 | { | 
|---|
| 450 | #ifdef DEBUG | 
|---|
| 451 | WriteLog("USER32:  SetMenuDefaultItem, faked\n"); | 
|---|
| 452 | #endif | 
|---|
| 453 | return(TRUE); | 
|---|
| 454 | } | 
|---|
| 455 | //****************************************************************************** | 
|---|
| 456 | //****************************************************************************** | 
|---|
| 457 | BOOL WIN32API GetMenuItemInfoA(HMENU hmenu, UINT uItem, BOOL aBool, | 
|---|
| 458 | MENUITEMINFOA *lpMenuItemInfo ) | 
|---|
| 459 |  | 
|---|
| 460 | { | 
|---|
| 461 | #ifdef DEBUG | 
|---|
| 462 | WriteLog("USER32:  GetMenuItemInfoA, faked\n"); | 
|---|
| 463 | #endif | 
|---|
| 464 | return(TRUE); | 
|---|
| 465 | } | 
|---|
| 466 | /***************************************************************************** | 
|---|
| 467 | * Name      : UINT WIN32API GetMenuDefaultItem | 
|---|
| 468 | * Purpose   : The GetMenuDefaultItem function determines the default menu item | 
|---|
| 469 | *             on the specified menu. | 
|---|
| 470 | * Parameters: | 
|---|
| 471 | * Variables : | 
|---|
| 472 | * Result    : If the function succeeds, the return value is the identifier or | 
|---|
| 473 | *             position of the menu item. | 
|---|
| 474 | *             If the function fails, the return value is - 1. | 
|---|
| 475 | * Remark    : | 
|---|
| 476 | * Status    : UNTESTED STUB | 
|---|
| 477 | * | 
|---|
| 478 | * Author    : Patrick Haller [Thu, 1998/02/26 11:55] | 
|---|
| 479 | *****************************************************************************/ | 
|---|
| 480 |  | 
|---|
| 481 | UINT WIN32API GetMenuDefaultItem(HMENU hMenu, | 
|---|
| 482 | UINT  fByPos, | 
|---|
| 483 | UINT  gmdiFlags) | 
|---|
| 484 | { | 
|---|
| 485 | dprintf(("USER32:GetMenuDefaultItem (%08xh,%u,%08x) not implemented.\n", | 
|---|
| 486 | hMenu, | 
|---|
| 487 | fByPos, | 
|---|
| 488 | gmdiFlags)); | 
|---|
| 489 |  | 
|---|
| 490 | return (-1); | 
|---|
| 491 | } | 
|---|
| 492 |  | 
|---|
| 493 |  | 
|---|
| 494 | /***************************************************************************** | 
|---|
| 495 | * Name      : BOOL WIN32API GetMenuItemInfoW | 
|---|
| 496 | * Purpose   : The GetMenuItemInfo function retrieves information about a menu item. | 
|---|
| 497 | * Parameters: | 
|---|
| 498 | * Variables : | 
|---|
| 499 | * Result    : If the function succeeds, the return value is TRUE. | 
|---|
| 500 | *             If the function fails, the return value is FALSE. To get extended | 
|---|
| 501 | *             error information, use the GetLastError function. | 
|---|
| 502 | * Remark    : | 
|---|
| 503 | * Status    : UNTESTED STUB | 
|---|
| 504 | * | 
|---|
| 505 | * Author    : Patrick Haller [Thu, 1998/02/26 11:55] | 
|---|
| 506 | *****************************************************************************/ | 
|---|
| 507 |  | 
|---|
| 508 | BOOL WIN32API GetMenuItemInfoW(HMENU           hMenu, | 
|---|
| 509 | UINT            uItem, | 
|---|
| 510 | BOOL            fByPosition, | 
|---|
| 511 | MENUITEMINFOW * lpmii) | 
|---|
| 512 | { | 
|---|
| 513 | dprintf(("USER32:GetMenuItemInfoW (%08xh,%08xh,%u,%08x) not implemented.\n", | 
|---|
| 514 | hMenu, | 
|---|
| 515 | uItem, | 
|---|
| 516 | fByPosition, | 
|---|
| 517 | lpmii)); | 
|---|
| 518 |  | 
|---|
| 519 | return(GetMenuItemInfoA(hMenu, | 
|---|
| 520 | uItem, | 
|---|
| 521 | fByPosition, | 
|---|
| 522 | (MENUITEMINFOA *)lpmii)); | 
|---|
| 523 | } | 
|---|
| 524 |  | 
|---|
| 525 |  | 
|---|
| 526 | /***************************************************************************** | 
|---|
| 527 | * Name      : BOOL WIN32API GetMenuItemRect | 
|---|
| 528 | * Purpose   : The GetMenuItemRect function retrieves the bounding rectangle | 
|---|
| 529 | *             for the specified menu item. | 
|---|
| 530 | * Parameters: | 
|---|
| 531 | * Variables : | 
|---|
| 532 | * Result    : If the function succeeds, the return value is TRUE. | 
|---|
| 533 | *             If the function fails, the return value is FALSE. To get | 
|---|
| 534 | *             extended error information, use the GetLastError function. | 
|---|
| 535 | * Remark    : | 
|---|
| 536 | * Status    : UNTESTED STUB | 
|---|
| 537 | * | 
|---|
| 538 | * Author    : Patrick Haller [Thu, 1998/02/26 11:55] | 
|---|
| 539 | *****************************************************************************/ | 
|---|
| 540 |  | 
|---|
| 541 | BOOL WIN32API GetMenuItemRect(HWND   hWnd, | 
|---|
| 542 | HMENU  hMenu, | 
|---|
| 543 | UINT   uItem, | 
|---|
| 544 | LPRECT lprcItem) | 
|---|
| 545 | { | 
|---|
| 546 | dprintf(("USER32:GetMenuItemRect (%08xh,%08xh,%08xh,%08x) not implemented.\n", | 
|---|
| 547 | hWnd, | 
|---|
| 548 | hMenu, | 
|---|
| 549 | uItem, | 
|---|
| 550 | lprcItem)); | 
|---|
| 551 |  | 
|---|
| 552 | return (FALSE); | 
|---|
| 553 | } | 
|---|
| 554 | /***************************************************************************** | 
|---|
| 555 | * Name      : BOOL WIN32API InsertMenuItemA | 
|---|
| 556 | * Purpose   : The InsertMenuItem function inserts a new menu item at the specified | 
|---|
| 557 | *             position in a menu bar or pop-up menu. | 
|---|
| 558 | * Parameters: | 
|---|
| 559 | * Variables : | 
|---|
| 560 | * Result    : If the function succeeds, the return value is TRUE. | 
|---|
| 561 | *             If the function fails, the return value is FALSE. To get extended | 
|---|
| 562 | *             error information, use the GetLastError function. | 
|---|
| 563 | * Remark    : | 
|---|
| 564 | * Status    : UNTESTED STUB | 
|---|
| 565 | * | 
|---|
| 566 | * Author    : Patrick Haller [Thu, 1998/02/26 11:55] | 
|---|
| 567 | *****************************************************************************/ | 
|---|
| 568 |  | 
|---|
| 569 | BOOL WIN32API InsertMenuItemA(HMENU           hMenu, | 
|---|
| 570 | UINT            uItem, | 
|---|
| 571 | BOOL            fByPosition, | 
|---|
| 572 | const MENUITEMINFOA* lpmii) | 
|---|
| 573 | { | 
|---|
| 574 | dprintf(("USER32:InsertMenuItemA (%08xh,%08xh,%u,%08x) not implemented.\n", | 
|---|
| 575 | hMenu, | 
|---|
| 576 | uItem, | 
|---|
| 577 | fByPosition, | 
|---|
| 578 | lpmii)); | 
|---|
| 579 |  | 
|---|
| 580 | return (FALSE); | 
|---|
| 581 | } | 
|---|
| 582 |  | 
|---|
| 583 |  | 
|---|
| 584 | /***************************************************************************** | 
|---|
| 585 | * Name      : BOOL WIN32API InsertMenuItemW | 
|---|
| 586 | * Purpose   : The InsertMenuItem function inserts a new menu item at the specified | 
|---|
| 587 | *             position in a menu bar or pop-up menu. | 
|---|
| 588 | * Parameters: | 
|---|
| 589 | * Variables : | 
|---|
| 590 | * Result    : If the function succeeds, the return value is TRUE. | 
|---|
| 591 | *             If the function fails, the return value is FALSE. To get extended | 
|---|
| 592 | *             error information, use the GetLastError function. | 
|---|
| 593 | * Remark    : | 
|---|
| 594 | * Status    : UNTESTED STUB | 
|---|
| 595 | * | 
|---|
| 596 | * Author    : Patrick Haller [Thu, 1998/02/26 11:55] | 
|---|
| 597 | *****************************************************************************/ | 
|---|
| 598 |  | 
|---|
| 599 | BOOL WIN32API InsertMenuItemW(HMENU           hMenu, | 
|---|
| 600 | UINT            uItem, | 
|---|
| 601 | BOOL            fByPosition, | 
|---|
| 602 | const MENUITEMINFOW * lpmii) | 
|---|
| 603 | { | 
|---|
| 604 | dprintf(("USER32:InsertMenuItemW (%08xh,%08xh,%u,%08x) not implemented.\n", | 
|---|
| 605 | hMenu, | 
|---|
| 606 | uItem, | 
|---|
| 607 | fByPosition, | 
|---|
| 608 | lpmii)); | 
|---|
| 609 |  | 
|---|
| 610 | return (FALSE); | 
|---|
| 611 | } | 
|---|
| 612 |  | 
|---|
| 613 |  | 
|---|
| 614 | /***************************************************************************** | 
|---|
| 615 | * Name      : UINT WIN32API MenuItemFromPoint | 
|---|
| 616 | * Purpose   : The MenuItemFromPoint function determines which menu item, if | 
|---|
| 617 | *             any, is at the specified location. | 
|---|
| 618 | * Parameters: | 
|---|
| 619 | * Variables : | 
|---|
| 620 | * Result    : Returns the zero-based position of the menu item at the specified | 
|---|
| 621 | *             location or -1 if no menu item is at the specified location. | 
|---|
| 622 | * Remark    : | 
|---|
| 623 | * Status    : UNTESTED STUB | 
|---|
| 624 | * | 
|---|
| 625 | * Author    : Patrick Haller [Thu, 1998/02/26 11:55] | 
|---|
| 626 | *****************************************************************************/ | 
|---|
| 627 |  | 
|---|
| 628 | UINT WIN32API MenuItemFromPoint(HWND  hWnd, | 
|---|
| 629 | HMENU hMenu, | 
|---|
| 630 | POINT ptScreen) | 
|---|
| 631 | { | 
|---|
| 632 | dprintf(("USER32:MenuItemFromPoint (%08xh,%08xh,%u) not implemented.\n", | 
|---|
| 633 | hWnd, | 
|---|
| 634 | hMenu, | 
|---|
| 635 | ptScreen)); | 
|---|
| 636 |  | 
|---|
| 637 | return (-1); | 
|---|
| 638 | } | 
|---|
| 639 |  | 
|---|
| 640 |  | 
|---|
| 641 | /***************************************************************************** | 
|---|
| 642 | * Name      : BOOL WIN32API GetMenuInfo | 
|---|
| 643 | * Purpose   : | 
|---|
| 644 | * Parameters: | 
|---|
| 645 | * Variables : | 
|---|
| 646 | * Result    : | 
|---|
| 647 | * Remark    : | 
|---|
| 648 | * Status    : UNTESTED STUB win98/NT5.0 | 
|---|
| 649 | * | 
|---|
| 650 | * Author    : Patrick Haller [Thu, 1998/02/26 11:55] | 
|---|
| 651 | *****************************************************************************/ | 
|---|
| 652 |  | 
|---|
| 653 | BOOL WIN32API GetMenuInfo (HMENU hMenu, LPMENUINFO lpmi) | 
|---|
| 654 | { | 
|---|
| 655 | dprintf(("USER32: GetMenuInfo(%08xh,%08xh) not implemented.\n", | 
|---|
| 656 | hMenu, | 
|---|
| 657 | lpmi)); | 
|---|
| 658 |  | 
|---|
| 659 | memset(lpmi,0,sizeof(MENUINFO)); | 
|---|
| 660 | return 0; | 
|---|
| 661 | } | 
|---|
| 662 | #if 0 | 
|---|
| 663 | POPUPMENU *menu; | 
|---|
| 664 |  | 
|---|
| 665 | TRACE("(0x%04x %p)\n", hMenu, lpmi); | 
|---|
| 666 |  | 
|---|
| 667 | if (lpmi && (menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu))) | 
|---|
| 668 | { | 
|---|
| 669 |  | 
|---|
| 670 | if (lpmi->fMask & MIM_BACKGROUND) | 
|---|
| 671 | lpmi->hbrBack = menu->hbrBack; | 
|---|
| 672 |  | 
|---|
| 673 | if (lpmi->fMask & MIM_HELPID) | 
|---|
| 674 | lpmi->dwContextHelpID = menu->dwContextHelpID; | 
|---|
| 675 |  | 
|---|
| 676 | if (lpmi->fMask & MIM_MAXHEIGHT) | 
|---|
| 677 | lpmi->cyMax = menu->cyMax; | 
|---|
| 678 |  | 
|---|
| 679 | if (lpmi->fMask & MIM_MENUDATA) | 
|---|
| 680 | lpmi->dwMenuData = menu->dwMenuData; | 
|---|
| 681 |  | 
|---|
| 682 | if (lpmi->fMask & MIM_STYLE) | 
|---|
| 683 | lpmi->dwStyle = menu->dwStyle; | 
|---|
| 684 |  | 
|---|
| 685 | return TRUE; | 
|---|
| 686 | } | 
|---|
| 687 | return FALSE; | 
|---|
| 688 | } | 
|---|
| 689 | #endif | 
|---|
| 690 |  | 
|---|
| 691 |  | 
|---|
| 692 | /***************************************************************************** | 
|---|
| 693 | * Name      : BOOL WIN32API SetMenuInfo | 
|---|
| 694 | * Purpose   : | 
|---|
| 695 | * Parameters: | 
|---|
| 696 | * Variables : | 
|---|
| 697 | * Result    : | 
|---|
| 698 | * Remark    : | 
|---|
| 699 | * FIXME | 
|---|
| 700 | * MIM_APPLYTOSUBMENUS | 
|---|
| 701 | * actually use the items to draw the menu | 
|---|
| 702 | * Status    : UNTESTED STUB win98/NT5.0 | 
|---|
| 703 | * | 
|---|
| 704 | * Author    : Patrick Haller [Thu, 1998/02/26 11:55] | 
|---|
| 705 | *****************************************************************************/ | 
|---|
| 706 |  | 
|---|
| 707 | BOOL WIN32API SetMenuInfo (HMENU hMenu, LPCMENUINFO lpmi) | 
|---|
| 708 | { | 
|---|
| 709 | dprintf(("USER32: SetMenuInfo(%08xh,%08xh) not implemented.\n", | 
|---|
| 710 | hMenu, | 
|---|
| 711 | lpmi)); | 
|---|
| 712 |  | 
|---|
| 713 | return 0; | 
|---|
| 714 | } | 
|---|
| 715 | #if 0 | 
|---|
| 716 | POPUPMENU *menu; | 
|---|
| 717 |  | 
|---|
| 718 | TRACE("(0x%04x %p)\n", hMenu, lpmi); | 
|---|
| 719 |  | 
|---|
| 720 |  | 
|---|
| 721 |  | 
|---|
| 722 | if (lpmi && (lpmi->cbSize==sizeof(MENUINFO)) && (menu=(POPUPMENU*)USER_HEAP_LIN_ADDR(hMenu))) | 
|---|
| 723 | { | 
|---|
| 724 |  | 
|---|
| 725 | if (lpmi->fMask & MIM_BACKGROUND) | 
|---|
| 726 | menu->hbrBack = lpmi->hbrBack; | 
|---|
| 727 |  | 
|---|
| 728 | if (lpmi->fMask & MIM_HELPID) | 
|---|
| 729 | menu->dwContextHelpID = lpmi->dwContextHelpID; | 
|---|
| 730 |  | 
|---|
| 731 | if (lpmi->fMask & MIM_MAXHEIGHT) | 
|---|
| 732 | menu->cyMax = lpmi->cyMax; | 
|---|
| 733 |  | 
|---|
| 734 | if (lpmi->fMask & MIM_MENUDATA) | 
|---|
| 735 | menu->dwMenuData = lpmi->dwMenuData; | 
|---|
| 736 |  | 
|---|
| 737 | if (lpmi->fMask & MIM_STYLE) | 
|---|
| 738 | menu->dwStyle = lpmi->dwStyle; | 
|---|
| 739 |  | 
|---|
| 740 | return TRUE; | 
|---|
| 741 | } | 
|---|
| 742 | return FALSE; | 
|---|
| 743 | } | 
|---|
| 744 | #endif | 
|---|
| 745 |  | 
|---|