VkPopupMenu(3x)VkPopupMenu(3x)NAMEVkPopupMenu - A Popup menu class
INHERITS FROM
VkMenu : VkMenuItem : VkComponent : VkCallbackObject
HEADER FILE
#include <Vk/VkPopupMenu.h>
PUBLIC PROTOCOL SUMMARY
Constructor/Destructor
VkPopupMenu(VkMenuDesc *desc,
XtPointer defaultClientData = NULL);
VkPopupMenu(const char *name = "popupMenu",
VkMenuDesc *desc = NULL,
XtPointer defaultClientData = NULL);
VkPopupMenu(Widget parent,
VkMenuDesc *desc,
XtPointer defaultClientData = NULL);
VkPopupMenu(Widget parent,
const char *name = "popupMenu",
VkMenuDesc *desc = NULL,
XtPointer defaultClientData = NULL);
~VkPopupMenu();
Displaying Menus"
virtual void build(Widget p);
virtual void attach(Widget p);
virtual void show();
virtual void show(XEvent *buttonPressEvent);
Access Functions"
virtual VkMenuItemType menuType();
virtual const char* className();
CLASS DESCRIPTIONVkPopupMenu supports popup menus based on ViewKit menu objects.
VkPopupMenu provides the same interface as other subclasses of VkMenu.
See VkMenu for a description of how to add items to a menu. A popup menu
can be built as a child of any widget, and popped up by calling show()
with an X event pointer, or a popup menu can be "attached" to one or more
widgets, so that it pops up automatically when the user presses mouse
button 3 over that widget.
Page 1
VkPopupMenu(3x)VkPopupMenu(3x)FUNCTION DESCRIPTIONSVkPopupMenu
VkPopupMenu(VkMenuDesc *desc,
XtPointer defaultClientData = NULL);
VkPopupMenu(const char *name = "popupMenu",
VkMenuDesc *desc = NULL,
XtPointer defaultClientData = NULL);
VkPopupMenu(Widget parent,
VkMenuDesc *desc,
XtPointer defaultClientData = NULL);
VkPopupMenu(Widget parent,
const char *name = "popupMenu",
VkMenuDesc *desc = NULL,
XtPointer defaultClientData = NULL);
The VkPopupMenu constructor initializes a VkPopup object. If one of
the forms that takes a widget is used, the menu is automatically
attached to the given widget. (See attach(), below.) For schemes to
work appropriately, popup menus should be named "poupMenu". If no
name is specified in a constructor, this default name will be used.
All forms of the constructor support a defaultClientData argument
which can be used to supply a clientData argument for use with menu
items added to the pane whose callbacks do not specify clientData.
This allows menus to be specified statically, while still allowing
an instance pointer to be used with callbacks. For example, the
following code segment creates a popup menu. All callbacks
associated with the menu will be passed the instance pointer of the
object that creates the popup menu object.
class Sample: public VkWindow {
private:
static void oneCallback( Widget,
XtPointer ,
XtPointer);
static void twoCallback( Widget,
XtPointer ,
XtPointer);
static VkMenuDesc popupDescription[];
protected:
public:
Sample( const char *name) : VkWindow( name)
Page 2
VkPopupMenu(3x)VkPopupMenu(3x)
// Other members
};
SampleWindow::SampleWindow(char *name) :
VkWindow(name)
{
VkPopupMenu *popup;
Widget w = XmCreateForm(parent, "form",
NULL, 0);
popup = new VkPopupMenu(w,
popupDescription,
(XtPointer) this);
// Other actions
}
~VkPopupMenu()
~VkPopupMenu();
The VkPopupMenu destructor removes all callbacks from all attached
widgets. Base class destructors free the widgets used by the menu.
build()
virtual void build(Widget p);
Builds the widgets in a VkPopupMenu object. If build() is used,
popping up the menu is the callers responsibility.
attach()
virtual void attach(Widget p);
The first call to attach creates all widgets in the popup menu,
using the given widget as the parent of the menu. An event handler
is added so that the menu automatically is posted by a button three
press over the given parent. Subsequent calls to attach add the
ability to post the menu over other widgets.
show()
virtual void show();
virtual void show(XEvent *buttonPressEvent);
When called with an X ButtonPress Event, show() posts a menu, using
the event to position the menu under the mouse cursor. This function
supports application that wish to control the posting of menus
directly. Normally, attach() provides an easier way to use menus.
Page 3
VkPopupMenu(3x)VkPopupMenu(3x)
With no arguments, show simply manages the popup menu at it's
current location. This use is not recommended.
menuType()
virtual VkMenuItemType menuType();
The menu type of this class is POPUP.
className()
virtual const char* className();
The class name of this class is "VkPopupMenu".
INHERITED MEMBER FUNCTIONS
Inherited from VkMenu
isContainer(), VkMenu(), VkMenu(), VkMenu(), VkMenu(),
findParent(), ~VkMenu(), addAction(), addAction(),
addActionWidget(), addActionWidget(), addConfirmFirstAction(),
addSeparator(), addLabel(), addToggle(), addToggle(), add(),
addSubmenu(), addSubmenu(), addSubmenu(), addRadioSubmenu(),
addRadioSubmenu(), addRadioSubmenu(), registerSubmenu(),
findNamedItem(), removeItem(), activateItem(), deactivateItem(),
replace(), getItemPosition(), getItemPosition(),
getItemPosition(), operator[](), numItems(), _contents, _nItems,
_maxItems,
Inherited from VkMenuItem
hide(), VkMenuItem(), VkMenuItem(), manageAll(), ~VkMenuItem(),
setLabel(), setPosition(), activate(), deactivate(), remove(),
show(), _position, _isBuilt, _sensitive, _parentMenu, _label,
_isHidden, _unmanagedWidgets, _numUnmanagedWidgets,
Inherited from VkComponent
installDestroyHandler(), removeDestroyHandler(), widgetDestroyed(),
setDefaultResources(), getResources(), manage(), unmanage(),
baseWidget(), okToQuit(), _name, _baseWidget, _w, deleteCallback
Inherited from VkCallbackObject
callCallbacks(), addCallback(), removeCallback(),
removeAllCallbacks()CLASSES USED BY THIS CLASS
VkMenuItem
Page 4
VkPopupMenu(3x)VkPopupMenu(3x)KNOWN CLASSES THAT USE THIS CLASS
VkGraph
SEE ALSO
VkMenu, VkMenuItem, VkComponent, VkGraph, VkMenuItem
ViewKit Programmer's Guide
The X Window System, DEC Press, Bob Sheifler and Jim Gettys
The X Window System Toolkit, DEC Press, Paul Asente and Ralph Swick
The OSF/Motif Programmers Reference, Prentice Hall, OSF
Page 5