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

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

Fix: GetSubMenu now returns Win32MenuRes object instead of a PM handle

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