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

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

Fix: WINMENU::GetSystemMenu() was broken.

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