source: trunk/src/user32/winmenu.cpp@ 1021

Last change on this file since 1021 was 1021, checked in by phaller, 26 years ago

Fix: WinMenu:GetSystemMenu fixed

File size: 32.0 KB
Line 
1/* $Id: winmenu.cpp,v 1.5 1999-09-23 14:58:57 phaller 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 <os2win.h>
19#include <odin.h>
20#include <odinwrap.h>
21#include <stdlib.h>
22#include <string.h>
23#include <win32wbase.h>
24#include "oslibmenu.h"
25#include <winresmenu.h>
26
27
28ODINDEBUGCHANNEL(USER32)
29
30//******************************************************************************
31//******************************************************************************
32ODINFUNCTION2(HMENU, LoadMenuA,
33 HINSTANCE, hinst,
34 LPCSTR, lpszMenu)
35{
36 return (HMENU)FindResourceA(hinst, lpszMenu, RT_MENUA);
37}
38//******************************************************************************
39//******************************************************************************
40ODINFUNCTION2(HMENU, LoadMenuW,
41 HINSTANCE, hinst,
42 LPCWSTR, lpszMenu)
43{
44 return (HMENU)FindResourceW(hinst, lpszMenu, RT_MENUW);
45}
46//******************************************************************************
47//TODO: Create PM object?
48//NOTE: menutemplate strings are always in Unicode format
49//******************************************************************************
50ODINFUNCTION1(HMENU, LoadMenuIndirectA,
51 const MENUITEMTEMPLATEHEADER *, menuTemplate)
52{
53 Win32MenuRes *winres;
54
55 winres = new Win32MenuRes((LPVOID)menuTemplate);
56 if(winres == NULL)
57 return 0;
58 else
59 return (HMENU)winres;
60}
61//******************************************************************************
62//******************************************************************************
63ODINFUNCTION1(HMENU, LoadMenuIndirectW,
64 const MENUITEMTEMPLATEHEADER *, menuTemplate)
65{
66 Win32MenuRes *winres;
67
68 winres = new Win32MenuRes((LPVOID)menuTemplate);
69 if(winres == NULL)
70 return 0;
71 else
72 return (HMENU)winres;
73}
74//******************************************************************************
75//******************************************************************************
76ODINFUNCTION1(BOOL, DestroyMenu,
77 HMENU, hmenu)
78{
79 Win32MenuRes *winres;
80
81 if(HIWORD(hmenu) == 0)
82 {
83 SetLastError(ERROR_INVALID_PARAMETER);
84 return FALSE;
85 }
86
87 winres = (Win32MenuRes *)hmenu;
88 delete winres;
89 return TRUE;
90}
91//******************************************************************************
92//******************************************************************************
93ODINFUNCTION1(HMENU, GetMenu,
94 HWND, hwnd)
95{
96 Win32BaseWindow *window;
97
98 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
99 if(!window)
100 {
101 dprintf(("GetMenu, window %x not found", hwnd));
102 return 0;
103 }
104
105 return window->GetMenu();
106}
107//******************************************************************************
108//******************************************************************************
109ODINFUNCTION2(BOOL, SetMenu,
110 HWND, hwnd,
111 HMENU, hmenu)
112{
113 Win32BaseWindow *window;
114
115 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
116 if(!window)
117 {
118 dprintf(("SetMenu, window %x not found", hwnd));
119 return 0;
120 }
121
122 window->SetMenu(hmenu);
123 return TRUE;
124}
125//******************************************************************************
126//******************************************************************************
127ODINFUNCTION0(DWORD, GetMenuCheckMarkDimensions)
128{
129 return O32_GetMenuCheckMarkDimensions();
130}
131//******************************************************************************
132//******************************************************************************
133ODINFUNCTION1(int, GetMenuItemCount,
134 HMENU, hMenu)
135{
136 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
137
138 if(menu == NULL || menu->getOS2Handle() == 0)
139 {
140 SetLastError(ERROR_INVALID_PARAMETER);
141 return 0;
142 }
143
144 return OSLibGetMenuItemCount(menu->getOS2Handle());
145}
146//******************************************************************************
147//******************************************************************************
148ODINFUNCTION2(UINT, GetMenuItemID,
149 HMENU, hMenu,
150 int, nPos)
151{
152 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
153
154 if(menu == NULL || menu->getOS2Handle() == 0)
155 {
156 SetLastError(ERROR_INVALID_PARAMETER);
157 return 0;
158 }
159
160 return O32_GetMenuItemID(menu->getOS2Handle(), nPos);
161}
162//******************************************************************************
163//******************************************************************************
164ODINFUNCTION3(UINT, GetMenuState,
165 HMENU, hMenu,
166 UINT, arg2,
167 UINT, arg3)
168{
169 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
170
171 if(menu == NULL || menu->getOS2Handle() == 0)
172 {
173 SetLastError(ERROR_INVALID_PARAMETER);
174 return 0;
175 }
176
177 return O32_GetMenuState(menu->getOS2Handle(), arg2, arg3);
178}
179//******************************************************************************
180//******************************************************************************
181ODINFUNCTION5(int, GetMenuStringA,
182 HMENU, hMenu,
183 UINT, arg2,
184 LPSTR, arg3,
185 int, arg4,
186 UINT, arg5)
187{
188 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
189
190 if(menu == NULL || menu->getOS2Handle() == 0)
191 {
192 SetLastError(ERROR_INVALID_PARAMETER);
193 return 0;
194 }
195
196 return O32_GetMenuString(menu->getOS2Handle(), arg2, arg3, arg4, arg5);
197}
198//******************************************************************************
199//******************************************************************************
200ODINFUNCTION5(int, GetMenuStringW,
201 HMENU, hMenu,
202 UINT, idItem,
203 LPWSTR,lpsz,
204 int, cchMax,
205 UINT, fuFlags)
206{
207 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
208 char *astring = (char *)malloc(cchMax);
209 int rc;
210
211 if(menu == NULL || menu->getOS2Handle() == 0)
212 {
213 SetLastError(ERROR_INVALID_PARAMETER);
214 return 0;
215 }
216
217 rc = O32_GetMenuString(menu->getOS2Handle(), idItem, astring, cchMax, fuFlags);
218 free(astring);
219 if(rc)
220 {
221 dprintf(("USER32: OS2GetMenuStringW %s\n", astring));
222 AsciiToUnicode(astring, lpsz);
223 }
224 else
225 lpsz[0] = 0;
226
227 return(rc);
228}
229//******************************************************************************
230//******************************************************************************
231ODINFUNCTION5(BOOL, SetMenuItemBitmaps,
232 HMENU, hMenu,
233 UINT, arg2,
234 UINT, arg3,
235 HBITMAP, arg4,
236 HBITMAP, arg5)
237{
238 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
239
240 dprintf(("USER32: SetMenuItemBitmaps\n"));
241 if(menu == NULL || menu->getOS2Handle() == 0)
242 {
243 SetLastError(ERROR_INVALID_PARAMETER);
244 return 0;
245 }
246 return O32_SetMenuItemBitmaps(menu->getOS2Handle(), arg2, arg3, arg4, arg5);
247}
248//******************************************************************************
249//******************************************************************************
250ODINFUNCTION2(HMENU, GetSubMenu,
251 HWND, hMenu,
252 int, arg2)
253{
254 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
255 Win32MenuRes *menuReturned;
256 HMENU hMenuReturned;
257
258 if(menu == NULL || menu->getOS2Handle() == 0)
259 {
260 SetLastError(ERROR_INVALID_PARAMETER);
261 return 0;
262 }
263
264 hMenuReturned = O32_GetSubMenu(menu->getOS2Handle(), arg2);
265 /* @@@PH allocate Win32MenuRes object ! */
266 menuReturned = new Win32MenuRes(hMenuReturned);
267 return ((HMENU)menuReturned);
268}
269//******************************************************************************
270//******************************************************************************
271ODINFUNCTION2(HMENU, GetSystemMenu,
272 HWND, hSystemWindow,
273 BOOL, bRevert)
274{
275 Win32MenuRes *menuReturned;
276 HMENU hMenuReturned;
277 Win32BaseWindow *window;
278
279 window = Win32BaseWindow::GetWindowFromHandle(hSystemWindow);
280 if(!window)
281 {
282 dprintf(("GetSystemMenu, window %x not found", hSystemWindow));
283 return 0;
284 }
285
286 //hMenuReturned = window->GetSystemMenu();
287 hMenuReturned = O32_GetSystemMenu(hSystemWindow, bRevert);
288
289 /* @@@PH allocate Win32MenuRes object ! */
290 menuReturned = new Win32MenuRes(hMenuReturned);
291 return ((HMENU)menuReturned);
292}
293//******************************************************************************
294//******************************************************************************
295ODINFUNCTION1(BOOL, IsMenu,
296 HMENU, hMenu)
297{
298 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
299
300 dprintf(("USER32: IsMenu\n"));
301 if(menu == NULL || menu->getOS2Handle() == 0)
302 {
303 SetLastError(ERROR_INVALID_PARAMETER);
304 return 0;
305 }
306 return O32_IsMenu(menu->getOS2Handle());
307}
308//******************************************************************************
309//******************************************************************************
310ODINFUNCTION7(BOOL, TrackPopupMenu,
311 HMENU, hMenu,
312 UINT, arg2,
313 int, arg3,
314 int, arg4,
315 int, arg5,
316 HWND, arg6,
317 const RECT *, arg7)
318{
319 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
320
321 dprintf(("USER32: TrackPopupMenu\n"));
322 if(menu == NULL || menu->getOS2Handle() == 0)
323 {
324 SetLastError(ERROR_INVALID_PARAMETER);
325 return 0;
326 }
327 return O32_TrackPopupMenu(menu->getOS2Handle(), arg2, arg3, arg4, arg5, arg6, arg7);
328}
329//******************************************************************************
330//******************************************************************************
331ODINFUNCTION6(BOOL, TrackPopupMenuEx,
332 HMENU, hMenu,
333 UINT, flags,
334 int, X,
335 int, Y,
336 HWND, hwnd,
337 LPTPMPARAMS, lpPM)
338{
339 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
340 RECT *rect = NULL;
341
342
343 dprintf(("USER32: TrackPopupMenuEx, not completely implemented\n"));
344 if(lpPM->cbSize != 0)
345 rect = &lpPM->rcExclude;
346
347 if(menu == NULL || menu->getOS2Handle() == 0)
348 {
349 SetLastError(ERROR_INVALID_PARAMETER);
350 return 0;
351 }
352 return O32_TrackPopupMenu(menu->getOS2Handle(), flags, X, Y, 0, hwnd, rect);
353}
354//******************************************************************************
355//******************************************************************************
356ODINFUNCTION4(BOOL, AppendMenuA,
357 HMENU, hMenu,
358 UINT, uFlags,
359 UINT, ulDNewItem,
360 LPCSTR, lpNewItem)
361{
362 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
363 BOOL rc;
364
365 dprintf(("USER32: OS2AppendMenuA uFlags = %X\n", uFlags));
366
367 if(uFlags & MF_STRING || uFlags == 0)
368 dprintf(("USER32: OS2AppendMenuA %s\n", lpNewItem));
369
370 if(menu == NULL || menu->getOS2Handle() == 0)
371 {
372 SetLastError(ERROR_INVALID_PARAMETER);
373 return 0;
374 }
375 rc = O32_AppendMenu(menu->getOS2Handle(), uFlags, ulDNewItem, lpNewItem);
376 dprintf(("USER32: OS2AppendMenuA returned %d\n", rc));
377 return rc;
378}
379//******************************************************************************
380//******************************************************************************
381ODINFUNCTION4(BOOL, AppendMenuW,
382 HMENU, hMenu,
383 UINT, arg2,
384 UINT, arg3,
385 LPCWSTR, arg4)
386{
387 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
388 BOOL rc;
389 char *astring = NULL;
390
391 dprintf(("USER32: OS2AppendMenuW\n"));
392
393 if(arg2 & MF_STRING && (int)arg4 >> 16 != 0)
394 astring = UnicodeToAsciiString((LPWSTR)arg4);
395 else
396 astring = (char *) arg4;
397
398 if(menu == NULL || menu->getOS2Handle() == 0)
399 {
400 SetLastError(ERROR_INVALID_PARAMETER);
401 return 0;
402 }
403 rc = O32_AppendMenu(menu->getOS2Handle(), arg2, arg3, astring);
404 if(arg2 & MF_STRING && (int)arg4 >> 16 != 0)
405 FreeAsciiString(astring);
406 return(rc);
407}
408//******************************************************************************
409//******************************************************************************
410ODINFUNCTION3(DWORD, CheckMenuItem,
411 HMENU, hMenu,
412 UINT, arg2,
413 UINT, arg3)
414{
415 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
416
417 dprintf(("USER32: OS2CheckMenuItem\n"));
418 if(menu == NULL || menu->getOS2Handle() == 0)
419 {
420 SetLastError(ERROR_INVALID_PARAMETER);
421 return 0;
422 }
423 return O32_CheckMenuItem(menu->getOS2Handle(), arg2, arg3);
424}
425//******************************************************************************
426//******************************************************************************
427ODINFUNCTION0(HMENU, CreateMenu)
428{
429 Win32MenuRes *menu = 0;
430 HMENU hMenu;
431
432 hMenu = O32_CreateMenu();
433 if(hMenu)
434 {
435 menu = new Win32MenuRes(hMenu);
436 if(menu == NULL)
437 return 0;
438 }
439
440 return (HMENU)menu;
441}
442//******************************************************************************
443//******************************************************************************
444ODINFUNCTION0(HMENU, CreatePopupMenu)
445{
446 Win32MenuRes *menu = 0;
447 HMENU hMenu;
448
449 hMenu = O32_CreatePopupMenu();
450 if(hMenu)
451 {
452 menu = new Win32MenuRes(hMenu);
453 if(menu == NULL)
454 return 0;
455 }
456
457 return (HMENU)menu;
458}
459//******************************************************************************
460//******************************************************************************
461ODINFUNCTION3(BOOL,EnableMenuItem,HMENU,hMenu,
462 UINT, uIDEnableItem,
463 UINT, uEnable)
464{
465 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
466
467 if(menu == NULL || menu->getOS2Handle() == 0)
468 {
469 SetLastError(ERROR_INVALID_PARAMETER);
470 return 0;
471 }
472
473 return O32_EnableMenuItem(menu->getOS2Handle(),
474 uIDEnableItem,
475 uEnable);
476}
477//******************************************************************************
478//******************************************************************************
479ODINFUNCTION5(BOOL, ModifyMenuA,
480 HMENU, hMenu,
481 UINT, arg2,
482 UINT, arg3,
483 UINT, arg4,
484 LPCSTR, arg5)
485{
486 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
487
488 dprintf(("USER32: OS2ModifyMenuA\n"));
489 if(menu == NULL || menu->getOS2Handle() == 0)
490 {
491 SetLastError(ERROR_INVALID_PARAMETER);
492 return 0;
493 }
494 return O32_ModifyMenu(menu->getOS2Handle(), arg2, arg3, arg4, arg5);
495}
496//******************************************************************************
497//******************************************************************************
498ODINFUNCTION5(BOOL, ModifyMenuW,
499 HMENU, hMenu,
500 UINT, arg2,
501 UINT, arg3,
502 UINT, arg4,
503 LPCWSTR, arg5)
504{
505 BOOL rc;
506 char *astring = NULL;
507 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
508
509 dprintf(("USER32: OS2ModifyMenuW %s\n", astring));
510
511 if(menu == NULL || menu->getOS2Handle() == 0)
512 {
513 SetLastError(ERROR_INVALID_PARAMETER);
514 return 0;
515 }
516
517 if(arg3 & MF_STRING && (int)arg5 >> 16 != 0)
518 astring = UnicodeToAsciiString((LPWSTR)arg5);
519 else
520 astring = (char *) arg5;
521
522 rc = O32_ModifyMenu(menu->getOS2Handle(), arg2, arg3, arg4, astring);
523 if(arg3 & MF_STRING && (int)arg5 >> 16 != 0)
524 FreeAsciiString(astring);
525 return(rc);
526}
527//******************************************************************************
528//******************************************************************************
529ODINFUNCTION3(BOOL, RemoveMenu,
530 HMENU, hMenu,
531 UINT, arg2,
532 UINT, arg3)
533{
534 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
535
536 dprintf(("USER32: OS2RemoveMenu\n"));
537 if(menu == NULL || menu->getOS2Handle() == 0)
538 {
539 SetLastError(ERROR_INVALID_PARAMETER);
540 return 0;
541 }
542
543 return O32_RemoveMenu(menu->getOS2Handle(), arg2, arg3);
544}
545//******************************************************************************
546//******************************************************************************
547ODINFUNCTION3(BOOL, DeleteMenu,
548 HMENU, hMenu,
549 UINT, arg2,
550 UINT, arg3)
551{
552 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
553
554 dprintf(("USER32: OS2DeleteMenu\n"));
555 if(menu == NULL || menu->getOS2Handle() == 0)
556 {
557 SetLastError(ERROR_INVALID_PARAMETER);
558 return 0;
559 }
560
561 return O32_DeleteMenu(menu->getOS2Handle(), arg2, arg3);
562}
563//******************************************************************************
564//******************************************************************************
565ODINFUNCTION4(BOOL, HiliteMenuItem,
566 HWND, hMenu,
567 HMENU, arg2,
568 UINT, arg3,
569 UINT, arg4)
570{
571 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
572
573 dprintf(("USER32: OS2HiliteMenuItem\n"));
574 if(menu == NULL || menu->getOS2Handle() == 0)
575 {
576 SetLastError(ERROR_INVALID_PARAMETER);
577 return 0;
578 }
579
580 return O32_HiliteMenuItem(menu->getOS2Handle(), arg2, arg3, arg4);
581}
582//******************************************************************************
583//******************************************************************************
584ODINFUNCTION5(BOOL, InsertMenuA,
585 HMENU, hMenu,
586 UINT, arg2,
587 UINT, arg3,
588 UINT, arg4,
589 LPCSTR, arg5)
590{
591 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
592
593 dprintf(("USER32: OS2InsertMenuA\n"));
594 if(menu == NULL || menu->getOS2Handle() == 0)
595 {
596 SetLastError(ERROR_INVALID_PARAMETER);
597 return 0;
598 }
599
600 return O32_InsertMenu(menu->getOS2Handle(), arg2, arg3, arg4, arg5);
601}
602//******************************************************************************
603//******************************************************************************
604ODINFUNCTION5(BOOL, InsertMenuW,
605 HMENU, hMenu,
606 UINT, arg2,
607 UINT, arg3,
608 UINT, arg4,
609 LPCWSTR, arg5)
610{
611 BOOL rc;
612 char *astring = NULL;
613 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
614
615 dprintf(("USER32: OS2InsertMenuW %s\n", astring));
616 if(menu == NULL || menu->getOS2Handle() == 0)
617 {
618 SetLastError(ERROR_INVALID_PARAMETER);
619 return 0;
620 }
621 if(arg3 & MF_STRING && (int)arg5 >> 16 != 0)
622 astring = UnicodeToAsciiString((LPWSTR)arg5);
623 else
624 astring = (char *) arg5;
625
626 rc = O32_InsertMenu(menu->getOS2Handle(), arg2, arg3, arg4, astring);
627 if(arg3 & MF_STRING && (int)arg5 >> 16 != 0)
628 FreeAsciiString(astring);
629 return(rc);
630}
631//******************************************************************************
632//******************************************************************************
633ODINFUNCTION2(BOOL, SetMenuContextHelpId,
634 HMENU, hmenu,
635 DWORD, dwContextHelpId)
636{
637 dprintf(("USER32: OS2SetMenuContextHelpId, not implemented\n"));
638 return(TRUE);
639}
640//******************************************************************************
641//******************************************************************************
642ODINFUNCTION1(DWORD, GetMenuContextHelpId,
643 HMENU, hmenu)
644{
645 dprintf(("USER32: OS2GetMenuContextHelpId, not implemented\n"));
646 return(0);
647}
648//******************************************************************************
649//******************************************************************************
650ODINFUNCTION5(BOOL, CheckMenuRadioItem,
651 HMENU, hmenu,
652 UINT, idFirst,
653 UINT, idLast,
654 UINT, idCheck,
655 UINT, uFlags)
656{
657 dprintf(("USER32: OS2CheckMenuRadioItem, not implemented\n"));
658 return(TRUE);
659}
660//******************************************************************************
661//******************************************************************************
662ODINFUNCTION5(BOOL, ChangeMenuA,
663 HMENU, hMenu,
664 UINT, pos,
665 LPCSTR, data,
666 UINT, id,
667 UINT, flags)
668{
669 dprintf(("USER32: ChangeMenuA flags %X\n", flags));
670
671 if (flags & MF_APPEND) return AppendMenuA(hMenu, flags & ~MF_APPEND,
672 id, data );
673 if (flags & MF_DELETE) return DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
674 if (flags & MF_CHANGE) return ModifyMenuA(hMenu, pos, flags & ~MF_CHANGE,
675 id, data );
676 if (flags & MF_REMOVE) return RemoveMenu(hMenu,
677 flags & MF_BYPOSITION ? pos : id,
678 flags & ~MF_REMOVE );
679 /* Default: MF_INSERT */
680 return InsertMenuA( hMenu, pos, flags, id, data );
681}
682//******************************************************************************
683//******************************************************************************
684ODINFUNCTION5(BOOL, ChangeMenuW,
685 HMENU, hMenu,
686 UINT, pos,
687 LPCWSTR, data,
688 UINT, id,
689 UINT, flags)
690{
691 dprintf(("USER32: ChangeMenuW flags %X\n", flags));
692
693 if (flags & MF_APPEND) return AppendMenuW(hMenu, flags & ~MF_APPEND,
694 id, data );
695 if (flags & MF_DELETE) return DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
696 if (flags & MF_CHANGE) return ModifyMenuW(hMenu, pos, flags & ~MF_CHANGE,
697 id, data );
698 if (flags & MF_REMOVE) return RemoveMenu(hMenu,
699 flags & MF_BYPOSITION ? pos : id,
700 flags & ~MF_REMOVE );
701 /* Default: MF_INSERT */
702 return InsertMenuW(hMenu, pos, flags, id, data);
703}
704//******************************************************************************
705//******************************************************************************
706ODINFUNCTION4(BOOL, SetMenuItemInfoA,
707 HMENU, hmenu,
708 UINT, par1,
709 BOOL, par2,
710 const MENUITEMINFOA *, lpMenuItemInfo)
711{
712 dprintf(("USER32: SetMenuItemInfoA, faked\n"));
713 return(TRUE);
714}
715/*****************************************************************************
716 * Function : SetMenuItemInfoW
717 * Purpose : The SetMenuItemInfo function changes information about a menu item.
718 * Parameters:
719 * Variables :
720 * Result : If the function succeeds, the return value is TRUE.
721 * If the function fails, the return value is FALSE. To get extended
722 * error information, use the GetLastError function.
723 * Remark :
724 * Status : UNTESTED STUB
725 *
726 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
727 *****************************************************************************/
728
729ODINFUNCTION4(BOOL, SetMenuItemInfoW,
730 HMENU, hMenu,
731 UINT, uItem,
732 BOOL, fByPosition,
733 const MENUITEMINFOW *, lpmmi)
734{
735 dprintf(("USER32:SetMenuItemInfoW (%08xh,%08xh,%08xh,%08x) not implemented.\n",
736 hMenu,
737 uItem,
738 fByPosition,
739 lpmmi));
740
741 return (SetMenuItemInfoA(hMenu,
742 uItem,
743 fByPosition,
744 (const MENUITEMINFOA *)lpmmi));
745}
746//******************************************************************************
747//******************************************************************************
748ODINFUNCTION3(BOOL, SetMenuDefaultItem,
749 HMENU, hmenu,
750 UINT, uItem,
751 UINT, fByPos)
752{
753 dprintf(("USER32: SetMenuDefaultItem, faked\n"));
754 return(TRUE);
755}
756//******************************************************************************
757//******************************************************************************
758ODINFUNCTION4(BOOL, GetMenuItemInfoA,
759 HMENU, hmenu,
760 UINT, uItem,
761 BOOL, aBool,
762 MENUITEMINFOA *, lpMenuItemInfo)
763{
764 dprintf(("USER32: GetMenuItemInfoA, faked\n"));
765 return(TRUE);
766}
767/*****************************************************************************
768 * Function : GetMenuDefaultItem
769 * Purpose : TheGetMenuDefaultItem function determines the default menu item
770 * on the specified menu.
771 * Parameters:
772 * Variables :
773 * Result : If the function succeeds, the return value is the identifier or
774 * position of the menu item.
775 * If the function fails, the return value is - 1.
776 * Remark :
777 * Status : UNTESTED STUB
778 *
779 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
780 *****************************************************************************/
781
782ODINFUNCTION3(UINT, GetMenuDefaultItem,
783 HMENU, hMenu,
784 UINT, fByPos,
785 UINT, gmdiFlags)
786{
787 dprintf(("USER32:GetMenuDefaultItem (%08xh,%u,%08x) not implemented.\n",
788 hMenu,
789 fByPos,
790 gmdiFlags));
791
792 return (-1);
793}
794
795
796/*****************************************************************************
797 * Function : GetMenuItemInfoW
798 * Purpose : The GetMenuItemInfo function retrieves information about a menu item.
799 * Parameters:
800 * Variables :
801 * Result : If the function succeeds, the return value is TRUE.
802 * If the function fails, the return value is FALSE. To get extended
803 * error information, use the GetLastError function.
804 * Remark :
805 * Status : UNTESTED STUB
806 *
807 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
808 *****************************************************************************/
809
810ODINFUNCTION4(BOOL, GetMenuItemInfoW,
811 HMENU, hMenu,
812 UINT, uItem,
813 BOOL, fByPosition,
814 MENUITEMINFOW *, lpmii)
815{
816 dprintf(("USER32:GetMenuItemInfoW (%08xh,%08xh,%u,%08x) not implemented.\n",
817 hMenu,
818 uItem,
819 fByPosition,
820 lpmii));
821
822 return(GetMenuItemInfoA(hMenu,
823 uItem,
824 fByPosition,
825 (MENUITEMINFOA *)lpmii));
826}
827
828
829/*****************************************************************************
830 * Function : GetMenuItemRect
831 * Purpose : The GetMenuItemRect function retrieves the bounding rectangle
832 * for the specified menu item.
833 * Parameters:
834 * Variables :
835 * Result : If the function succeeds, the return value is TRUE.
836 * If the function fails, the return value is FALSE. To get
837 * extended error information, use the GetLastError function.
838 * Remark :
839 * Status : UNTESTED STUB
840 *
841 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
842 *****************************************************************************/
843
844ODINFUNCTION4(BOOL, GetMenuItemRect,
845 HWND, hWnd,
846 HMENU, hMenu,
847 UINT, uItem,
848 LPRECT, lprcItem)
849{
850 dprintf(("USER32:GetMenuItemRect (%08xh,%08xh,%08xh,%08x) not implemented.\n",
851 hWnd,
852 hMenu,
853 uItem,
854 lprcItem));
855
856 return (FALSE);
857}
858/*****************************************************************************
859 * Function : InsertMenuItemA
860 * Purpose : The InsertMenuItem function inserts a new menu item at the specified
861 * position in a menu bar or pop-up menu.
862 * Parameters:
863 * Variables :
864 * Result : If the function succeeds, the return value is TRUE.
865 * If the function fails, the return value is FALSE. To get extended
866 * error information, use the GetLastError function.
867 * Remark :
868 * Status : UNTESTED STUB
869 *
870 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
871 *****************************************************************************/
872
873ODINFUNCTION4(BOOL, InsertMenuItemA,
874 HMENU, hMenu,
875 UINT, uItem,
876 BOOL, fByPosition,
877 const MENUITEMINFOA*, lpmii)
878{
879 dprintf(("USER32:InsertMenuItemA (%08xh,%08xh,%u,%08x) not implemented.\n",
880 hMenu,
881 uItem,
882 fByPosition,
883 lpmii));
884
885 return (FALSE);
886}
887
888
889/*****************************************************************************
890 * Function : InsertMenuItemW
891 * Purpose : The InsertMenuItem function inserts a new menu item at the specified
892 * position in a menu bar or pop-up menu.
893 * Parameters:
894 * Variables :
895 * Result : If the function succeeds, the return value is TRUE.
896 * If the function fails, the return value is FALSE. To get extended
897 * error information, use the GetLastError function.
898 * Remark :
899 * Status : UNTESTED STUB
900 *
901 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
902 *****************************************************************************/
903
904ODINFUNCTION4(BOOL, InsertMenuItemW,
905 HMENU, hMenu,
906 UINT, uItem,
907 BOOL, fByPosition,
908 const MENUITEMINFOW *, lpmii)
909{
910 dprintf(("USER32:InsertMenuItemW (%08xh,%08xh,%u,%08x) not implemented.\n",
911 hMenu,
912 uItem,
913 fByPosition,
914 lpmii));
915
916 return (FALSE);
917}
918/*****************************************************************************
919 * Function : MenuItemFromPoint
920 * Purpose : TheMenuItemFromPoint function determines which menu item, if
921 * any, is at the specified location.
922 * Parameters:
923 * Variables :
924 * Result : Returns the zero-based position of the menu item at the specified
925 * location or -1 if no menu item is at the specified location.
926 * Remark :
927 * Status : UNTESTED STUB
928 *
929 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
930 *****************************************************************************/
931
932ODINFUNCTION3(UINT, MenuItemFromPoint,
933 HWND, hWnd,
934 HMENU, hMenu,
935 POINT, ptScreen)
936{
937 dprintf(("USER32:MenuItemFromPoint (%08xh,%08xh,%u) not implemented.\n",
938 hWnd,
939 hMenu,
940 ptScreen));
941
942 return (-1);
943}
944
945
946/*****************************************************************************
947 * Function : GetMenuInfo
948 * Parameters:
949 * Variables :
950 * Result :
951 * Remark :
952 * Status : UNTESTED STUB win98/NT5.0
953 *
954 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
955 *****************************************************************************/
956
957ODINFUNCTION2(BOOL, GetMenuInfo,
958 HMENU, hMenu,
959 LPMENUINFO, lpmi)
960{
961 dprintf(("USER32: GetMenuInfo(%08xh,%08xh) not implemented.\n",
962 hMenu,
963 lpmi));
964
965 memset(lpmi,0,sizeof(MENUINFO));
966 return 0;
967}
968#if 0
969 POPUPMENU *menu;
970
971 TRACE("(0x%04x %p)\n", hMenu, lpmi);
972
973 if (lpmi && (menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu)))
974 {
975
976 if (lpmi->fMask & MIM_BACKGROUND)
977 lpmi->hbrBack = menu->hbrBack;
978
979 if (lpmi->fMask & MIM_HELPID)
980 lpmi->dwContextHelpID = menu->dwContextHelpID;
981
982 if (lpmi->fMask & MIM_MAXHEIGHT)
983 lpmi->cyMax = menu->cyMax;
984
985 if (lpmi->fMask & MIM_MENUDATA)
986 lpmi->dwMenuData = menu->dwMenuData;
987
988 if (lpmi->fMask & MIM_STYLE)
989 lpmi->dwStyle = menu->dwStyle;
990
991 return TRUE;
992 }
993 return FALSE;
994}
995#endif
996
997
998/*****************************************************************************
999 * Function : SetMenuInfo
1000 * Purpose :
1001 * Parameters:
1002 * Variables :
1003 * Result :
1004 * Remark :
1005 * FIXME
1006 * MIM_APPLYTOSUBMENUS
1007 * actually use the items to draw the menu
1008 * Status : UNTESTED STUB win98/NT5.0
1009 *
1010 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
1011 *****************************************************************************/
1012
1013ODINFUNCTION2(BOOL, SetMenuInfo,
1014 HMENU, hMenu,
1015 LPCMENUINFO, lpmi)
1016{
1017 dprintf(("USER32: SetMenuInfo(%08xh,%08xh) not implemented.\n",
1018 hMenu,
1019 lpmi));
1020
1021 return 0;
1022}
1023#if 0
1024 POPUPMENU *menu;
1025
1026 TRACE("(0x%04x %p)\n", hMenu, lpmi);
1027
1028
1029
1030 if (lpmi && (lpmi->cbSize==sizeof(MENUINFO)) && (menu=(POPUPMENU*)USER_HEAP_LIN_ADDR(hMenu)))
1031 {
1032
1033 if (lpmi->fMask & MIM_BACKGROUND)
1034 menu->hbrBack = lpmi->hbrBack;
1035
1036 if (lpmi->fMask & MIM_HELPID)
1037 menu->dwContextHelpID = lpmi->dwContextHelpID;
1038
1039 if (lpmi->fMask & MIM_MAXHEIGHT)
1040 menu->cyMax = lpmi->cyMax;
1041
1042 if (lpmi->fMask & MIM_MENUDATA)
1043 menu->dwMenuData = lpmi->dwMenuData;
1044
1045 if (lpmi->fMask & MIM_STYLE)
1046 menu->dwStyle = lpmi->dwStyle;
1047
1048 return TRUE;
1049 }
1050 return FALSE;
1051}
1052#endif
1053
1054
Note: See TracBrowser for help on using the repository browser.