2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: WXmMenu.cc /main/3 1996/06/11 17:03:45 cde-hal $ */
30 #include <WWL/WXmMenu.h>
33 // The class WXmPopupMenu encapsulates a standard Motif popup menu.
35 WXmPopupMenu::WXmPopupMenu (WComposite& father, char* name, ArgList args,
37 : WXmRowColumn (XmCreatePopupMenu (Widget(father), name, args, card))
41 WXmLabelGadget label(widget, "title");
42 label.LabelString(name);
47 WXmPopupMenu::WXmPopupMenu (WComposite& father, char* name, WArgList args)
48 : WXmRowColumn (XmCreatePopupMenu (Widget(father), name, args.Args(),
53 WXmLabelGadget label(widget, "title");
54 label.LabelString(name);
59 WXmPopupMenu::WXmPopupMenu (WComposite& father, char* name, int automanage,
61 : WXmRowColumn (XmCreatePopupMenu (Widget(father), name, args.Args(),
67 WXmLabelGadget label(widget, "title");
68 label.LabelString(name);
75 Adds a push button to the popup menu and associates a callback function
76 to this button if the \var{proc} is not NULL. An arglist can be passed
77 to initialize some resources.
80 WXmPopupMenu :: AddPushButton (char* name, XtCallbackProc proc, caddr_t closure, ArgList args, Cardinal card)
82 WXmPushButtonGadget pb(widget, name, args, card);
85 pb.AddActivateCallback(proc, closure);
92 Adds a push button to the popup menu and associates a callback method
93 to this button. The method is called with the object \var{wwl}. An
94 arglist can be passed to initialize some resources.
97 WXmPopupMenu :: AddPushButton (char* name, WWL* wwl, WWL_FUN fun, ArgList args, Cardinal card)
99 WXmPushButtonGadget pb(widget, name, args, card);
101 pb.SetActivateCallback(wwl, fun);
106 /*?class WXmPulldownMenu
108 The class \typ{WXmPulldownMenu} encapsulates a standard Motif pulldown menu.
113 Adds a push button to the pulldown menu and associates a callback function
114 to this button if the \var{proc} is not NULL. An arglist can be passed
115 to initialize some resources.
118 WXmPulldownMenu :: AddPushButton (char* name, XtCallbackProc proc, caddr_t closure, ArgList args, Cardinal card)
120 WXmPushButtonGadget pb(widget, name, args, card);
123 pb.AddActivateCallback(proc, closure);
130 Adds a push button to the pulldown menu and associates a callback method
131 to this button. The method is called with the object \var{wwl}. An
132 arglist can be passed to initialize some resources.
135 WXmPulldownMenu :: AddPushButton (char* name, WWL* wwl, WWL_FUN fun, ArgList args, Cardinal card)
137 WXmPushButtonGadget pb(widget, name, args, card);
139 pb.SetActivateCallback(wwl, fun);
144 /*?class WXmOptionMenu
146 The class \typ{WXmOptionMenu} encapsulates a standard Motif option menu.
149 WXmOptionMenu :: WXmOptionMenu(
152 : WXmRowColumn (XmCreateOptionMenu(Widget(father), name, NULL, 0))
154 WXmPulldownMenu pd(father, name); // create the pulldown
155 SubMenuId(pd); // Set the subMenuId to the new pulldown
160 WXmOptionMenu :: AddPulldownMenu (
163 { // 15mar92 need to add pulldown to option menu
164 WXmPulldownMenu pd(parent, name); // create the pulldown
165 SubMenuId(pd); // Set the subMenuId to the new pulldown
167 } // Add a pulldown to the option menu
171 Adds a push button to the option menu and associates a callback function
172 to this button if the \var{proc} is not NULL. An arglist can be passed
173 to initialize some resources.
176 WXmOptionMenu :: AddPushButton (
182 { // 15mar92 modified to add PushButton to pulldown of option menu
183 WXmPushButtonGadget pb(SubMenuId(), name, args, card);
186 pb.AddActivateCallback(proc, closure);
194 Adds a push button to the option menu and associates a callback method
195 to this button. The method is called with the object \var{wwl}. An
196 arglist can be passed to initialize some resources.
199 WXmOptionMenu :: AddPushButton (
205 { // 15mar92 modified to add PushButton to pulldown of option menu
207 WXmPushButtonGadget pb(SubMenuId(), name, args, card);
209 pb.SetActivateCallback(wwl, fun);
215 Returns the cascade button gadget associated with the option menu.
217 WXmCascadeButtonGadget
218 WXmOptionMenu :: OptionButtonGadget ()
220 WXmCascadeButtonGadget cb(XmOptionButtonGadget(widget));
226 Returns the label gadget associated with the option menu.
229 WXmOptionMenu :: OptionLabelGadget ()
231 WXmLabelGadget cb(XmOptionLabelGadget(widget));
238 This class encapsulates a standard menu bar.
243 Adds a cascade button to the menu bar. A mnemonic character can also
247 WXmMenuBar :: AddCascadeButton (char* name, char mnemonic)
249 WXmCascadeButton cb(widget, name);
251 cb.Mnemonic(mnemonic);
258 Add a cascade menu to the menu bar.
261 WXmMenuBar :: AddCascadeMenu (char* name, char mnemonic, WXmPulldownMenu& menu)