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

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

Fix: added memory leak warning!

File size: 32.0 KB
Line 
1/* $Id: winmenu.cpp,v 1.6 1999-09-23 17:36:16 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 /* @@@PH WARNING, memory leak! */
267 menuReturned = new Win32MenuRes(hMenuReturned);
268 return ((HMENU)menuReturned);
269}
270//******************************************************************************
271//******************************************************************************
272ODINFUNCTION2(HMENU, GetSystemMenu,
273 HWND, hSystemWindow,
274 BOOL, bRevert)
275{
276 Win32MenuRes *menuReturned;
277 HMENU hMenuReturned;
278 Win32BaseWindow *window;
279
280 window = Win32BaseWindow::GetWindowFromHandle(hSystemWindow);
281 if(!window)
282 {
283 dprintf(("GetSystemMenu, window %x not found", hSystemWindow));
284 return 0;
285 }
286
287 //hMenuReturned = window->GetSystemMenu();
288 hMenuReturned = O32_GetSystemMenu(hSystemWindow, bRevert);
289
290 /* @@@PH allocate Win32MenuRes object ! */
291 /* @@@PH WARNING, memory leak! */
292 menuReturned = new Win32MenuRes(hMenuReturned);
293 return ((HMENU)menuReturned);
294}
295//******************************************************************************
296//******************************************************************************
297ODINFUNCTION1(BOOL, IsMenu,
298 HMENU, hMenu)
299{
300 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
301
302 dprintf(("USER32: IsMenu\n"));
303 if(menu == NULL || menu->getOS2Handle() == 0)
304 {
305 SetLastError(ERROR_INVALID_PARAMETER);
306 return 0;
307 }
308 return O32_IsMenu(menu->getOS2Handle());
309}
310//******************************************************************************
311//******************************************************************************
312ODINFUNCTION7(BOOL, TrackPopupMenu,
313 HMENU, hMenu,
314 UINT, arg2,
315 int, arg3,
316 int, arg4,
317 int, arg5,
318 HWND, arg6,
319 const RECT *, arg7)
320{
321 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
322
323 dprintf(("USER32: TrackPopupMenu\n"));
324 if(menu == NULL || menu->getOS2Handle() == 0)
325 {
326 SetLastError(ERROR_INVALID_PARAMETER);
327 return 0;
328 }
329 return O32_TrackPopupMenu(menu->getOS2Handle(), arg2, arg3, arg4, arg5, arg6, arg7);
330}
331//******************************************************************************
332//******************************************************************************
333ODINFUNCTION6(BOOL, TrackPopupMenuEx,
334 HMENU, hMenu,
335 UINT, flags,
336 int, X,
337 int, Y,
338 HWND, hwnd,
339 LPTPMPARAMS, lpPM)
340{
341 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
342 RECT *rect = NULL;
343
344
345 dprintf(("USER32: TrackPopupMenuEx, not completely implemented\n"));
346 if(lpPM->cbSize != 0)
347 rect = &lpPM->rcExclude;
348
349 if(menu == NULL || menu->getOS2Handle() == 0)
350 {
351 SetLastError(ERROR_INVALID_PARAMETER);
352 return 0;
353 }
354 return O32_TrackPopupMenu(menu->getOS2Handle(), flags, X, Y, 0, hwnd, rect);
355}
356//******************************************************************************
357//******************************************************************************
358ODINFUNCTION4(BOOL, AppendMenuA,
359 HMENU, hMenu,
360 UINT, uFlags,
361 UINT, ulDNewItem,
362 LPCSTR, lpNewItem)
363{
364 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
365 BOOL rc;
366
367 dprintf(("USER32: OS2AppendMenuA uFlags = %X\n", uFlags));
368
369 if(uFlags & MF_STRING || uFlags == 0)
370 dprintf(("USER32: OS2AppendMenuA %s\n", lpNewItem));
371
372 if(menu == NULL || menu->getOS2Handle() == 0)
373 {
374 SetLastError(ERROR_INVALID_PARAMETER);
375 return 0;
376 }
377 rc = O32_AppendMenu(menu->getOS2Handle(), uFlags, ulDNewItem, lpNewItem);
378 dprintf(("USER32: OS2AppendMenuA returned %d\n", rc));
379 return rc;
380}
381//******************************************************************************
382//******************************************************************************
383ODINFUNCTION4(BOOL, AppendMenuW,
384 HMENU, hMenu,
385 UINT, arg2,
386 UINT, arg3,
387 LPCWSTR, arg4)
388{
389 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
390 BOOL rc;
391 char *astring = NULL;
392
393 dprintf(("USER32: OS2AppendMenuW\n"));
394
395 if(arg2 & MF_STRING && (int)arg4 >> 16 != 0)
396 astring = UnicodeToAsciiString((LPWSTR)arg4);
397 else
398 astring = (char *) arg4;
399
400 if(menu == NULL || menu->getOS2Handle() == 0)
401 {
402 SetLastError(ERROR_INVALID_PARAMETER);
403 return 0;
404 }
405 rc = O32_AppendMenu(menu->getOS2Handle(), arg2, arg3, astring);
406 if(arg2 & MF_STRING && (int)arg4 >> 16 != 0)
407 FreeAsciiString(astring);
408 return(rc);
409}
410//******************************************************************************
411//******************************************************************************
412ODINFUNCTION3(DWORD, CheckMenuItem,
413 HMENU, hMenu,
414 UINT, arg2,
415 UINT, arg3)
416{
417 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
418
419 dprintf(("USER32: OS2CheckMenuItem\n"));
420 if(menu == NULL || menu->getOS2Handle() == 0)
421 {
422 SetLastError(ERROR_INVALID_PARAMETER);
423 return 0;
424 }
425 return O32_CheckMenuItem(menu->getOS2Handle(), arg2, arg3);
426}
427//******************************************************************************
428//******************************************************************************
429ODINFUNCTION0(HMENU, CreateMenu)
430{
431 Win32MenuRes *menu = 0;
432 HMENU hMenu;
433
434 hMenu = O32_CreateMenu();
435 if(hMenu)
436 {
437 menu = new Win32MenuRes(hMenu);
438 if(menu == NULL)
439 return 0;
440 }
441
442 return (HMENU)menu;
443}
444//******************************************************************************
445//******************************************************************************
446ODINFUNCTION0(HMENU, CreatePopupMenu)
447{
448 Win32MenuRes *menu = 0;
449 HMENU hMenu;
450
451 hMenu = O32_CreatePopupMenu();
452 if(hMenu)
453 {
454 menu = new Win32MenuRes(hMenu);
455 if(menu == NULL)
456 return 0;
457 }
458
459 return (HMENU)menu;
460}
461//******************************************************************************
462//******************************************************************************
463ODINFUNCTION3(BOOL,EnableMenuItem,HMENU,hMenu,
464 UINT, uIDEnableItem,
465 UINT, uEnable)
466{
467 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
468
469 if(menu == NULL || menu->getOS2Handle() == 0)
470 {
471 SetLastError(ERROR_INVALID_PARAMETER);
472 return 0;
473 }
474
475 return O32_EnableMenuItem(menu->getOS2Handle(),
476 uIDEnableItem,
477 uEnable);
478}
479//******************************************************************************
480//******************************************************************************
481ODINFUNCTION5(BOOL, ModifyMenuA,
482 HMENU, hMenu,
483 UINT, arg2,
484 UINT, arg3,
485 UINT, arg4,
486 LPCSTR, arg5)
487{
488 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
489
490 dprintf(("USER32: OS2ModifyMenuA\n"));
491 if(menu == NULL || menu->getOS2Handle() == 0)
492 {
493 SetLastError(ERROR_INVALID_PARAMETER);
494 return 0;
495 }
496 return O32_ModifyMenu(menu->getOS2Handle(), arg2, arg3, arg4, arg5);
497}
498//******************************************************************************
499//******************************************************************************
500ODINFUNCTION5(BOOL, ModifyMenuW,
501 HMENU, hMenu,
502 UINT, arg2,
503 UINT, arg3,
504 UINT, arg4,
505 LPCWSTR, arg5)
506{
507 BOOL rc;
508 char *astring = NULL;
509 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
510
511 dprintf(("USER32: OS2ModifyMenuW %s\n", astring));
512
513 if(menu == NULL || menu->getOS2Handle() == 0)
514 {
515 SetLastError(ERROR_INVALID_PARAMETER);
516 return 0;
517 }
518
519 if(arg3 & MF_STRING && (int)arg5 >> 16 != 0)
520 astring = UnicodeToAsciiString((LPWSTR)arg5);
521 else
522 astring = (char *) arg5;
523
524 rc = O32_ModifyMenu(menu->getOS2Handle(), arg2, arg3, arg4, astring);
525 if(arg3 & MF_STRING && (int)arg5 >> 16 != 0)
526 FreeAsciiString(astring);
527 return(rc);
528}
529//******************************************************************************
530//******************************************************************************
531ODINFUNCTION3(BOOL, RemoveMenu,
532 HMENU, hMenu,
533 UINT, arg2,
534 UINT, arg3)
535{
536 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
537
538 dprintf(("USER32: OS2RemoveMenu\n"));
539 if(menu == NULL || menu->getOS2Handle() == 0)
540 {
541 SetLastError(ERROR_INVALID_PARAMETER);
542 return 0;
543 }
544
545 return O32_RemoveMenu(menu->getOS2Handle(), arg2, arg3);
546}
547//******************************************************************************
548//******************************************************************************
549ODINFUNCTION3(BOOL, DeleteMenu,
550 HMENU, hMenu,
551 UINT, arg2,
552 UINT, arg3)
553{
554 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
555
556 dprintf(("USER32: OS2DeleteMenu\n"));
557 if(menu == NULL || menu->getOS2Handle() == 0)
558 {
559 SetLastError(ERROR_INVALID_PARAMETER);
560 return 0;
561 }
562
563 return O32_DeleteMenu(menu->getOS2Handle(), arg2, arg3);
564}
565//******************************************************************************
566//******************************************************************************
567ODINFUNCTION4(BOOL, HiliteMenuItem,
568 HWND, hMenu,
569 HMENU, arg2,
570 UINT, arg3,
571 UINT, arg4)
572{
573 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
574
575 dprintf(("USER32: OS2HiliteMenuItem\n"));
576 if(menu == NULL || menu->getOS2Handle() == 0)
577 {
578 SetLastError(ERROR_INVALID_PARAMETER);
579 return 0;
580 }
581
582 return O32_HiliteMenuItem(menu->getOS2Handle(), arg2, arg3, arg4);
583}
584//******************************************************************************
585//******************************************************************************
586ODINFUNCTION5(BOOL, InsertMenuA,
587 HMENU, hMenu,
588 UINT, arg2,
589 UINT, arg3,
590 UINT, arg4,
591 LPCSTR, arg5)
592{
593 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
594
595 dprintf(("USER32: OS2InsertMenuA\n"));
596 if(menu == NULL || menu->getOS2Handle() == 0)
597 {
598 SetLastError(ERROR_INVALID_PARAMETER);
599 return 0;
600 }
601
602 return O32_InsertMenu(menu->getOS2Handle(), arg2, arg3, arg4, arg5);
603}
604//******************************************************************************
605//******************************************************************************
606ODINFUNCTION5(BOOL, InsertMenuW,
607 HMENU, hMenu,
608 UINT, arg2,
609 UINT, arg3,
610 UINT, arg4,
611 LPCWSTR, arg5)
612{
613 BOOL rc;
614 char *astring = NULL;
615 Win32MenuRes *menu = (Win32MenuRes *)hMenu;
616
617 dprintf(("USER32: OS2InsertMenuW %s\n", astring));
618 if(menu == NULL || menu->getOS2Handle() == 0)
619 {
620 SetLastError(ERROR_INVALID_PARAMETER);
621 return 0;
622 }
623 if(arg3 & MF_STRING && (int)arg5 >> 16 != 0)
624 astring = UnicodeToAsciiString((LPWSTR)arg5);
625 else
626 astring = (char *) arg5;
627
628 rc = O32_InsertMenu(menu->getOS2Handle(), arg2, arg3, arg4, astring);
629 if(arg3 & MF_STRING && (int)arg5 >> 16 != 0)
630 FreeAsciiString(astring);
631 return(rc);
632}
633//******************************************************************************
634//******************************************************************************
635ODINFUNCTION2(BOOL, SetMenuContextHelpId,
636 HMENU, hmenu,
637 DWORD, dwContextHelpId)
638{
639 dprintf(("USER32: OS2SetMenuContextHelpId, not implemented\n"));
640 return(TRUE);
641}
642//******************************************************************************
643//******************************************************************************
644ODINFUNCTION1(DWORD, GetMenuContextHelpId,
645 HMENU, hmenu)
646{
647 dprintf(("USER32: OS2GetMenuContextHelpId, not implemented\n"));
648 return(0);
649}
650//******************************************************************************
651//******************************************************************************
652ODINFUNCTION5(BOOL, CheckMenuRadioItem,
653 HMENU, hmenu,
654 UINT, idFirst,
655 UINT, idLast,
656 UINT, idCheck,
657 UINT, uFlags)
658{
659 dprintf(("USER32: OS2CheckMenuRadioItem, not implemented\n"));
660 return(TRUE);
661}
662//******************************************************************************
663//******************************************************************************
664ODINFUNCTION5(BOOL, ChangeMenuA,
665 HMENU, hMenu,
666 UINT, pos,
667 LPCSTR, data,
668 UINT, id,
669 UINT, flags)
670{
671 dprintf(("USER32: ChangeMenuA flags %X\n", flags));
672
673 if (flags & MF_APPEND) return AppendMenuA(hMenu, flags & ~MF_APPEND,
674 id, data );
675 if (flags & MF_DELETE) return DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
676 if (flags & MF_CHANGE) return ModifyMenuA(hMenu, pos, flags & ~MF_CHANGE,
677 id, data );
678 if (flags & MF_REMOVE) return RemoveMenu(hMenu,
679 flags & MF_BYPOSITION ? pos : id,
680 flags & ~MF_REMOVE );
681 /* Default: MF_INSERT */
682 return InsertMenuA( hMenu, pos, flags, id, data );
683}
684//******************************************************************************
685//******************************************************************************
686ODINFUNCTION5(BOOL, ChangeMenuW,
687 HMENU, hMenu,
688 UINT, pos,
689 LPCWSTR, data,
690 UINT, id,
691 UINT, flags)
692{
693 dprintf(("USER32: ChangeMenuW flags %X\n", flags));
694
695 if (flags & MF_APPEND) return AppendMenuW(hMenu, flags & ~MF_APPEND,
696 id, data );
697 if (flags & MF_DELETE) return DeleteMenu(hMenu, pos, flags & ~MF_DELETE);
698 if (flags & MF_CHANGE) return ModifyMenuW(hMenu, pos, flags & ~MF_CHANGE,
699 id, data );
700 if (flags & MF_REMOVE) return RemoveMenu(hMenu,
701 flags & MF_BYPOSITION ? pos : id,
702 flags & ~MF_REMOVE );
703 /* Default: MF_INSERT */
704 return InsertMenuW(hMenu, pos, flags, id, data);
705}
706//******************************************************************************
707//******************************************************************************
708ODINFUNCTION4(BOOL, SetMenuItemInfoA,
709 HMENU, hmenu,
710 UINT, par1,
711 BOOL, par2,
712 const MENUITEMINFOA *, lpMenuItemInfo)
713{
714 dprintf(("USER32: SetMenuItemInfoA, faked\n"));
715 return(TRUE);
716}
717/*****************************************************************************
718 * Function : SetMenuItemInfoW
719 * Purpose : The SetMenuItemInfo function changes information about a menu item.
720 * Parameters:
721 * Variables :
722 * Result : If the function succeeds, the return value is TRUE.
723 * If the function fails, the return value is FALSE. To get extended
724 * error information, use the GetLastError function.
725 * Remark :
726 * Status : UNTESTED STUB
727 *
728 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
729 *****************************************************************************/
730
731ODINFUNCTION4(BOOL, SetMenuItemInfoW,
732 HMENU, hMenu,
733 UINT, uItem,
734 BOOL, fByPosition,
735 const MENUITEMINFOW *, lpmmi)
736{
737 dprintf(("USER32:SetMenuItemInfoW (%08xh,%08xh,%08xh,%08x) not implemented.\n",
738 hMenu,
739 uItem,
740 fByPosition,
741 lpmmi));
742
743 return (SetMenuItemInfoA(hMenu,
744 uItem,
745 fByPosition,
746 (const MENUITEMINFOA *)lpmmi));
747}
748//******************************************************************************
749//******************************************************************************
750ODINFUNCTION3(BOOL, SetMenuDefaultItem,
751 HMENU, hmenu,
752 UINT, uItem,
753 UINT, fByPos)
754{
755 dprintf(("USER32: SetMenuDefaultItem, faked\n"));
756 return(TRUE);
757}
758//******************************************************************************
759//******************************************************************************
760ODINFUNCTION4(BOOL, GetMenuItemInfoA,
761 HMENU, hmenu,
762 UINT, uItem,
763 BOOL, aBool,
764 MENUITEMINFOA *, lpMenuItemInfo)
765{
766 dprintf(("USER32: GetMenuItemInfoA, faked\n"));
767 return(TRUE);
768}
769/*****************************************************************************
770 * Function : GetMenuDefaultItem
771 * Purpose : TheGetMenuDefaultItem function determines the default menu item
772 * on the specified menu.
773 * Parameters:
774 * Variables :
775 * Result : If the function succeeds, the return value is the identifier or
776 * position of the menu item.
777 * If the function fails, the return value is - 1.
778 * Remark :
779 * Status : UNTESTED STUB
780 *
781 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
782 *****************************************************************************/
783
784ODINFUNCTION3(UINT, GetMenuDefaultItem,
785 HMENU, hMenu,
786 UINT, fByPos,
787 UINT, gmdiFlags)
788{
789 dprintf(("USER32:GetMenuDefaultItem (%08xh,%u,%08x) not implemented.\n",
790 hMenu,
791 fByPos,
792 gmdiFlags));
793
794 return (-1);
795}
796
797
798/*****************************************************************************
799 * Function : GetMenuItemInfoW
800 * Purpose : The GetMenuItemInfo function retrieves information about a menu item.
801 * Parameters:
802 * Variables :
803 * Result : If the function succeeds, the return value is TRUE.
804 * If the function fails, the return value is FALSE. To get extended
805 * error information, use the GetLastError function.
806 * Remark :
807 * Status : UNTESTED STUB
808 *
809 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
810 *****************************************************************************/
811
812ODINFUNCTION4(BOOL, GetMenuItemInfoW,
813 HMENU, hMenu,
814 UINT, uItem,
815 BOOL, fByPosition,
816 MENUITEMINFOW *, lpmii)
817{
818 dprintf(("USER32:GetMenuItemInfoW (%08xh,%08xh,%u,%08x) not implemented.\n",
819 hMenu,
820 uItem,
821 fByPosition,
822 lpmii));
823
824 return(GetMenuItemInfoA(hMenu,
825 uItem,
826 fByPosition,
827 (MENUITEMINFOA *)lpmii));
828}
829
830
831/*****************************************************************************
832 * Function : GetMenuItemRect
833 * Purpose : The GetMenuItemRect function retrieves the bounding rectangle
834 * for the specified menu item.
835 * Parameters:
836 * Variables :
837 * Result : If the function succeeds, the return value is TRUE.
838 * If the function fails, the return value is FALSE. To get
839 * extended error information, use the GetLastError function.
840 * Remark :
841 * Status : UNTESTED STUB
842 *
843 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
844 *****************************************************************************/
845
846ODINFUNCTION4(BOOL, GetMenuItemRect,
847 HWND, hWnd,
848 HMENU, hMenu,
849 UINT, uItem,
850 LPRECT, lprcItem)
851{
852 dprintf(("USER32:GetMenuItemRect (%08xh,%08xh,%08xh,%08x) not implemented.\n",
853 hWnd,
854 hMenu,
855 uItem,
856 lprcItem));
857
858 return (FALSE);
859}
860/*****************************************************************************
861 * Function : InsertMenuItemA
862 * Purpose : The InsertMenuItem function inserts a new menu item at the specified
863 * position in a menu bar or pop-up menu.
864 * Parameters:
865 * Variables :
866 * Result : If the function succeeds, the return value is TRUE.
867 * If the function fails, the return value is FALSE. To get extended
868 * error information, use the GetLastError function.
869 * Remark :
870 * Status : UNTESTED STUB
871 *
872 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
873 *****************************************************************************/
874
875ODINFUNCTION4(BOOL, InsertMenuItemA,
876 HMENU, hMenu,
877 UINT, uItem,
878 BOOL, fByPosition,
879 const MENUITEMINFOA*, lpmii)
880{
881 dprintf(("USER32:InsertMenuItemA (%08xh,%08xh,%u,%08x) not implemented.\n",
882 hMenu,
883 uItem,
884 fByPosition,
885 lpmii));
886
887 return (FALSE);
888}
889
890
891/*****************************************************************************
892 * Function : InsertMenuItemW
893 * Purpose : The InsertMenuItem function inserts a new menu item at the specified
894 * position in a menu bar or pop-up menu.
895 * Parameters:
896 * Variables :
897 * Result : If the function succeeds, the return value is TRUE.
898 * If the function fails, the return value is FALSE. To get extended
899 * error information, use the GetLastError function.
900 * Remark :
901 * Status : UNTESTED STUB
902 *
903 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
904 *****************************************************************************/
905
906ODINFUNCTION4(BOOL, InsertMenuItemW,
907 HMENU, hMenu,
908 UINT, uItem,
909 BOOL, fByPosition,
910 const MENUITEMINFOW *, lpmii)
911{
912 dprintf(("USER32:InsertMenuItemW (%08xh,%08xh,%u,%08x) not implemented.\n",
913 hMenu,
914 uItem,
915 fByPosition,
916 lpmii));
917
918 return (FALSE);
919}
920/*****************************************************************************
921 * Function : MenuItemFromPoint
922 * Purpose : TheMenuItemFromPoint function determines which menu item, if
923 * any, is at the specified location.
924 * Parameters:
925 * Variables :
926 * Result : Returns the zero-based position of the menu item at the specified
927 * location or -1 if no menu item is at the specified location.
928 * Remark :
929 * Status : UNTESTED STUB
930 *
931 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
932 *****************************************************************************/
933
934ODINFUNCTION3(UINT, MenuItemFromPoint,
935 HWND, hWnd,
936 HMENU, hMenu,
937 POINT, ptScreen)
938{
939 dprintf(("USER32:MenuItemFromPoint (%08xh,%08xh,%u) not implemented.\n",
940 hWnd,
941 hMenu,
942 ptScreen));
943
944 return (-1);
945}
946
947
948/*****************************************************************************
949 * Function : GetMenuInfo
950 * Parameters:
951 * Variables :
952 * Result :
953 * Remark :
954 * Status : UNTESTED STUB win98/NT5.0
955 *
956 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
957 *****************************************************************************/
958
959ODINFUNCTION2(BOOL, GetMenuInfo,
960 HMENU, hMenu,
961 LPMENUINFO, lpmi)
962{
963 dprintf(("USER32: GetMenuInfo(%08xh,%08xh) not implemented.\n",
964 hMenu,
965 lpmi));
966
967 memset(lpmi,0,sizeof(MENUINFO));
968 return 0;
969}
970#if 0
971 POPUPMENU *menu;
972
973 TRACE("(0x%04x %p)\n", hMenu, lpmi);
974
975 if (lpmi && (menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu)))
976 {
977
978 if (lpmi->fMask & MIM_BACKGROUND)
979 lpmi->hbrBack = menu->hbrBack;
980
981 if (lpmi->fMask & MIM_HELPID)
982 lpmi->dwContextHelpID = menu->dwContextHelpID;
983
984 if (lpmi->fMask & MIM_MAXHEIGHT)
985 lpmi->cyMax = menu->cyMax;
986
987 if (lpmi->fMask & MIM_MENUDATA)
988 lpmi->dwMenuData = menu->dwMenuData;
989
990 if (lpmi->fMask & MIM_STYLE)
991 lpmi->dwStyle = menu->dwStyle;
992
993 return TRUE;
994 }
995 return FALSE;
996}
997#endif
998
999
1000/*****************************************************************************
1001 * Function : SetMenuInfo
1002 * Purpose :
1003 * Parameters:
1004 * Variables :
1005 * Result :
1006 * Remark :
1007 * FIXME
1008 * MIM_APPLYTOSUBMENUS
1009 * actually use the items to draw the menu
1010 * Status : UNTESTED STUB win98/NT5.0
1011 *
1012 * Author : Patrick Haller [Thu, 1998/02/26 11:55]
1013 *****************************************************************************/
1014
1015ODINFUNCTION2(BOOL, SetMenuInfo,
1016 HMENU, hMenu,
1017 LPCMENUINFO, lpmi)
1018{
1019 dprintf(("USER32: SetMenuInfo(%08xh,%08xh) not implemented.\n",
1020 hMenu,
1021 lpmi));
1022
1023 return 0;
1024}
1025#if 0
1026 POPUPMENU *menu;
1027
1028 TRACE("(0x%04x %p)\n", hMenu, lpmi);
1029
1030
1031
1032 if (lpmi && (lpmi->cbSize==sizeof(MENUINFO)) && (menu=(POPUPMENU*)USER_HEAP_LIN_ADDR(hMenu)))
1033 {
1034
1035 if (lpmi->fMask & MIM_BACKGROUND)
1036 menu->hbrBack = lpmi->hbrBack;
1037
1038 if (lpmi->fMask & MIM_HELPID)
1039 menu->dwContextHelpID = lpmi->dwContextHelpID;
1040
1041 if (lpmi->fMask & MIM_MAXHEIGHT)
1042 menu->cyMax = lpmi->cyMax;
1043
1044 if (lpmi->fMask & MIM_MENUDATA)
1045 menu->dwMenuData = lpmi->dwMenuData;
1046
1047 if (lpmi->fMask & MIM_STYLE)
1048 menu->dwStyle = lpmi->dwStyle;
1049
1050 return TRUE;
1051 }
1052 return FALSE;
1053}
1054#endif
1055
1056
Note: See TracBrowser for help on using the repository browser.