X11 Work Bench Toolkit  1.0
menu_popup.h
1 
2 // _ //
3 // _ __ ___ ___ _ __ _ _ _ __ ___ _ __ _ _ _ __ | |__ //
4 // | '_ ` _ \ / _ \| '_ \ | | | | | '_ \ / _ \ | '_ \ | | | || '_ \ | '_ \ //
5 // | | | | | || __/| | | || |_| | | |_) || (_) || |_) || |_| || |_) |_| | | | //
6 // |_| |_| |_| \___||_| |_| \__,_|_____ | .__/ \___/ | .__/ \__,_|| .__/(_)_| |_| //
7 // |_____||_| |_| |_| //
8 // //
9 // generic popup menu implementation //
10 // //
12 
13 /*****************************************************************************
14 
15  X11workbench - X11 programmer's 'work bench' application and toolkit
16  Copyright (c) 2010-2016 by Bob Frazier (aka 'Big Bad Bombastic Bob')
17  all rights reserved
18 
19  DISCLAIMER: The X11workbench application and toolkit software are supplied
20  'as-is', with no warranties, either implied or explicit.
21  Any claims to alleged functionality or features should be
22  considered 'preliminary', and might not function as advertised.
23 
24  BSD-like license:
25 
26  There is no restriction as to what you can do with this software, so long
27  as you include the above copyright notice and DISCLAIMER for any distributed
28  work that is equal to or derived from this one, along with this paragraph
29  that explains the terms of the license if the source is also being made
30  available. A "derived work" describes a work that uses a significant portion
31  of the source files or algorithms that are included with this one.
32  Specifically excluded from this are files that were generated by the software,
33  or anything that is included with the software that is part of another package
34  (such as files that were created or added during the 'configure' process).
35  Specifically included is the use of part or all of any of the X11 workbench
36  toolkit source or header files in your distributed application. If you do not
37  ship the source, the above copyright statement is still required to be placed
38  in a reasonably prominent place, such as documentation, splash screens, and/or
39  'about the application' dialog boxes.
40 
41  Use and distribution are in accordance with GPL, LGPL, and/or the above
42  BSD-like license. See COPYING and README files for more information.
43 
44 
45  Additional information at http://sourceforge.net/projects/X11workbench
46 
47 ******************************************************************************/
48 
61 #ifndef MENU_POPUP_H_INCLUDED
62 #define MENU_POPUP_H_INCLUDED
63 
64 #include "menu_bar.h"
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif // __cplusplus
69 
70 
71 #define MENU_POPUP_WINDOW_TAG (*((const unsigned int *)"MWMP"))
72 
108 typedef struct __WBMenuPopupWindow__
109 {
110  unsigned int ulTag;
111  Window wSelf;
112  Window wBar;
113  Window wOwner;
114 
116 
117  int iX;
118  int iY;
119  int iWidth;
120  int iHeight;
121 
122  int iColumns;
123  int iVisible;
124  int iTop;
125  int iSelected;
126  int iFlags;
127 
129 
130 
148 WBMenuPopupWindow *MBCreateMenuPopupWindow(Window wIDBar, Window wIDOwner, WBMenu *pMenu,
149  int iX, int iY, int iFlags);
150  // pass 'iX and 'iY' for the menu's origin location. 'pMenu' points to the popup menu and
151  // it must contain a list of popup menus that it makes use of.
152 
164 int MBMenuDoModal(WBMenuPopupWindow *pMenuPopupWindow);
165 
176 void MBDestroyMenuPopupWindow(WBMenuPopupWindow *pMenuPopupWindow);
177 
188 WBMenuPopupWindow *MBFindMenuPopupWindow(WBMenu *pSubMenu); // find first (active) window that uses sub-menu 'pMenu'
189 
190 
201 static __inline__ WBMenuPopupWindow *MBGetMenuPopupWindowStruct(Window wID)
202 {
203  WBMenuPopupWindow *pRval = (WBMenuPopupWindow *)WBGetWindowData(wID, 0); // offset 0 for window-specific structs
204 
205  if(pRval && pRval->ulTag == MENU_POPUP_WINDOW_TAG)
206  return(pRval);
207 
208  return(NULL);
209 }
210 
211 
212 #ifdef __cplusplus
213 };
214 #endif // __cplusplus
215 
216 
217 #endif // MENU_POPUP_H_INCLUDED
218