| 1 | /* $Id: winmenu.cpp,v 1.17 1999-11-14 12:00:01 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:
|
|---|
| 10 | * Copyright 1993 Martin Ayotte
|
|---|
| 11 | * Copyright 1994 Alexandre Julliard
|
|---|
| 12 | * Copyright 1997 Morten Welinder
|
|---|
| 13 | *
|
|---|
| 14 | *
|
|---|
| 15 | * TODO: Set/GetMenu(Item)Info only partially implemented
|
|---|
| 16 | * TODO: Memory leak when deleting submenus
|
|---|
| 17 | * TODO: Check error nrs
|
|---|
| 18 | *
|
|---|
| 19 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 20 | *
|
|---|
| 21 | */
|
|---|
| 22 | #include <os2win.h>
|
|---|
| 23 | #include <odin.h>
|
|---|
| 24 | #include <odinwrap.h>
|
|---|
| 25 | #include <stdlib.h>
|
|---|
| 26 | #include <string.h>
|
|---|
| 27 | #include <win32wbase.h>
|
|---|
| 28 | #include "oslibmenu.h"
|
|---|
| 29 | #include "oslibwin.h"
|
|---|
| 30 | #include "winmenudef.h"
|
|---|
| 31 |
|
|---|
| 32 | ODINDEBUGCHANNEL(USER32)
|
|---|
| 33 |
|
|---|
| 34 | BOOL ODIN_INTERNAL ODIN_InsertMenuA(HMENU,UINT,UINT,UINT,LPCSTR);
|
|---|
| 35 | BOOL ODIN_INTERNAL ODIN_InsertMenuW(HMENU,UINT,UINT,UINT,LPCWSTR);
|
|---|
| 36 | BOOL ODIN_INTERNAL ODIN_InsertMenuItemA(HMENU,UINT,BOOL,const MENUITEMINFOA*);
|
|---|
| 37 | BOOL ODIN_INTERNAL ODIN_InsertMenuItemW(HMENU,UINT,BOOL,const MENUITEMINFOW*);
|
|---|
| 38 | BOOL ODIN_INTERNAL ODIN_AppendMenuA(HMENU,UINT,UINT,LPCSTR);
|
|---|
| 39 | BOOL ODIN_INTERNAL ODIN_AppendMenuW(HMENU,UINT,UINT,LPCWSTR);
|
|---|
| 40 | HMENU ODIN_INTERNAL ODIN_CreateMenu(void);
|
|---|
| 41 | HMENU ODIN_INTERNAL ODIN_CreatePopupMenu(void);
|
|---|
| 42 | BOOL ODIN_INTERNAL ODIN_DestroyMenu(HMENU);
|
|---|
| 43 |
|
|---|
| 44 | //@@@PH: experiment with WINE LoadMenuIndirect code
|
|---|
| 45 | #include <heapstring.h>
|
|---|
| 46 | #define MENU_ITEM_TYPE(flags) \
|
|---|
| 47 | ((flags) & (MF_STRING | MF_BITMAP | MF_OWNERDRAW | MF_SEPARATOR))
|
|---|
| 48 |
|
|---|
| 49 | #define IS_STRING_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_STRING)
|
|---|
| 50 | #define IS_BITMAP_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_BITMAP)
|
|---|
| 51 |
|
|---|
| 52 | /**********************************************************************
|
|---|
| 53 | * MENU_ParseResource
|
|---|
| 54 | *
|
|---|
| 55 | * Parse a standard menu resource and add items to the menu.
|
|---|
| 56 | * Return a pointer to the end of the resource.
|
|---|
| 57 | */
|
|---|
| 58 | static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu)
|
|---|
| 59 | {
|
|---|
| 60 | WORD flags, id = 0;
|
|---|
| 61 | LPCSTR str;
|
|---|
| 62 |
|
|---|
| 63 | do
|
|---|
| 64 | {
|
|---|
| 65 | flags = GET_WORD(res);
|
|---|
| 66 | res += sizeof(WORD);
|
|---|
| 67 | if (!(flags & MF_POPUP))
|
|---|
| 68 | {
|
|---|
| 69 | id = GET_WORD(res);
|
|---|
| 70 | res += sizeof(WORD);
|
|---|
| 71 | }
|
|---|
| 72 | if (!IS_STRING_ITEM(flags))
|
|---|
| 73 | dprintf(("USER32: WinMenu: MENU_ParseResource: not a string item %04x\n", flags ));
|
|---|
| 74 | str = res;
|
|---|
| 75 |
|
|---|
| 76 | res += (lstrlenW((LPCWSTR)str) + 1) * sizeof(WCHAR);
|
|---|
| 77 | if (flags & MF_POPUP)
|
|---|
| 78 | {
|
|---|
| 79 | HMENU hSubMenu = ODIN_CreatePopupMenu();
|
|---|
| 80 | if (!hSubMenu) return NULL;
|
|---|
| 81 | if (!(res = MENU_ParseResource( res, hSubMenu)))
|
|---|
| 82 | return NULL;
|
|---|
| 83 | ODIN_AppendMenuW( hMenu, flags, (UINT)hSubMenu, (LPCWSTR)str );
|
|---|
| 84 | }
|
|---|
| 85 | else /* Not a popup */
|
|---|
| 86 | {
|
|---|
| 87 | ODIN_AppendMenuW( hMenu, flags, id, *(LPCWSTR)str ? (LPCWSTR)str : NULL );
|
|---|
| 88 | }
|
|---|
| 89 | } while (!(flags & MF_END));
|
|---|
| 90 | return res;
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 | /**********************************************************************
|
|---|
| 95 | * MENUEX_ParseResource
|
|---|
| 96 | *
|
|---|
| 97 | * Parse an extended menu resource and add items to the menu.
|
|---|
| 98 | * Return a pointer to the end of the resource.
|
|---|
| 99 | */
|
|---|
| 100 | static LPCSTR MENUEX_ParseResource( LPCSTR res, HMENU hMenu)
|
|---|
| 101 | {
|
|---|
| 102 | WORD resinfo;
|
|---|
| 103 |
|
|---|
| 104 | do {
|
|---|
| 105 | MENUITEMINFOW mii;
|
|---|
| 106 |
|
|---|
| 107 | mii.cbSize = sizeof(mii);
|
|---|
| 108 | mii.fMask = MIIM_STATE | MIIM_ID | MIIM_TYPE;
|
|---|
| 109 | mii.fType = GET_DWORD(res);
|
|---|
| 110 | res += sizeof(DWORD);
|
|---|
| 111 | mii.fState = GET_DWORD(res);
|
|---|
| 112 | res += sizeof(DWORD);
|
|---|
| 113 | mii.wID = GET_DWORD(res);
|
|---|
| 114 | res += sizeof(DWORD);
|
|---|
| 115 | resinfo = GET_WORD(res); /* FIXME: for 16-bit apps this is a byte. */
|
|---|
| 116 | res += sizeof(WORD);
|
|---|
| 117 |
|
|---|
| 118 | /* Align the text on a word boundary. */
|
|---|
| 119 | res += (~((int)res - 1)) & 1;
|
|---|
| 120 | mii.dwTypeData = (LPWSTR) res;
|
|---|
| 121 | res += (1 + lstrlenW(mii.dwTypeData)) * sizeof(WCHAR);
|
|---|
| 122 | /* Align the following fields on a dword boundary. */
|
|---|
| 123 | res += (~((int)res - 1)) & 3;
|
|---|
| 124 |
|
|---|
| 125 | /* FIXME: This is inefficient and cannot be optimised away by gcc. */
|
|---|
| 126 | {
|
|---|
| 127 | LPSTR newstr = HEAP_strdupWtoA(GetProcessHeap(), 0, mii.dwTypeData);
|
|---|
| 128 |
|
|---|
| 129 | dprintf(("USER32:WinMenu:MENUEX_ParseResource Menu item: [%08x,%08x,%04x,%04x,%s]\n",
|
|---|
| 130 | mii.fType, mii.fState, mii.wID, resinfo, newstr));
|
|---|
| 131 | HeapFree( GetProcessHeap(), 0, newstr );
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | if (resinfo & 1) { /* Pop-up? */
|
|---|
| 135 | /* DWORD helpid = GET_DWORD(res); FIXME: use this. */
|
|---|
| 136 | res += sizeof(DWORD);
|
|---|
| 137 | mii.hSubMenu = ODIN_CreatePopupMenu();
|
|---|
| 138 | if (!mii.hSubMenu)
|
|---|
| 139 | return NULL;
|
|---|
| 140 | if (!(res = MENUEX_ParseResource(res, mii.hSubMenu))) {
|
|---|
| 141 | DestroyMenu(mii.hSubMenu);
|
|---|
| 142 | return NULL;
|
|---|
| 143 | }
|
|---|
| 144 | mii.fMask |= MIIM_SUBMENU;
|
|---|
| 145 | mii.fType |= MF_POPUP;
|
|---|
| 146 | }
|
|---|
| 147 | ODIN_InsertMenuItemW(hMenu, -1, MF_BYPOSITION, &mii);
|
|---|
| 148 | }
|
|---|
| 149 | while (!(resinfo & MF_END));
|
|---|
| 150 |
|
|---|
| 151 | return res;
|
|---|
| 152 | }
|
|---|
| 153 | /**********************************************************************
|
|---|
| 154 | * myLoadMenuIndirect
|
|---|
| 155 | */
|
|---|
| 156 | HMENU myLoadMenuIndirect(LPCVOID pMenuTemplate)
|
|---|
| 157 | {
|
|---|
| 158 | HMENU hMenu;
|
|---|
| 159 | WORD version,
|
|---|
| 160 | offset;
|
|---|
| 161 | LPCSTR p = (LPCSTR)pMenuTemplate;
|
|---|
| 162 |
|
|---|
| 163 | version = GET_WORD(p);
|
|---|
| 164 | p += sizeof(WORD);
|
|---|
| 165 |
|
|---|
| 166 | switch (version)
|
|---|
| 167 | {
|
|---|
| 168 | case 0:
|
|---|
| 169 | offset = GET_WORD(p);
|
|---|
| 170 | p += sizeof(WORD) + offset;
|
|---|
| 171 | if (!(hMenu = ODIN_CreateMenu()))
|
|---|
| 172 | return 0;
|
|---|
| 173 | if (!MENU_ParseResource( p, hMenu))
|
|---|
| 174 | {
|
|---|
| 175 | DestroyMenu( hMenu );
|
|---|
| 176 | return 0;
|
|---|
| 177 | }
|
|---|
| 178 | return hMenu;
|
|---|
| 179 |
|
|---|
| 180 | case 1:
|
|---|
| 181 | offset = GET_WORD(p);
|
|---|
| 182 | p += sizeof(WORD) + offset;
|
|---|
| 183 | if (!(hMenu = ODIN_CreateMenu()))
|
|---|
| 184 | return 0;
|
|---|
| 185 | if (!MENUEX_ParseResource( p, hMenu))
|
|---|
| 186 | {
|
|---|
| 187 | ODIN_DestroyMenu( hMenu );
|
|---|
| 188 | return 0;
|
|---|
| 189 | }
|
|---|
| 190 | return hMenu;
|
|---|
| 191 |
|
|---|
| 192 | default:
|
|---|
| 193 | dprintf(("USER32: LoadMenuIndirectA: version %d not supported.\n", version));
|
|---|
| 194 | return 0;
|
|---|
| 195 | }
|
|---|
| 196 | }
|
|---|
| 197 | //******************************************************************************
|
|---|
| 198 | //******************************************************************************
|
|---|
| 199 | void SetInternalMenuInfo(HMENU hMenu)
|
|---|
| 200 | {
|
|---|
| 201 | LPPOPUPMENU lpMenuInfo;
|
|---|
| 202 |
|
|---|
| 203 | lpMenuInfo = (LPPOPUPMENU)malloc(sizeof(*lpMenuInfo));
|
|---|
| 204 | memset(lpMenuInfo, 0, sizeof(*lpMenuInfo));
|
|---|
| 205 | OSLibWinSetWindowULong(hMenu, OSLIB_QWL_USER, (ULONG)lpMenuInfo);
|
|---|
| 206 | }
|
|---|
| 207 | //******************************************************************************
|
|---|
| 208 | //******************************************************************************
|
|---|
| 209 | LPPOPUPMENU GetInternalMenuInfo(HMENU hMenu)
|
|---|
| 210 | {
|
|---|
| 211 | return (LPPOPUPMENU)OSLibWinGetWindowULong(hMenu, OSLIB_QWL_USER);
|
|---|
| 212 | }
|
|---|
| 213 | //******************************************************************************
|
|---|
| 214 | //******************************************************************************
|
|---|
| 215 | void DeleteInternalMenuInfo(HMENU hMenu)
|
|---|
| 216 | {
|
|---|
| 217 | LPPOPUPMENU lpMenuInfo;
|
|---|
| 218 |
|
|---|
| 219 | lpMenuInfo = (LPPOPUPMENU)OSLibWinGetWindowULong(hMenu, OSLIB_QWL_USER);
|
|---|
| 220 | if(lpMenuInfo) {
|
|---|
| 221 | free(lpMenuInfo);
|
|---|
| 222 | OSLibWinSetWindowULong(hMenu, OSLIB_QWL_USER, 0);
|
|---|
| 223 | }
|
|---|
| 224 | }
|
|---|
| 225 | //******************************************************************************
|
|---|
| 226 | //******************************************************************************
|
|---|
| 227 | ODINFUNCTION0(HMENU, CreateMenu)
|
|---|
| 228 | {
|
|---|
| 229 | HMENU hMenu;
|
|---|
| 230 |
|
|---|
| 231 | dprintf(("USER32: CreateMenu\n"));
|
|---|
| 232 |
|
|---|
| 233 | hMenu = OSLibWinCreateEmptyMenu();
|
|---|
| 234 | if(hMenu) {
|
|---|
| 235 | SetInternalMenuInfo(hMenu);
|
|---|
| 236 | }
|
|---|
| 237 | else SetLastError(ERROR_INVALID_PARAMETER); //wrong error
|
|---|
| 238 |
|
|---|
| 239 | return hMenu;
|
|---|
| 240 | }
|
|---|
| 241 | //******************************************************************************
|
|---|
| 242 | //******************************************************************************
|
|---|
| 243 | ODINFUNCTION0(HMENU, CreatePopupMenu)
|
|---|
| 244 | {
|
|---|
| 245 | HMENU hMenu;
|
|---|
| 246 |
|
|---|
| 247 | dprintf(("USER32: CreatePopupMenu\n"));
|
|---|
| 248 |
|
|---|
| 249 | hMenu = OSLibWinCreateEmptyPopupMenu();
|
|---|
| 250 | if(hMenu) {
|
|---|
| 251 | SetInternalMenuInfo(hMenu);
|
|---|
| 252 | }
|
|---|
| 253 | else SetLastError(ERROR_INVALID_PARAMETER); //wrong error
|
|---|
| 254 |
|
|---|
| 255 | return hMenu;
|
|---|
| 256 | }
|
|---|
| 257 | //******************************************************************************
|
|---|
| 258 | //******************************************************************************
|
|---|
| 259 | ODINFUNCTION2(HMENU, LoadMenuA,
|
|---|
| 260 | HINSTANCE, hinst,
|
|---|
| 261 | LPCSTR, lpszMenu)
|
|---|
| 262 | {
|
|---|
| 263 | Win32Resource *winres;
|
|---|
| 264 | HMENU hMenu;
|
|---|
| 265 |
|
|---|
| 266 | winres = (Win32Resource *)FindResourceA(hinst, lpszMenu, RT_MENUA);
|
|---|
| 267 | if(winres)
|
|---|
| 268 | {
|
|---|
| 269 | hMenu = myLoadMenuIndirect((MENUITEMTEMPLATEHEADER *)winres->lockResource());
|
|---|
| 270 | if(hMenu) {
|
|---|
| 271 | SetInternalMenuInfo(hMenu);
|
|---|
| 272 | }
|
|---|
| 273 | else SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 274 |
|
|---|
| 275 | delete winres;
|
|---|
| 276 | return hMenu;
|
|---|
| 277 | }
|
|---|
| 278 | return 0;
|
|---|
| 279 | }
|
|---|
| 280 | //******************************************************************************
|
|---|
| 281 | //******************************************************************************
|
|---|
| 282 | ODINFUNCTION2(HMENU, LoadMenuW,
|
|---|
| 283 | HINSTANCE, hinst,
|
|---|
| 284 | LPCWSTR, lpszMenu)
|
|---|
| 285 | {
|
|---|
| 286 | Win32Resource *winres;
|
|---|
| 287 | HMENU hMenu;
|
|---|
| 288 |
|
|---|
| 289 | winres = (Win32Resource *)FindResourceW(hinst, lpszMenu, RT_MENUW);
|
|---|
| 290 | if(winres) {
|
|---|
| 291 | hMenu = myLoadMenuIndirect((MENUITEMTEMPLATEHEADER *)winres->lockResource());
|
|---|
| 292 | if(hMenu) {
|
|---|
| 293 | SetInternalMenuInfo(hMenu);
|
|---|
| 294 | }
|
|---|
| 295 | else SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 296 |
|
|---|
| 297 | delete winres;
|
|---|
| 298 | return hMenu;
|
|---|
| 299 | }
|
|---|
| 300 | return 0;
|
|---|
| 301 | }
|
|---|
| 302 | //******************************************************************************
|
|---|
| 303 | //NOTE: menutemplate strings are always in Unicode format
|
|---|
| 304 | //******************************************************************************
|
|---|
| 305 | ODINFUNCTION1(HMENU, LoadMenuIndirectW,
|
|---|
| 306 | const MENUITEMTEMPLATEHEADER *, menuTemplate)
|
|---|
| 307 | {
|
|---|
| 308 | HMENU hMenu;
|
|---|
| 309 |
|
|---|
| 310 | hMenu = myLoadMenuIndirect(menuTemplate);
|
|---|
| 311 | if(hMenu) {
|
|---|
| 312 | SetInternalMenuInfo(hMenu);
|
|---|
| 313 | }
|
|---|
| 314 | else SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 315 |
|
|---|
| 316 | return (HMENU)hMenu;
|
|---|
| 317 | }
|
|---|
| 318 | //******************************************************************************
|
|---|
| 319 | //******************************************************************************
|
|---|
| 320 | ODINFUNCTION1(BOOL, DestroyMenu,
|
|---|
| 321 | HMENU, hMenu)
|
|---|
| 322 | {
|
|---|
| 323 | if(hMenu == 0)
|
|---|
| 324 | {
|
|---|
| 325 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 326 | return 0;
|
|---|
| 327 | }
|
|---|
| 328 | DeleteInternalMenuInfo(hMenu);
|
|---|
| 329 | return O32_DestroyMenu(hMenu);
|
|---|
| 330 | }
|
|---|
| 331 | //******************************************************************************
|
|---|
| 332 | //******************************************************************************
|
|---|
| 333 | ODINFUNCTION1(HMENU, GetMenu,
|
|---|
| 334 | HWND, hwnd)
|
|---|
| 335 | {
|
|---|
| 336 | Win32BaseWindow *window;
|
|---|
| 337 |
|
|---|
| 338 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 339 | if(!window)
|
|---|
| 340 | {
|
|---|
| 341 | dprintf(("GetMenu, window %x not found", hwnd));
|
|---|
| 342 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
|---|
| 343 | return 0;
|
|---|
| 344 | }
|
|---|
| 345 |
|
|---|
| 346 | return window->GetMenu();
|
|---|
| 347 | }
|
|---|
| 348 | //******************************************************************************
|
|---|
| 349 | //******************************************************************************
|
|---|
| 350 | ODINFUNCTION2(BOOL, SetMenu,
|
|---|
| 351 | HWND, hwnd,
|
|---|
| 352 | HMENU, hMenu)
|
|---|
| 353 | {
|
|---|
| 354 | Win32BaseWindow *window;
|
|---|
| 355 |
|
|---|
| 356 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 357 | if(!window)
|
|---|
| 358 | {
|
|---|
| 359 | dprintf(("SetMenu, window %x not found", hwnd));
|
|---|
| 360 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
|---|
| 361 | return 0;
|
|---|
| 362 | }
|
|---|
| 363 |
|
|---|
| 364 | window->SetMenu(hMenu);
|
|---|
| 365 | return TRUE;
|
|---|
| 366 | }
|
|---|
| 367 | //******************************************************************************
|
|---|
| 368 | //******************************************************************************
|
|---|
| 369 | ODINFUNCTION0(DWORD, GetMenuCheckMarkDimensions)
|
|---|
| 370 | {
|
|---|
| 371 | return O32_GetMenuCheckMarkDimensions();
|
|---|
| 372 | }
|
|---|
| 373 | //******************************************************************************
|
|---|
| 374 | //******************************************************************************
|
|---|
| 375 | ODINFUNCTION1(int, GetMenuItemCount,
|
|---|
| 376 | HMENU, hMenu)
|
|---|
| 377 | {
|
|---|
| 378 | if(hMenu == 0)
|
|---|
| 379 | {
|
|---|
| 380 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 381 | return 0;
|
|---|
| 382 | }
|
|---|
| 383 | return OSLibGetMenuItemCount(hMenu);
|
|---|
| 384 | }
|
|---|
| 385 | //******************************************************************************
|
|---|
| 386 | //******************************************************************************
|
|---|
| 387 | ODINFUNCTION2(UINT, GetMenuItemID,
|
|---|
| 388 | HMENU, hMenu,
|
|---|
| 389 | int, nPos)
|
|---|
| 390 | {
|
|---|
| 391 | if(hMenu == 0)
|
|---|
| 392 | {
|
|---|
| 393 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 394 | return 0;
|
|---|
| 395 | }
|
|---|
| 396 | return O32_GetMenuItemID(hMenu, nPos);
|
|---|
| 397 | }
|
|---|
| 398 | //******************************************************************************
|
|---|
| 399 | //******************************************************************************
|
|---|
| 400 | ODINFUNCTION3(UINT, GetMenuState,
|
|---|
| 401 | HMENU, hMenu,
|
|---|
| 402 | UINT, arg2,
|
|---|
| 403 | UINT, arg3)
|
|---|
| 404 | {
|
|---|
| 405 | if(hMenu == 0)
|
|---|
| 406 | {
|
|---|
| 407 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 408 | return 0;
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 | return O32_GetMenuState(hMenu, arg2, arg3);
|
|---|
| 412 | }
|
|---|
| 413 | //******************************************************************************
|
|---|
| 414 | //******************************************************************************
|
|---|
| 415 | ODINFUNCTION5(int, GetMenuStringA,
|
|---|
| 416 | HMENU, hMenu,
|
|---|
| 417 | UINT, arg2,
|
|---|
| 418 | LPSTR, arg3,
|
|---|
| 419 | int, arg4,
|
|---|
| 420 | UINT, arg5)
|
|---|
| 421 | {
|
|---|
| 422 | if(hMenu == 0)
|
|---|
| 423 | {
|
|---|
| 424 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 425 | return 0;
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 | return O32_GetMenuString(hMenu, arg2, arg3, arg4, arg5);
|
|---|
| 429 | }
|
|---|
| 430 | //******************************************************************************
|
|---|
| 431 | //******************************************************************************
|
|---|
| 432 | ODINFUNCTION5(int, GetMenuStringW,
|
|---|
| 433 | HMENU, hMenu,
|
|---|
| 434 | UINT, idItem,
|
|---|
| 435 | LPWSTR,lpsz,
|
|---|
| 436 | int, cchMax,
|
|---|
| 437 | UINT, fuFlags)
|
|---|
| 438 | {
|
|---|
| 439 | char *astring = (char *)malloc(cchMax);
|
|---|
| 440 | int rc;
|
|---|
| 441 |
|
|---|
| 442 | rc = ODIN_GetMenuStringA(hMenu, idItem, astring, cchMax, fuFlags);
|
|---|
| 443 | if(rc)
|
|---|
| 444 | {
|
|---|
| 445 | dprintf(("USER32: GetMenuStringW %s\n", astring));
|
|---|
| 446 | AsciiToUnicode(astring, lpsz);
|
|---|
| 447 | }
|
|---|
| 448 | else lpsz[0] = 0;
|
|---|
| 449 | free(astring);
|
|---|
| 450 |
|
|---|
| 451 | return(rc);
|
|---|
| 452 | }
|
|---|
| 453 | //******************************************************************************
|
|---|
| 454 | //******************************************************************************
|
|---|
| 455 | ODINFUNCTION5(BOOL, SetMenuItemBitmaps,
|
|---|
| 456 | HMENU, hMenu,
|
|---|
| 457 | UINT, arg2,
|
|---|
| 458 | UINT, arg3,
|
|---|
| 459 | HBITMAP, arg4,
|
|---|
| 460 | HBITMAP, arg5)
|
|---|
| 461 | {
|
|---|
| 462 | dprintf(("USER32: SetMenuItemBitmaps\n"));
|
|---|
| 463 | if(hMenu == 0)
|
|---|
| 464 | {
|
|---|
| 465 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 466 | return 0;
|
|---|
| 467 | }
|
|---|
| 468 | return O32_SetMenuItemBitmaps(hMenu, arg2, arg3, arg4, arg5);
|
|---|
| 469 | }
|
|---|
| 470 | //******************************************************************************
|
|---|
| 471 | //******************************************************************************
|
|---|
| 472 | ODINFUNCTION2(HMENU, GetSubMenu,
|
|---|
| 473 | HWND, hMenu,
|
|---|
| 474 | int, arg2)
|
|---|
| 475 | {
|
|---|
| 476 | if(hMenu == 0)
|
|---|
| 477 | {
|
|---|
| 478 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 479 | return 0;
|
|---|
| 480 | }
|
|---|
| 481 |
|
|---|
| 482 | return O32_GetSubMenu(hMenu, arg2);
|
|---|
| 483 | }
|
|---|
| 484 | //******************************************************************************
|
|---|
| 485 | //******************************************************************************
|
|---|
| 486 | ODINFUNCTION2(HMENU, GetSystemMenu,
|
|---|
| 487 | HWND, hSystemWindow,
|
|---|
| 488 | BOOL, bRevert)
|
|---|
| 489 | {
|
|---|
| 490 | Win32BaseWindow *window;
|
|---|
| 491 |
|
|---|
| 492 | window = Win32BaseWindow::GetWindowFromHandle(hSystemWindow);
|
|---|
| 493 | if(!window)
|
|---|
| 494 | {
|
|---|
| 495 | dprintf(("GetSystemMenu, window %x not found", hSystemWindow));
|
|---|
| 496 | return 0;
|
|---|
| 497 | }
|
|---|
| 498 |
|
|---|
| 499 | return O32_GetSystemMenu(window->getOS2FrameWindowHandle(), bRevert);
|
|---|
| 500 | }
|
|---|
| 501 | //******************************************************************************
|
|---|
| 502 | //******************************************************************************
|
|---|
| 503 | ODINFUNCTION1(BOOL, IsMenu,
|
|---|
| 504 | HMENU, hMenu)
|
|---|
| 505 | {
|
|---|
| 506 | dprintf(("USER32: IsMenu\n"));
|
|---|
| 507 | return O32_IsMenu(hMenu);
|
|---|
| 508 | }
|
|---|
| 509 | //******************************************************************************
|
|---|
| 510 | //******************************************************************************
|
|---|
| 511 | ODINFUNCTION7(BOOL, TrackPopupMenu,
|
|---|
| 512 | HMENU, hMenu,
|
|---|
| 513 | UINT, arg2,
|
|---|
| 514 | int, arg3,
|
|---|
| 515 | int, arg4,
|
|---|
| 516 | int, arg5,
|
|---|
| 517 | HWND, arg6,
|
|---|
| 518 | const RECT *, arg7)
|
|---|
| 519 | {
|
|---|
| 520 | Win32BaseWindow *window;
|
|---|
| 521 |
|
|---|
| 522 | window = Win32BaseWindow::GetWindowFromHandle(arg6);
|
|---|
| 523 | if(!window)
|
|---|
| 524 | {
|
|---|
| 525 | dprintf(("TrackPopupMenu, window %x not found", arg6));
|
|---|
| 526 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
|---|
| 527 | return 0;
|
|---|
| 528 | }
|
|---|
| 529 | dprintf(("USER32: TrackPopupMenu\n"));
|
|---|
| 530 | if(hMenu == 0)
|
|---|
| 531 | {
|
|---|
| 532 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 533 | return 0;
|
|---|
| 534 | }
|
|---|
| 535 | return O32_TrackPopupMenu(hMenu, arg2, arg3, arg4, arg5, window->getOS2WindowHandle(),
|
|---|
| 536 | arg7);
|
|---|
| 537 | }
|
|---|
| 538 | //******************************************************************************
|
|---|
| 539 | //******************************************************************************
|
|---|
| 540 | ODINFUNCTION6(BOOL, TrackPopupMenuEx,
|
|---|
| 541 | HMENU, hMenu,
|
|---|
| 542 | UINT, flags,
|
|---|
| 543 | int, X,
|
|---|
| 544 | int, Y,
|
|---|
| 545 | HWND, hwnd,
|
|---|
| 546 | LPTPMPARAMS, lpPM)
|
|---|
| 547 | {
|
|---|
| 548 | RECT *rect = NULL;
|
|---|
| 549 | Win32BaseWindow *window;
|
|---|
| 550 |
|
|---|
| 551 | window = Win32BaseWindow::GetWindowFromHandle(hwnd);
|
|---|
| 552 | if(!window)
|
|---|
| 553 | {
|
|---|
| 554 | dprintf(("TrackPopupMenu, window %x not found", hwnd));
|
|---|
| 555 | SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
|---|
| 556 | return 0;
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 | dprintf(("USER32: TrackPopupMenuEx, not completely implemented\n"));
|
|---|
| 560 |
|
|---|
| 561 | if (lpPM != NULL) // this parameter can be NULL
|
|---|
| 562 | if(lpPM->cbSize != 0)
|
|---|
| 563 | rect = &lpPM->rcExclude;
|
|---|
| 564 |
|
|---|
| 565 | if(hMenu == 0)
|
|---|
| 566 | {
|
|---|
| 567 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 568 | return 0;
|
|---|
| 569 | }
|
|---|
| 570 | return O32_TrackPopupMenu(hMenu, flags, X, Y, 0, window->getOS2WindowHandle(), rect);
|
|---|
| 571 | }
|
|---|
| 572 | //******************************************************************************
|
|---|
| 573 | //******************************************************************************
|
|---|
| 574 | ODINFUNCTION4(BOOL, AppendMenuA,
|
|---|
| 575 | HMENU, hMenu,
|
|---|
| 576 | UINT, uFlags,
|
|---|
| 577 | UINT, id,
|
|---|
| 578 | LPCSTR, lpNewItem)
|
|---|
| 579 | {
|
|---|
| 580 | return ODIN_InsertMenuA( hMenu, -1, uFlags | MF_BYPOSITION, id, lpNewItem );
|
|---|
| 581 | }
|
|---|
| 582 | //******************************************************************************
|
|---|
| 583 | //******************************************************************************
|
|---|
| 584 | ODINFUNCTION4(BOOL, AppendMenuW,
|
|---|
| 585 | HMENU, hMenu,
|
|---|
| 586 | UINT, uFlags,
|
|---|
| 587 | UINT, id,
|
|---|
| 588 | LPCWSTR, lpNewItem)
|
|---|
| 589 | {
|
|---|
| 590 | return ODIN_InsertMenuW( hMenu, -1, uFlags | MF_BYPOSITION, id, lpNewItem );
|
|---|
| 591 | }
|
|---|
| 592 | //******************************************************************************
|
|---|
| 593 | //******************************************************************************
|
|---|
| 594 | ODINFUNCTION3(DWORD, CheckMenuItem,
|
|---|
| 595 | HMENU, hMenu,
|
|---|
| 596 | UINT, arg2,
|
|---|
| 597 | UINT, arg3)
|
|---|
| 598 | {
|
|---|
| 599 | dprintf(("USER32: OS2CheckMenuItem\n"));
|
|---|
| 600 | if(hMenu == 0)
|
|---|
| 601 | {
|
|---|
| 602 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 603 | return 0;
|
|---|
| 604 | }
|
|---|
| 605 | return O32_CheckMenuItem(hMenu, arg2, arg3);
|
|---|
| 606 | }
|
|---|
| 607 | //******************************************************************************
|
|---|
| 608 | //******************************************************************************
|
|---|
| 609 | ODINFUNCTION3(BOOL,EnableMenuItem,HMENU,hMenu,
|
|---|
| 610 | UINT, uIDEnableItem,
|
|---|
| 611 | UINT, uEnable)
|
|---|
| 612 | {
|
|---|
| 613 | if(hMenu == 0)
|
|---|
| 614 | {
|
|---|
| 615 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 616 | return 0;
|
|---|
| 617 | }
|
|---|
| 618 |
|
|---|
| 619 | return O32_EnableMenuItem(hMenu,
|
|---|
| 620 | uIDEnableItem,
|
|---|
| 621 | uEnable);
|
|---|
| 622 | }
|
|---|
| 623 | //******************************************************************************
|
|---|
| 624 | //******************************************************************************
|
|---|
| 625 | ODINFUNCTION5(BOOL, ModifyMenuA,
|
|---|
| 626 | HMENU, hMenu,
|
|---|
| 627 | UINT, arg2,
|
|---|
| 628 | UINT, arg3,
|
|---|
| 629 | UINT, arg4,
|
|---|
| 630 | LPCSTR, arg5)
|
|---|
| 631 | {
|
|---|
| 632 | dprintf(("USER32: OS2ModifyMenuA\n"));
|
|---|
| 633 | if(hMenu == 0)
|
|---|
| 634 | {
|
|---|
| 635 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 636 | return 0;
|
|---|
| 637 | }
|
|---|
| 638 | return O32_ModifyMenu(hMenu, arg2, arg3, arg4, arg5);
|
|---|
| 639 | }
|
|---|
| 640 | //******************************************************************************
|
|---|
| 641 | //******************************************************************************
|
|---|
| 642 | ODINFUNCTION5(BOOL, ModifyMenuW,
|
|---|
| 643 | HMENU, hMenu,
|
|---|
| 644 | UINT, arg2,
|
|---|
| 645 | UINT, arg3,
|
|---|
| 646 | UINT, arg4,
|
|---|
| 647 | LPCWSTR, arg5)
|
|---|
| 648 | {
|
|---|
| 649 | BOOL rc;
|
|---|
| 650 | char *astring = NULL;
|
|---|
| 651 |
|
|---|
| 652 | if(hMenu == 0)
|
|---|
| 653 | {
|
|---|
| 654 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 655 | return 0;
|
|---|
| 656 | }
|
|---|
| 657 |
|
|---|
| 658 | if(IS_STRING_ITEM(arg3) && HIWORD(arg5) != 0)
|
|---|
| 659 | astring = UnicodeToAsciiString((LPWSTR)arg5);
|
|---|
| 660 | else
|
|---|
| 661 | astring = (char *) arg5;
|
|---|
| 662 |
|
|---|
| 663 | rc = ODIN_ModifyMenuA(hMenu, arg2, arg3, arg4, astring);
|
|---|
| 664 | if(IS_STRING_ITEM(arg3) && HIWORD(arg5) != 0)
|
|---|
| 665 | FreeAsciiString(astring);
|
|---|
| 666 |
|
|---|
| 667 | return(rc);
|
|---|
| 668 | }
|
|---|
| 669 | //******************************************************************************
|
|---|
| 670 | //******************************************************************************
|
|---|
| 671 | ODINFUNCTION3(BOOL, RemoveMenu,
|
|---|
| 672 | HMENU, hMenu,
|
|---|
| 673 | UINT, arg2,
|
|---|
| 674 | UINT, arg3)
|
|---|
| 675 | {
|
|---|
| 676 | dprintf(("USER32: OS2RemoveMenu\n"));
|
|---|
| 677 | if(hMenu == 0)
|
|---|
| 678 | {
|
|---|
| 679 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 680 | return 0;
|
|---|
| 681 | }
|
|---|
| 682 |
|
|---|
| 683 | return O32_RemoveMenu(hMenu, arg2, arg3);
|
|---|
| 684 | }
|
|---|
| 685 | //******************************************************************************
|
|---|
| 686 | //******************************************************************************
|
|---|
| 687 | ODINFUNCTION3(BOOL, DeleteMenu,
|
|---|
| 688 | HMENU, hMenu,
|
|---|
| 689 | UINT, arg2,
|
|---|
| 690 | UINT, arg3)
|
|---|
| 691 | {
|
|---|
| 692 | dprintf(("USER32: OS2DeleteMenu\n"));
|
|---|
| 693 | if(hMenu == 0)
|
|---|
| 694 | {
|
|---|
| 695 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 696 | return 0;
|
|---|
| 697 | }
|
|---|
| 698 |
|
|---|
| 699 | return O32_DeleteMenu(hMenu, arg2, arg3);
|
|---|
| 700 | }
|
|---|
| 701 | //******************************************************************************
|
|---|
| 702 | //******************************************************************************
|
|---|
| 703 | ODINFUNCTION4(BOOL, HiliteMenuItem,
|
|---|
| 704 | HWND, hMenu,
|
|---|
| 705 | HMENU, arg2,
|
|---|
| 706 | UINT, arg3,
|
|---|
| 707 | UINT, arg4)
|
|---|
| 708 | {
|
|---|
| 709 | dprintf(("USER32: OS2HiliteMenuItem\n"));
|
|---|
| 710 | if(hMenu == 0)
|
|---|
| 711 | {
|
|---|
| 712 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 713 | return 0;
|
|---|
| 714 | }
|
|---|
| 715 |
|
|---|
| 716 | return O32_HiliteMenuItem(hMenu, arg2, arg3, arg4);
|
|---|
| 717 | }
|
|---|
| 718 | //******************************************************************************
|
|---|
| 719 | //******************************************************************************
|
|---|
| 720 | ODINFUNCTION5(BOOL, InsertMenuA,
|
|---|
| 721 | HMENU, hMenu,
|
|---|
| 722 | UINT, pos,
|
|---|
| 723 | UINT, flags,
|
|---|
| 724 | UINT, id,
|
|---|
| 725 | LPCSTR, str)
|
|---|
| 726 | {
|
|---|
| 727 | if(IS_STRING_ITEM(flags) && HIWORD(str)) {
|
|---|
| 728 | dprintf(("USER32: InsertMenuA %x %d %x %d %s", hMenu, pos, flags, id, str));
|
|---|
| 729 | }
|
|---|
| 730 | else dprintf(("USER32: InsertMenuA %x %d %x %d %x", hMenu, pos, flags, id, str));
|
|---|
| 731 |
|
|---|
| 732 | if(hMenu == 0)
|
|---|
| 733 | {
|
|---|
| 734 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 735 | return 0;
|
|---|
| 736 | }
|
|---|
| 737 |
|
|---|
| 738 | if(IS_STRING_ITEM(flags) && (!str || *str == NULL)) {
|
|---|
| 739 | flags |= MF_SEPARATOR;
|
|---|
| 740 | }
|
|---|
| 741 | return O32_InsertMenu(hMenu, pos, flags, id, str);
|
|---|
| 742 | }
|
|---|
| 743 | //******************************************************************************
|
|---|
| 744 | //******************************************************************************
|
|---|
| 745 | ODINFUNCTION5(BOOL, InsertMenuW,
|
|---|
| 746 | HMENU, hMenu,
|
|---|
| 747 | UINT, arg2,
|
|---|
| 748 | UINT, arg3,
|
|---|
| 749 | UINT, arg4,
|
|---|
| 750 | LPCWSTR, arg5)
|
|---|
| 751 | {
|
|---|
| 752 | BOOL rc;
|
|---|
| 753 | char *astring = NULL;
|
|---|
| 754 |
|
|---|
| 755 | if(IS_STRING_ITEM(arg3) && HIWORD(arg5) != 0)
|
|---|
| 756 | astring = UnicodeToAsciiString((LPWSTR)arg5);
|
|---|
| 757 | else
|
|---|
| 758 | astring = (char *) arg5;
|
|---|
| 759 |
|
|---|
| 760 | rc = ODIN_InsertMenuA(hMenu, arg2, arg3, arg4, astring);
|
|---|
| 761 |
|
|---|
| 762 | if(IS_STRING_ITEM(arg3) && HIWORD(arg5) != 0)
|
|---|
| 763 | FreeAsciiString(astring);
|
|---|
| 764 |
|
|---|
| 765 | return(rc);
|
|---|
| 766 | }
|
|---|
| 767 | //******************************************************************************
|
|---|
| 768 | //******************************************************************************
|
|---|
| 769 | ODINFUNCTION2(BOOL, SetMenuContextHelpId,
|
|---|
| 770 | HMENU, hMenu,
|
|---|
| 771 | DWORD, dwContextHelpId)
|
|---|
| 772 | {
|
|---|
| 773 | POPUPMENU *menu;
|
|---|
| 774 |
|
|---|
| 775 | menu = GetInternalMenuInfo(hMenu);
|
|---|
| 776 | if(menu == NULL) {
|
|---|
| 777 | dprintf(("USER32: SetMenuContextHelpId(%x) No POPUPMENU structure found!", hMenu));
|
|---|
| 778 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 779 | return FALSE;
|
|---|
| 780 | }
|
|---|
| 781 | dprintf(("USER32: SetMenuContextHelpId %x %d", hMenu, dwContextHelpId));
|
|---|
| 782 | menu->dwContextHelpID = dwContextHelpId;
|
|---|
| 783 | return(TRUE);
|
|---|
| 784 | }
|
|---|
| 785 | //******************************************************************************
|
|---|
| 786 | //******************************************************************************
|
|---|
| 787 | ODINFUNCTION1(DWORD, GetMenuContextHelpId,
|
|---|
| 788 | HMENU, hMenu)
|
|---|
| 789 | {
|
|---|
| 790 | POPUPMENU *menu;
|
|---|
| 791 |
|
|---|
| 792 | menu = GetInternalMenuInfo(hMenu);
|
|---|
| 793 | if(menu == NULL) {
|
|---|
| 794 | dprintf(("USER32: GetMenuContextHelpId(%x) No POPUPMENU structure found!", hMenu));
|
|---|
| 795 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 796 | return 0;
|
|---|
| 797 | }
|
|---|
| 798 | dprintf(("USER32: GetMenuContextHelpId %x %d", hMenu, menu->dwContextHelpID));
|
|---|
| 799 | return menu->dwContextHelpID;
|
|---|
| 800 | }
|
|---|
| 801 | //******************************************************************************
|
|---|
| 802 | //******************************************************************************
|
|---|
| 803 | ODINFUNCTION5(BOOL, CheckMenuRadioItem,
|
|---|
| 804 | HMENU, hMenu,
|
|---|
| 805 | UINT, idFirst,
|
|---|
| 806 | UINT, idLast,
|
|---|
| 807 | UINT, idCheck,
|
|---|
| 808 | UINT, uFlags)
|
|---|
| 809 | {
|
|---|
| 810 | dprintf(("USER32: OS2CheckMenuRadioItem, not implemented\n"));
|
|---|
| 811 | return(TRUE);
|
|---|
| 812 | }
|
|---|
| 813 | //******************************************************************************
|
|---|
| 814 | //******************************************************************************
|
|---|
| 815 | ODINFUNCTION5(BOOL, ChangeMenuA,
|
|---|
| 816 | HMENU, hMenu,
|
|---|
| 817 | UINT, pos,
|
|---|
| 818 | LPCSTR, data,
|
|---|
| 819 | UINT, id,
|
|---|
| 820 | UINT, flags)
|
|---|
| 821 | {
|
|---|
| 822 | dprintf(("USER32: ChangeMenuA flags %X\n", flags));
|
|---|
| 823 |
|
|---|
| 824 | if (flags & MF_APPEND) return ODIN_AppendMenuA(hMenu, flags & ~MF_APPEND,
|
|---|
| 825 | id, data );
|
|---|
| 826 | if (flags & MF_DELETE) return ODIN_DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
|
|---|
| 827 | if (flags & MF_CHANGE) return ODIN_ModifyMenuA(hMenu, pos, flags & ~MF_CHANGE,
|
|---|
| 828 | id, data );
|
|---|
| 829 | if (flags & MF_REMOVE) return ODIN_RemoveMenu(hMenu,
|
|---|
| 830 | flags & MF_BYPOSITION ? pos : id,
|
|---|
| 831 | flags & ~MF_REMOVE );
|
|---|
| 832 | /* Default: MF_INSERT */
|
|---|
| 833 | return InsertMenuA( hMenu, pos, flags, id, data );
|
|---|
| 834 | }
|
|---|
| 835 | //******************************************************************************
|
|---|
| 836 | //******************************************************************************
|
|---|
| 837 | ODINFUNCTION5(BOOL, ChangeMenuW,
|
|---|
| 838 | HMENU, hMenu,
|
|---|
| 839 | UINT, pos,
|
|---|
| 840 | LPCWSTR, data,
|
|---|
| 841 | UINT, id,
|
|---|
| 842 | UINT, flags)
|
|---|
| 843 | {
|
|---|
| 844 | dprintf(("USER32: ChangeMenuW flags %X\n", flags));
|
|---|
| 845 |
|
|---|
| 846 | if (flags & MF_APPEND) return ODIN_AppendMenuW(hMenu, flags & ~MF_APPEND,
|
|---|
| 847 | id, data );
|
|---|
| 848 | if (flags & MF_DELETE) return ODIN_DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
|
|---|
| 849 | if (flags & MF_CHANGE) return ODIN_ModifyMenuW(hMenu, pos, flags & ~MF_CHANGE,
|
|---|
| 850 | id, data );
|
|---|
| 851 | if (flags & MF_REMOVE) return ODIN_RemoveMenu(hMenu,
|
|---|
| 852 | flags & MF_BYPOSITION ? pos : id,
|
|---|
| 853 | flags & ~MF_REMOVE );
|
|---|
| 854 | /* Default: MF_INSERT */
|
|---|
| 855 | return InsertMenuW(hMenu, pos, flags, id, data);
|
|---|
| 856 | }
|
|---|
| 857 | //******************************************************************************
|
|---|
| 858 | //******************************************************************************
|
|---|
| 859 | ODINFUNCTION4(BOOL, SetMenuItemInfoA,
|
|---|
| 860 | HMENU, hMenu,
|
|---|
| 861 | UINT, par1,
|
|---|
| 862 | BOOL, par2,
|
|---|
| 863 | const MENUITEMINFOA *, lpmii)
|
|---|
| 864 | {
|
|---|
| 865 | dprintf(("USER32: SetMenuItemInfoA faked %x", hMenu));
|
|---|
| 866 |
|
|---|
| 867 | if (!hMenu) {
|
|---|
| 868 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 869 | return FALSE;
|
|---|
| 870 | }
|
|---|
| 871 | return TRUE;
|
|---|
| 872 | }
|
|---|
| 873 | /*****************************************************************************
|
|---|
| 874 | * Function : SetMenuItemInfoW
|
|---|
| 875 | * Purpose : The SetMenuItemInfo function changes information about a menu item.
|
|---|
| 876 | * Parameters:
|
|---|
| 877 | * Variables :
|
|---|
| 878 | * Result : If the function succeeds, the return value is TRUE.
|
|---|
| 879 | * If the function fails, the return value is FALSE. To get extended
|
|---|
| 880 | * error information, use the GetLastError function.
|
|---|
| 881 | * Remark :
|
|---|
| 882 | * Status : UNTESTED STUB
|
|---|
| 883 | *
|
|---|
| 884 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 885 | *****************************************************************************/
|
|---|
| 886 |
|
|---|
| 887 | ODINFUNCTION4(BOOL, SetMenuItemInfoW,
|
|---|
| 888 | HMENU, hMenu,
|
|---|
| 889 | UINT, uItem,
|
|---|
| 890 | BOOL, fByPosition,
|
|---|
| 891 | const MENUITEMINFOW *, lpmmi)
|
|---|
| 892 | {
|
|---|
| 893 | dprintf(("USER32:SetMenuItemInfoW (%08xh,%08xh,%08xh,%08x) not implemented.\n",
|
|---|
| 894 | hMenu,
|
|---|
| 895 | uItem,
|
|---|
| 896 | fByPosition,
|
|---|
| 897 | lpmmi));
|
|---|
| 898 |
|
|---|
| 899 | return (SetMenuItemInfoA(hMenu,
|
|---|
| 900 | uItem,
|
|---|
| 901 | fByPosition,
|
|---|
| 902 | (const MENUITEMINFOA *)lpmmi));
|
|---|
| 903 | }
|
|---|
| 904 | /*****************************************************************************
|
|---|
| 905 | * Function : GetMenuDefaultItem
|
|---|
| 906 | * Purpose : TheGetMenuDefaultItem function determines the default menu item
|
|---|
| 907 | * on the specified menu.
|
|---|
| 908 | * Parameters:
|
|---|
| 909 | * Variables :
|
|---|
| 910 | * Result : If the function succeeds, the return value is the identifier or
|
|---|
| 911 | * position of the menu item.
|
|---|
| 912 | * If the function fails, the return value is - 1.
|
|---|
| 913 | * Remark :
|
|---|
| 914 | * Status : UNTESTED STUB
|
|---|
| 915 | *
|
|---|
| 916 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 917 | *****************************************************************************/
|
|---|
| 918 |
|
|---|
| 919 | ODINFUNCTION3(UINT, GetMenuDefaultItem,
|
|---|
| 920 | HMENU, hMenu,
|
|---|
| 921 | UINT, fByPos,
|
|---|
| 922 | UINT, gmdiFlags)
|
|---|
| 923 | {
|
|---|
| 924 | dprintf(("USER32:GetMenuDefaultItem (%08xh,%u,%08x) not implemented.\n",
|
|---|
| 925 | hMenu,
|
|---|
| 926 | fByPos,
|
|---|
| 927 | gmdiFlags));
|
|---|
| 928 |
|
|---|
| 929 | return (-1);
|
|---|
| 930 | }
|
|---|
| 931 | //******************************************************************************
|
|---|
| 932 | //******************************************************************************
|
|---|
| 933 | ODINFUNCTION3(BOOL, SetMenuDefaultItem,
|
|---|
| 934 | HMENU, hMenu,
|
|---|
| 935 | UINT, uItem,
|
|---|
| 936 | UINT, fByPos)
|
|---|
| 937 | {
|
|---|
| 938 | dprintf(("USER32: SetMenuDefaultItem, faked\n"));
|
|---|
| 939 | return(TRUE);
|
|---|
| 940 | }
|
|---|
| 941 | //******************************************************************************
|
|---|
| 942 | //******************************************************************************
|
|---|
| 943 | BOOL GetMenuItemInfoAW(HMENU hMenu, UINT uItem, BOOL byPos, MENUITEMINFOA *lpmii, BOOL unicode)
|
|---|
| 944 | {
|
|---|
| 945 | if(byPos) {
|
|---|
| 946 | uItem = GetMenuItemID(hMenu, uItem);
|
|---|
| 947 | }
|
|---|
| 948 | if(ODIN_GetMenuState(hMenu, uItem, MF_BYCOMMAND) == -1) {
|
|---|
| 949 | //item doesn't exist
|
|---|
| 950 | dprintf(("USER32: GetMenuItemInfoAW %x item %d doesn't exist", hMenu, uItem));
|
|---|
| 951 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 952 | return FALSE;
|
|---|
| 953 | }
|
|---|
| 954 | if (lpmii->fMask & MIIM_TYPE)
|
|---|
| 955 | {
|
|---|
| 956 | lpmii->fType = ODIN_GetMenuState(hMenu, uItem, MF_BYCOMMAND); //not correct
|
|---|
| 957 | // lpmii->fType = menu->fType;
|
|---|
| 958 | if (unicode) {
|
|---|
| 959 | lpmii->cch = ODIN_GetMenuStringW(hMenu, uItem, (LPWSTR)lpmii->dwTypeData, lpmii->cch, MF_BYCOMMAND);
|
|---|
| 960 | }
|
|---|
| 961 | else {
|
|---|
| 962 | lpmii->cch = ODIN_GetMenuStringA(hMenu, uItem, (LPSTR)lpmii->dwTypeData, lpmii->cch, MF_BYCOMMAND);
|
|---|
| 963 | }
|
|---|
| 964 | //TODO:
|
|---|
| 965 | #if 0
|
|---|
| 966 | switch (MENU_ITEM_TYPE(menu->fType)) {
|
|---|
| 967 | case MF_STRING:
|
|---|
| 968 | if (menu->text && lpmii->dwTypeData && lpmii->cch) {
|
|---|
| 969 | if (unicode) {
|
|---|
| 970 | lstrcpynAtoW((LPWSTR) lpmii->dwTypeData, menu->text, lpmii->cch);
|
|---|
| 971 | lpmii->cch = lstrlenW((LPWSTR)menu->text);
|
|---|
| 972 | }
|
|---|
| 973 | else {
|
|---|
| 974 | lstrcpynA(lpmii->dwTypeData, menu->text, lpmii->cch);
|
|---|
| 975 | lpmii->cch = lstrlenA(menu->text);
|
|---|
| 976 | }
|
|---|
| 977 | }
|
|---|
| 978 | break;
|
|---|
| 979 | case MF_OWNERDRAW:
|
|---|
| 980 | case MF_BITMAP:
|
|---|
| 981 | lpmii->dwTypeData = menu->text;
|
|---|
| 982 | /* fall through */
|
|---|
| 983 | default:
|
|---|
| 984 | lpmii->cch = 0;
|
|---|
| 985 | }
|
|---|
| 986 | #endif
|
|---|
| 987 | }
|
|---|
| 988 |
|
|---|
| 989 | if (lpmii->fMask & MIIM_STRING) {
|
|---|
| 990 | if (unicode) {
|
|---|
| 991 | lpmii->cch = ODIN_GetMenuStringW(hMenu, uItem, (LPWSTR)lpmii->dwTypeData, lpmii->cch, MF_BYCOMMAND);
|
|---|
| 992 | }
|
|---|
| 993 | else {
|
|---|
| 994 | lpmii->cch = ODIN_GetMenuStringA(hMenu, uItem, (LPSTR)lpmii->dwTypeData, lpmii->cch, MF_BYCOMMAND);
|
|---|
| 995 | }
|
|---|
| 996 | }
|
|---|
| 997 |
|
|---|
| 998 | //TODO:
|
|---|
| 999 | #if 0
|
|---|
| 1000 | if (lpmii->fMask & MIIM_FTYPE)
|
|---|
| 1001 | lpmii->fType = menu->fType;
|
|---|
| 1002 |
|
|---|
| 1003 | if (lpmii->fMask & MIIM_BITMAP)
|
|---|
| 1004 | lpmii->hbmpItem = menu->hbmpItem;
|
|---|
| 1005 | #endif
|
|---|
| 1006 |
|
|---|
| 1007 | if (lpmii->fMask & MIIM_STATE)
|
|---|
| 1008 | lpmii->fState = ODIN_GetMenuState(hMenu, uItem, MF_BYCOMMAND);
|
|---|
| 1009 |
|
|---|
| 1010 | if (lpmii->fMask & MIIM_ID)
|
|---|
| 1011 | lpmii->wID = uItem;
|
|---|
| 1012 |
|
|---|
| 1013 | //TODO:
|
|---|
| 1014 | #if 1
|
|---|
| 1015 | lpmii->hSubMenu = 0;
|
|---|
| 1016 | lpmii->hbmpChecked = 0;
|
|---|
| 1017 | lpmii->hbmpUnchecked = 0;
|
|---|
| 1018 | lpmii->dwItemData = 0;
|
|---|
| 1019 | #else
|
|---|
| 1020 | if (lpmii->fMask & MIIM_SUBMENU)
|
|---|
| 1021 | lpmii->hSubMenu = ODIN_GetSubMenu(hMenu, uItem); //need index, not id
|
|---|
| 1022 |
|
|---|
| 1023 | if (lpmii->fMask & MIIM_CHECKMARKS) {
|
|---|
| 1024 | lpmii->hbmpChecked = menu->hCheckBit;
|
|---|
| 1025 | lpmii->hbmpUnchecked = menu->hUnCheckBit;
|
|---|
| 1026 | }
|
|---|
| 1027 | if (lpmii->fMask & MIIM_DATA)
|
|---|
| 1028 | lpmii->dwItemData = menu->dwItemData;
|
|---|
| 1029 | #endif
|
|---|
| 1030 |
|
|---|
| 1031 | return(FALSE);
|
|---|
| 1032 | }
|
|---|
| 1033 | //******************************************************************************
|
|---|
| 1034 | //******************************************************************************
|
|---|
| 1035 | ODINFUNCTION4(BOOL, GetMenuItemInfoA,
|
|---|
| 1036 | HMENU, hMenu,
|
|---|
| 1037 | UINT, uItem,
|
|---|
| 1038 | BOOL, byPos,
|
|---|
| 1039 | MENUITEMINFOA *, lpMenuItemInfo)
|
|---|
| 1040 | {
|
|---|
| 1041 | return GetMenuItemInfoAW(hMenu, uItem, byPos, lpMenuItemInfo, FALSE);
|
|---|
| 1042 | }
|
|---|
| 1043 | /*****************************************************************************
|
|---|
| 1044 | * Function : GetMenuItemInfoW
|
|---|
| 1045 | * Purpose : The GetMenuItemInfo function retrieves information about a menu item.
|
|---|
| 1046 | * Parameters:
|
|---|
| 1047 | * Variables :
|
|---|
| 1048 | * Result : If the function succeeds, the return value is TRUE.
|
|---|
| 1049 | * If the function fails, the return value is FALSE. To get extended
|
|---|
| 1050 | * error information, use the GetLastError function.
|
|---|
| 1051 | * Remark :
|
|---|
| 1052 | * Status : UNTESTED STUB
|
|---|
| 1053 | *
|
|---|
| 1054 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 1055 | *****************************************************************************/
|
|---|
| 1056 |
|
|---|
| 1057 | ODINFUNCTION4(BOOL, GetMenuItemInfoW,
|
|---|
| 1058 | HMENU, hMenu,
|
|---|
| 1059 | UINT, uItem,
|
|---|
| 1060 | BOOL, byPos,
|
|---|
| 1061 | MENUITEMINFOW *, lpMenuItemInfo)
|
|---|
| 1062 | {
|
|---|
| 1063 | return GetMenuItemInfoAW(hMenu, uItem, byPos, (MENUITEMINFOA*)lpMenuItemInfo, TRUE);
|
|---|
| 1064 | }
|
|---|
| 1065 | /*****************************************************************************
|
|---|
| 1066 | * Function : GetMenuItemRect
|
|---|
| 1067 | * Purpose : The GetMenuItemRect function retrieves the bounding rectangle
|
|---|
| 1068 | * for the specified menu item.
|
|---|
| 1069 | * Parameters:
|
|---|
| 1070 | * Variables :
|
|---|
| 1071 | * Result : If the function succeeds, the return value is TRUE.
|
|---|
| 1072 | * If the function fails, the return value is FALSE. To get
|
|---|
| 1073 | * extended error information, use the GetLastError function.
|
|---|
| 1074 | * Remark :
|
|---|
| 1075 | * Status :
|
|---|
| 1076 | *
|
|---|
| 1077 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 1078 | *****************************************************************************/
|
|---|
| 1079 |
|
|---|
| 1080 | ODINFUNCTION4(BOOL, GetMenuItemRect,
|
|---|
| 1081 | HWND, hWnd,
|
|---|
| 1082 | HMENU, hMenu,
|
|---|
| 1083 | UINT, uItem,
|
|---|
| 1084 | LPRECT, lprcItem)
|
|---|
| 1085 | {
|
|---|
| 1086 | return OSLibGetMenuItemRect(hMenu, uItem, lprcItem);
|
|---|
| 1087 | }
|
|---|
| 1088 | /*****************************************************************************
|
|---|
| 1089 | * Function : InsertMenuItemA
|
|---|
| 1090 | * Purpose : The InsertMenuItem function inserts a new menu item at the specified
|
|---|
| 1091 | * position in a menu bar or pop-up menu.
|
|---|
| 1092 | * Parameters:
|
|---|
| 1093 | * Variables :
|
|---|
| 1094 | * Result : If the function succeeds, the return value is TRUE.
|
|---|
| 1095 | * If the function fails, the return value is FALSE. To get extended
|
|---|
| 1096 | * error information, use the GetLastError function.
|
|---|
| 1097 | * Remark :
|
|---|
| 1098 | * Status : UNTESTED STUB
|
|---|
| 1099 | *
|
|---|
| 1100 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 1101 | *****************************************************************************/
|
|---|
| 1102 |
|
|---|
| 1103 | ODINFUNCTION4(BOOL, InsertMenuItemA,
|
|---|
| 1104 | HMENU, hMenu,
|
|---|
| 1105 | UINT, uItem,
|
|---|
| 1106 | BOOL, fByPosition,
|
|---|
| 1107 | const MENUITEMINFOA*, lpmii)
|
|---|
| 1108 | {
|
|---|
| 1109 | dprintf(("USER32:InsertMenuItemA (%08xh,%08xh,%u,%08x) not correctly implemented.\n",
|
|---|
| 1110 | hMenu,
|
|---|
| 1111 | uItem,
|
|---|
| 1112 | fByPosition,
|
|---|
| 1113 | lpmii));
|
|---|
| 1114 |
|
|---|
| 1115 | if(fByPosition) {
|
|---|
| 1116 | return ODIN_InsertMenuA(hMenu, uItem, lpmii->fType | MF_BYPOSITION, (lpmii->fType & MF_POPUP) ? lpmii->hSubMenu : lpmii->wID, lpmii->dwTypeData);
|
|---|
| 1117 | }
|
|---|
| 1118 | else return ODIN_InsertMenuA(hMenu, uItem, lpmii->fType | MF_BYCOMMAND, (lpmii->fType & MF_POPUP) ? lpmii->hSubMenu : lpmii->wID, lpmii->dwTypeData);
|
|---|
| 1119 | }
|
|---|
| 1120 |
|
|---|
| 1121 |
|
|---|
| 1122 | /*****************************************************************************
|
|---|
| 1123 | * Function : InsertMenuItemW
|
|---|
| 1124 | * Purpose : The InsertMenuItem function inserts a new menu item at the specified
|
|---|
| 1125 | * position in a menu bar or pop-up menu.
|
|---|
| 1126 | * Parameters:
|
|---|
| 1127 | * Variables :
|
|---|
| 1128 | * Result : If the function succeeds, the return value is TRUE.
|
|---|
| 1129 | * If the function fails, the return value is FALSE. To get extended
|
|---|
| 1130 | * error information, use the GetLastError function.
|
|---|
| 1131 | * Remark :
|
|---|
| 1132 | * Status : UNTESTED STUB
|
|---|
| 1133 | *
|
|---|
| 1134 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 1135 | *****************************************************************************/
|
|---|
| 1136 |
|
|---|
| 1137 | ODINFUNCTION4(BOOL, InsertMenuItemW,
|
|---|
| 1138 | HMENU, hMenu,
|
|---|
| 1139 | UINT, uItem,
|
|---|
| 1140 | BOOL, fByPosition,
|
|---|
| 1141 | const MENUITEMINFOW *, lpmii)
|
|---|
| 1142 | {
|
|---|
| 1143 | dprintf(("USER32:InsertMenuItemW (%08xh,%08xh,%u,%08x) not correctly implemented.\n",
|
|---|
| 1144 | hMenu,
|
|---|
| 1145 | uItem,
|
|---|
| 1146 | fByPosition,
|
|---|
| 1147 | lpmii));
|
|---|
| 1148 |
|
|---|
| 1149 | if(fByPosition) {
|
|---|
| 1150 | return ODIN_InsertMenuW(hMenu, uItem, lpmii->fType | MF_BYPOSITION, (lpmii->fType & MF_POPUP) ? lpmii->hSubMenu : lpmii->wID, lpmii->dwTypeData);
|
|---|
| 1151 | }
|
|---|
| 1152 | else return ODIN_InsertMenuW(hMenu, uItem, lpmii->fType | MF_BYCOMMAND, (lpmii->fType & MF_POPUP) ? lpmii->hSubMenu : lpmii->wID, lpmii->dwTypeData);
|
|---|
| 1153 | }
|
|---|
| 1154 | /*****************************************************************************
|
|---|
| 1155 | * Function : MenuItemFromPoint
|
|---|
| 1156 | * Purpose : TheMenuItemFromPoint function determines which menu item, if
|
|---|
| 1157 | * any, is at the specified location.
|
|---|
| 1158 | * Parameters:
|
|---|
| 1159 | * Variables :
|
|---|
| 1160 | * Result : Returns the zero-based position of the menu item at the specified
|
|---|
| 1161 | * location or -1 if no menu item is at the specified location.
|
|---|
| 1162 | * Remark :
|
|---|
| 1163 | * Status : UNTESTED STUB
|
|---|
| 1164 | *
|
|---|
| 1165 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 1166 | *****************************************************************************/
|
|---|
| 1167 |
|
|---|
| 1168 | ODINFUNCTION3(UINT, MenuItemFromPoint,
|
|---|
| 1169 | HWND, hWnd,
|
|---|
| 1170 | HMENU, hMenu,
|
|---|
| 1171 | POINT, ptScreen)
|
|---|
| 1172 | {
|
|---|
| 1173 | dprintf(("USER32:MenuItemFromPoint (%08xh,%08xh,%u) not implemented.\n",
|
|---|
| 1174 | hWnd,
|
|---|
| 1175 | hMenu,
|
|---|
| 1176 | ptScreen));
|
|---|
| 1177 |
|
|---|
| 1178 | return (-1);
|
|---|
| 1179 | }
|
|---|
| 1180 |
|
|---|
| 1181 |
|
|---|
| 1182 | /*****************************************************************************
|
|---|
| 1183 | * Function : GetMenuInfo
|
|---|
| 1184 | * Parameters:
|
|---|
| 1185 | * Variables :
|
|---|
| 1186 | * Result :
|
|---|
| 1187 | * Remark :
|
|---|
| 1188 | * Status : UNTESTED STUB win98/NT5.0
|
|---|
| 1189 | *
|
|---|
| 1190 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 1191 | *****************************************************************************/
|
|---|
| 1192 |
|
|---|
| 1193 | ODINFUNCTION2(BOOL, GetMenuInfo,
|
|---|
| 1194 | HMENU, hMenu,
|
|---|
| 1195 | LPMENUINFO, lpmi)
|
|---|
| 1196 | {
|
|---|
| 1197 | POPUPMENU *menu;
|
|---|
| 1198 |
|
|---|
| 1199 | menu = GetInternalMenuInfo(hMenu);
|
|---|
| 1200 | if(menu == NULL) {
|
|---|
| 1201 | dprintf(("USER32: GetMenuInfo(%08xh,%08xh) No POPUPMENU structure found!", hMenu, lpmi));
|
|---|
| 1202 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 1203 | return FALSE;
|
|---|
| 1204 | }
|
|---|
| 1205 | dprintf(("USER32: GetMenuInfo(%08xh,%08xh)", hMenu, lpmi));
|
|---|
| 1206 |
|
|---|
| 1207 | if (lpmi)
|
|---|
| 1208 | {
|
|---|
| 1209 | if (lpmi->fMask & MIM_BACKGROUND)
|
|---|
| 1210 | lpmi->hbrBack = menu->hbrBack;
|
|---|
| 1211 |
|
|---|
| 1212 | if (lpmi->fMask & MIM_HELPID)
|
|---|
| 1213 | lpmi->dwContextHelpID = menu->dwContextHelpID;
|
|---|
| 1214 |
|
|---|
| 1215 | if (lpmi->fMask & MIM_MAXHEIGHT)
|
|---|
| 1216 | lpmi->cyMax = menu->cyMax;
|
|---|
| 1217 |
|
|---|
| 1218 | if (lpmi->fMask & MIM_MENUDATA)
|
|---|
| 1219 | lpmi->dwMenuData = menu->dwMenuData;
|
|---|
| 1220 |
|
|---|
| 1221 | if (lpmi->fMask & MIM_STYLE)
|
|---|
| 1222 | lpmi->dwStyle = menu->dwStyle;
|
|---|
| 1223 |
|
|---|
| 1224 | return TRUE;
|
|---|
| 1225 | }
|
|---|
| 1226 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 1227 | return FALSE;
|
|---|
| 1228 | }
|
|---|
| 1229 | /*****************************************************************************
|
|---|
| 1230 | * Function : SetMenuInfo
|
|---|
| 1231 | * Purpose :
|
|---|
| 1232 | * Parameters:
|
|---|
| 1233 | * Variables :
|
|---|
| 1234 | * Result :
|
|---|
| 1235 | * Remark :
|
|---|
| 1236 | * FIXME
|
|---|
| 1237 | * MIM_APPLYTOSUBMENUS
|
|---|
| 1238 | * actually use the items to draw the menu
|
|---|
| 1239 | * Status : UNTESTED STUB win98/NT5.0
|
|---|
| 1240 | *
|
|---|
| 1241 | * Author : Patrick Haller [Thu, 1998/02/26 11:55]
|
|---|
| 1242 | *****************************************************************************/
|
|---|
| 1243 |
|
|---|
| 1244 | ODINFUNCTION2(BOOL, SetMenuInfo,
|
|---|
| 1245 | HMENU, hMenu,
|
|---|
| 1246 | LPCMENUINFO, lpmi)
|
|---|
| 1247 | {
|
|---|
| 1248 | POPUPMENU *menu;
|
|---|
| 1249 |
|
|---|
| 1250 | menu = GetInternalMenuInfo(hMenu);
|
|---|
| 1251 | if(menu == NULL) {
|
|---|
| 1252 | dprintf(("USER32: SetMenuInfo(%08xh,%08xh) No POPUPMENU structure found!", hMenu, lpmi));
|
|---|
| 1253 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 1254 | return FALSE;
|
|---|
| 1255 | }
|
|---|
| 1256 |
|
|---|
| 1257 | dprintf(("USER32: SetMenuInfo(%08xh,%08xh)", hMenu, lpmi));
|
|---|
| 1258 |
|
|---|
| 1259 | if (lpmi && (lpmi->cbSize==sizeof(MENUINFO)))
|
|---|
| 1260 | {
|
|---|
| 1261 | if (lpmi->fMask & MIM_BACKGROUND)
|
|---|
| 1262 | menu->hbrBack = lpmi->hbrBack;
|
|---|
| 1263 |
|
|---|
| 1264 | if (lpmi->fMask & MIM_HELPID)
|
|---|
| 1265 | menu->dwContextHelpID = lpmi->dwContextHelpID;
|
|---|
| 1266 |
|
|---|
| 1267 | if (lpmi->fMask & MIM_MAXHEIGHT)
|
|---|
| 1268 | menu->cyMax = lpmi->cyMax;
|
|---|
| 1269 |
|
|---|
| 1270 | if (lpmi->fMask & MIM_MENUDATA)
|
|---|
| 1271 | menu->dwMenuData = lpmi->dwMenuData;
|
|---|
| 1272 |
|
|---|
| 1273 | if (lpmi->fMask & MIM_STYLE)
|
|---|
| 1274 | menu->dwStyle = lpmi->dwStyle;
|
|---|
| 1275 |
|
|---|
| 1276 | return TRUE;
|
|---|
| 1277 | }
|
|---|
| 1278 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 1279 | return FALSE;
|
|---|
| 1280 | }
|
|---|
| 1281 | //******************************************************************************
|
|---|
| 1282 | //******************************************************************************
|
|---|
| 1283 |
|
|---|