1 | /* $Id: oslibmenu.cpp,v 1.2 1999-09-24 12:47:50 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Window Menu wrapper functions for OS/2
|
---|
4 | *
|
---|
5 | *
|
---|
6 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
10 | *
|
---|
11 | */
|
---|
12 | #define INCL_WIN
|
---|
13 | #define INCL_PM
|
---|
14 | #include <os2.h>
|
---|
15 | #include <os2wrap.h>
|
---|
16 | #include <stdlib.h>
|
---|
17 | #include <string.h>
|
---|
18 |
|
---|
19 | #include <misc.h>
|
---|
20 | #include <winconst.h>
|
---|
21 | #include "oslibwin.h"
|
---|
22 | #include "oslibutil.h"
|
---|
23 | #include "oslibmenu.h"
|
---|
24 |
|
---|
25 | //******************************************************************************
|
---|
26 | //******************************************************************************
|
---|
27 | HWND OSLibWinSetMenu(HWND hwndParent, HMENU hMenu)
|
---|
28 | {
|
---|
29 | // Remove current menu from window
|
---|
30 | HWND currMenu = WinWindowFromID( (HWND)hwndParent, FID_MENU );
|
---|
31 | if (currMenu)
|
---|
32 | {
|
---|
33 | WinSetOwner (currMenu, HWND_OBJECT);
|
---|
34 | WinSetParent(currMenu, HWND_OBJECT, FALSE);
|
---|
35 | }
|
---|
36 |
|
---|
37 | if (hMenu)
|
---|
38 | {
|
---|
39 | if(WinIsWindow(GetThreadHAB(), hMenu) == TRUE) {
|
---|
40 | WinSetOwner (hMenu, hwndParent);
|
---|
41 | WinSetParent(hMenu, hwndParent, FALSE );
|
---|
42 | WinSetWindowUShort(hMenu, QWS_ID, FID_MENU);
|
---|
43 | WinSendMsg(hwndParent, WM_UPDATEFRAME, (MPARAM)FCF_MENU, 0);
|
---|
44 | return hMenu;
|
---|
45 | }
|
---|
46 | }
|
---|
47 | return 0;
|
---|
48 | }
|
---|
49 | //******************************************************************************
|
---|
50 | //******************************************************************************
|
---|
51 | int OSLibGetMenuItemCount(HWND hMenu)
|
---|
52 | {
|
---|
53 | return (int)SHORT1FROMMR(WinSendMsg(hMenu, MM_QUERYITEMCOUNT, NULL, NULL));
|
---|
54 | }
|
---|
55 | //******************************************************************************
|
---|
56 | //******************************************************************************
|
---|