You may return to the Cvo Object Documenation Index from this document. This document contains the following sections describing the Cvo_MenuItem structure:
Cvo_MenuItem
#include
<Cvo/Menu.h++>
struct
Cvo_MenuItem {
char *resource,
Cvo_MenuFunc func,
void *data,
int flags }
This structure is used to describe menu entries for other Cvo_Objects, such as the Cvo_Menu and Cvo_MenuEntry objects.
The resource element should point to a string containing the X resource name for this menu entry. This resource name will be used for the Cvo_MenuLabel object which will be displayed in the menu. There are several pre-defined resource names available, which may be used in the place of a pointer to a string containing a resource name. These pre-defined resource names are:CvoM_About
CvoM_Close
CvoM_Dismiss
CvoM_File
CvoM_Help
CvoM_New
CvoM_Open
CvoM_Quit
CvoM_Save
CvoM_SaveAs
CvoM_Version
If a non-pre-defined resource name is used (such as menuitem
), then
a corresponding resource of the following form should appear in the X
resources database: *Menu*menuitem.label: Menu Item
That resource value will be used by Cvo_MenuLabel, which recognizes a special format for label text, in order to set quick keys and accelerators for menu entries. Please see the documentation for Cvo_MenuLabel for an explanation of this special format.
The func argument should be an event handler function of the form
void func(Cvo_Object *, XEvent *, void *)
. The data element will
be passed to the event handler function. This event handler will be
sent the CvoMenuEvent
event when necessary, indicating that this
menu item has been selected.
The flags element may contain zero or more pre-defined flags ORed together. The possible flags are:
CvoM_ALWAYSFLAT
CvoM_CASCADE
CvoM_SEPARATOR
CvoM_TOGGLE
The CvoM_ALWAYSFLAT
flag will cause the entry to appear flattened
at all times. If a handler function is not provided for this
particular entry, then this flag can be used to make a label or title
menu entry.
CvoM_CASCADE
flag indicates that this entry should bring up a
cascade menu. This will be indicated by a small arrow to the right
side of the entry. The data element of the structure should point
to a NULL
terminated array of Cvo_MenuItem structures. This array
describes the cascade Cvo_Menu which will be displayed.
The CvoM_SEPARATOR
flag indicates that there should be a
NO_SUCH_ALIAS drawn above this menu entry. If the resource
element of the structure is NULL
, then a NO_SUCH_ALIAS will be
drawn whether or not this flag is given.
The CvoM_TOGGLE
indicates the the entry should be a toggle button.
A toggle will be drawn to the left of the entry label, and will be
toggled up/down when selected.
See the example source code for an example of how to use this structure.
See the legend for information about the conventions used in this documentation.