Mercurial > dwindows
comparison os2/dw.c @ 1305:18a31ab94e3d
Added DW_MENU_AUTO and DW_MENU_POPUP flags that can be passed to dw_menu_append_item() in the id field.
On OS/2 and Windows AUTO will automatically allocate a menu ID from the larger static pool of IDs.
POPUP will automatically allocate an ID from the smaller pool for transient popup menus.
These flags don't do anything on the other platforms since they don't require menu IDs.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 03 Nov 2011 10:09:11 +0000 |
parents | 68f18dccfb8f |
children | dbd507f42947 |
comparison
equal
deleted
inserted
replaced
1304:68f18dccfb8f | 1305:18a31ab94e3d |
---|---|
4698 miSubMenu.afAttribute |= MIA_CHECKED; | 4698 miSubMenu.afAttribute |= MIA_CHECKED; |
4699 is_disabled = (flags & DW_MIS_DISABLED) ? 1 : 0; | 4699 is_disabled = (flags & DW_MIS_DISABLED) ? 1 : 0; |
4700 if ( is_disabled ) | 4700 if ( is_disabled ) |
4701 miSubMenu.afAttribute |= MIA_DISABLED; | 4701 miSubMenu.afAttribute |= MIA_DISABLED; |
4702 | 4702 |
4703 if ( strlen( title ) == 0 ) | 4703 if (title && *title) |
4704 { | |
4705 /* Code to autogenerate a menu ID if not specified or invalid | |
4706 * First pool is smaller for transient popup menus | |
4707 */ | |
4708 if(id == (ULONG)-1) | |
4709 { | |
4710 static ULONG tempid = 61000; | |
4711 | |
4712 tempid++; | |
4713 id = tempid; | |
4714 | |
4715 if(tempid > 65500) | |
4716 tempid = 61000; | |
4717 } | |
4718 /* Second pool is larger for more static windows */ | |
4719 else if(!id || id >= 30000) | |
4720 { | |
4721 static ULONG menuid = 30000; | |
4722 | |
4723 menuid++; | |
4724 id = menuid; | |
4725 | |
4726 if(menuid > 60000) | |
4727 menuid = 30000; | |
4728 } | |
4729 miSubMenu.afStyle = MIS_TEXT; | |
4730 } | |
4731 else | |
4704 miSubMenu.afStyle = MIS_SEPARATOR; | 4732 miSubMenu.afStyle = MIS_SEPARATOR; |
4705 else | |
4706 miSubMenu.afStyle = MIS_TEXT; | |
4707 miSubMenu.id=id; | 4733 miSubMenu.id=id; |
4708 miSubMenu.hwndSubMenu = submenu; | 4734 miSubMenu.hwndSubMenu = submenu; |
4709 miSubMenu.hItem=NULLHANDLE; | 4735 miSubMenu.hItem=NULLHANDLE; |
4710 | 4736 |
4711 WinSendMsg(menux, MM_INSERTITEM, MPFROMP(&miSubMenu), MPFROMP(title)); | 4737 WinSendMsg(menux, MM_INSERTITEM, MPFROMP(&miSubMenu), MPFROMP(title)); |