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