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

Last change on this file since 1010 was 985, checked in by sandervl, 26 years ago

Dialog fontsize & background fixes

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