VkWindow(3x)
VkWindow - Base class for all top-level windows with menus
As shipped in IRIX 6.5.5. Last changed in IRIX 6.5.5.
NAME VkWindow - Base class for all top-level windows with menus INHERITS FROM VkSimpleWindow : VkComponent : VkCallbackObject HEADER FILE #include <Vk/VkWindow.h> PUBLIC PROTOCOL SUMMARY Constructor/Destructor VkWindow(const char *name, ArgList args = NULL, Cardinal argCount = 0); virtual ~VkWindow(); Constructor - ViewKit 2.1 only VkWindow(const char *name, VkScreen *screen, ArgList args = NULL, Cardinal argCount = 0); Adding menus void setMenuBar(VkMenuBar *menuObj); void setMenuBar(VkMenuDesc *menudesc); void setMenuBar(VkMenuDesc *menudesc, XtPointer clientData); VkSubMenu *addMenuPane(const char *name); VkSubMenu *addMenuPane(const char *name, VkMenuDesc *desc); VkRadioSubMenu *addRadioMenuPane(const char *name); VkRadioSubMenu *addRadioMenuPane(const char *name, VkMenuDesc *desc); Access Functions virtual VkMenuBar *menu() const; virtual const char *className(); static VkMenuBar *getMenu(VkComponent *object); static VkWindow *getWindow(VkComponent *component); CLASS DESCRIPTION The VkWindow class exhibits similar behavior as VkSimpleWindow except that it provides additional support for a menubar, based on the VkMenuBar class and related VkMenuItem classes. Menus can be added from outside the class, using the public protocol, but it is generally recommended that menus be added by derived classes to maintain encapsulation of all operations associated with a window. The VkWindow class automatically causes a help menu pane to be added to all menu bars. Deriving Subclasses Class can be derived in much the same way as classes derived from VkSimpleWindow. Views can be added by either calling addView in the constructor or by defining a setUpInterface() member function. Menus may also be added either in the constructor, or in the setUpInterface() member function, depending on whether or not there is an advantage to delaying menu creation until the window is shown. The cost of creating menus in advance is small, since the widgets associated with a hierarchy of VkMenuItems is never built until the menu is displayed. The following example adds a menu pane named "Application" to a window's menubar. The pane supports a single action, which exits the application. #include <Vk/VkApp.h> #include <Vk/VkSimpleWindow.h> #include <Vk/VkRadioBox.h> #include <Vk/VkSubMenu.h> class SampleWindow: public VkSimpleWindow { private: static void quitCallback(Widget, XtPointer, XtPointer); public: SampleWindow ( const char *name ) : VkSimpleWindow ( name ) { VkRadioBox *rb = new VkRadioBox("check", mainWindowWidget()); rb->addItem("one"); rb->addItem("two"); rb->addItem("three"); rb->addItem("four"); addView(rb); // Add a menu pane VkSubMenu *pane = addMenuPane("Application"); pane->addAction("Quit", &SampleWindow::quitCallback, (XtPointer) this); } // Destructor, className() functions not provided }; FUNCTION DESCRIPTIONS VkWindow VkWindow(const char *name, ArgList argList = NULL, Cardinal argCount = 0); The VkWindow constructor simply initializes internal data members and calls the VkSimpleWindow constructor. VkWindow - ViewKit 2.1 only VkWindow(const char *name, VkScreen *screen, ArgList argList = NULL, Cardinal argCount = 0); Creates an instance of VkWindow on the specified VkScreen. ~VkWindow virtual ~VkWindow(); Destroys all memory allocated by this class. If this object has an of instance of VkMenuBar installed, it is destroyed as well, regardless of who created it. setMenuBar void setMenuBar(VkMenuBar *menuObj); void setMenuBar(VkMenuDesc *menudesc); This function installs a VkMenuBar object as the window's menubar. The menubar may be specified as an instance of VkMenuBar, or provided as a description of a menu hierarchy. See VkMenuBar(3X). addMenuPane VkSubMenu *addMenuPane(const char *name); VkSubMenu *addMenuPane(const char *name, VkMenuDesc *desc); This function adds a named menu pane to the window's menu bar An optional menu description of the contents may be supplied. If no menu bar is currently installed, one is created automatically. addRadioMenuPane VkRadioSubMenu *addRadioMenuPane(const char *name); VkRadioSubMenu *addRadioMenuPane(const char *name, VkMenuDesc *desc); This function adds a menu pane that supports toggle items and has radio behavior. An optional menu description of the contents may be supplied. If no menu bar is currently installed, one is created automatically. menu() virtual VkMenuBar *menu() const; Returns a pointer to a VkWindow object's menu instance. getMenu() static VkMenuBar *getMenu(VkComponent *object); This static member function returns the menubar used by the window that contains the given VkComponent. This allows components to add items to menubars of windows in which they are placed, without a hard coded connection between the window and the component. getWindow() static VkSimpleWindow *getWindow(VkComponent *component); Returns the VkWindow object (or subclass) that contains the given VkComponent. This allows components to operate on the window in which they are contained, without a hard coded connection between the window and the component. className virtual const char* className(); This class's class name is "VkWindow". EXAMPLES INHERITED MEMBER FUNCTIONS Inherited from VkSimpleWindow afterRealizeHook(), show(), hide(), *(), setUpWindowProperties(), stateChanged(), handleWmDeleteMessage(), handleRawEvent(), VkSimpleWindow(), ~VkSimpleWindow(), addView(), addView(), removeView(), open(), raise(), lower(), iconize(), iconify(), getTitle(), setTitle(), setIconName(), setClassHint(), iconic(), visible(), mainWindowWidget(), viewWidget(), _iconState, _visibleState, _stackingState, _mainWindowWidget, Inherited from VkComponent installDestroyHandler(), removeDestroyHandler(), widgetDestroyed(), setDefaultResources(), getResources(), realize(), manage(), unmanage(), name(), baseWidget(), okToQuit(), isComponent(), _name, _baseWidget, _w, deleteCallback Inherited from VkCallbackObject callCallbacks(), addCallback(), removeCallback(), removeAllCallbacks() KNOWN DERIVED CLASSES VkMsgWindow CLASSES USED BY THIS CLASS VkMenu, VkMenuBar, VkMenuItem KNOWN CLASSES THAT USE THIS CLASS VkGraph SEE ALSO VkSimpleWindow, VkComponent, VkCallbackObject, VkGraph, VkMenu, VkMenuBar, 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