ShellWids

[ XITE Reference Manual | XITE home ]

Contents


Name

InitializeVisual, RequestedImageVisualAndColormap, CreateAppShell, CreateTopLevelShell, CreatePopTopShell, CreatePopupShell, CreatePopOver, AddAction, TopLevelWidget, PopupInit, PopupAdd, Popup_add, PopupLine, PopupMenu, PopupExit, PopupWidget, ImageFromMenu - XITE shell widgets.

Syntax

 #include <xite/ShellWids.h>

 void InitializeVisual( Display* dpy,
    int screen, char* imageVisualClass );

 void RequestedImageVisualAndColormap(
    Display* dpy, int screen, int* planes,
    Visual** visual, Colormap* colormap );

 Widget CreatePopTopShell( char* name,
    Widget parent );

 Widget CreatePopupShell( char* name,
    Widget parent );

 Widget CreateTopLevelShell( Display* dpy,
    char* name );

 Widget CreatePopOverShell( char *name,
    Widget parent );

 Widget CreateAppShell( Display* dpy,
    char* app_name, char* app_class );

 Widget PopupInit( char* name, Widget parent,
    char* label );

 Widget PopupAdd( char* name, Widget parent,
    char* label, XtCallbackProc callback_func,
    int arg );

 Widget Popup_add( char *name, Widget parent,
    char *label, XtCallbackProc callback_func,
    XtPointer arg );

 Widget PopupLine( char* name, Widget parent );

 void PopupMenu( Widget wid, XEvent* event,
    String* params, Cardinal* num_params );

 void PopupExit( Widget wid, XEvent* event,
    String* params, Cardinal* num_params );

 Widget PopupWidget( void  );

 Widget ImageFromMenu( Widget wid );

 Widget TopLevelWidget( Widget wid );

 void AddAction( Widget parent, char* name,
    XtActionProc func, int popup );

Overview

The functions in this module all deal with shell widgets. They make sure that the necessary information is present prior to creating a shell widget. Some of them deal specifically with popup menus.

Description

InitializeVisual initializes XITE X11 applications in terms of information about the visuals which screen on dpy is capable of supporting and the XITE-initial colormaps for these visuals. imageVisualClass is the requested/preferred visual for the application. Refer to InitialVisualInfos(3) for information about visuals and the possible values of the imageVisualClass argument. Refer to GetImageColormap(3) for information about the colormaps.

RequestedImageVisualAndColormap works with the registered globally preferred visual (and its depth and colormaps). It returns the visual via visual, unless visual is NULL or *visual is non-NULL. In these two cases, don't change *visual.

The depth is returned via planes, unless planes is NULL or *planes != 0. In the latter case, don't change *planes. In this case, depth will be 7 for 8-plane PseudoColor and 21 for 24-plane PseudoColor (reduced-color display).

The colormap is returned via colormap.

If no globally preferred visual is registered, then call InitializeVisual first.

RequestedImageVisualAndColormap calls RequestedImageVisual and GetImageColormap to get its work done.

The shell creation functions make sure that all the information about preferred/requested visuals (class and depth) and colormaps has been collected for image-related widgets as well as for textual widgets. If necessary, this is done by a call to InitializeVisual.

The shell creation functions create and return a widget of class applicationShellWidgetClass (CreateAppShell), topLevelShellWidgetClass (CreateTopLevelShell and CreatePopTopShell), transientShellWidgetClass (CreatePopupShell) or overrideShellWidgetClass (CreatePopOverShell). They get visual class, depth and colormap from the default visual, depth and colormap.

CreateAppShell uses app_class and app_name for class and instance names respectively. The other shell widget creation functions use name as instance name. They all set the resource XtNallowShellResize (allow application to resize itself). CreatePopOverShell, CreatePopTopShell and CreatePopupShell also set the resource XtNinput (window manager handles keyboard focus).

CreatePopOverShell is typically used for non-permanent menus.

PopupInit initializes a popup menu (class simpleMenuWidgetClass) and returns a reference to it. The instance name is given by name (used in resource specifications). The visible label is given by label if non-NULL, otherwise by name. This string appears at the top of the menu.

PopupAdd adds a menu entry (class smeBSBObjectClass) to the menu widget given by parent. The instance name of this new menu entry is name, the label is label, and callback_func is added as a callback function if it is not NULL (to the XtNcallback resource). Space is allocated for a copy of the parameter arg. This (or actually a reference to the copy) arrives in the callback routine as client_data.

Popup_add is very similar to PopupAdd, but a reference to any chunk of information can be passed along in arg. This reference arrives as the client_data argument in callback_func. It is the responsibility of callback_func to interpret the reference correctly.

PopupLine adds a menu line separator (class smeLineObjectClass) to the menu widget given by parent.

PopupMenu is an action function which actually pops up a menu. It calls XawPositionSimpleMenu and then the X Toolkit Intrinsics action function MenuPopup. PopupMenu is typically registered as an action function of an application and called with the help of a translation table. This is the case for all applications which use the function ximageInit from the ximage(3) toolkit.

PopupExit is also registered as an action function of an application and called with the help of a translation table. It does NOT call the X Toolkit Intrinsics function MenuPopdown (which should be invoked prior to PopupExit by the translation table). Currently PopupExit is empty.

PopupWidget returns an Image, ImageOverlay or AsciiText widget associated with a popup menu. The menu may have been popped up in this widget or in an XfwfPullDown button in a menubar above an Image or ImageOverlay widget. In this case, the Image or ImageOverlay widget is returned.

ImageFromMenu returns Image or ImageOverlay widget associated with wid. wid is either an Image or ImageOverlay widget in which a menu is popped up or an XfwfPullDown button child of an XfwfMenuBar sibling of an Image or ImageOverlay widget.

TopLevelWidget returns a reference to the Shell widget ancestor of wid.

AddAction adds an action function to the application to which wid belongs. name is the name of the aaction function and can be used in translation tables. func is the action function. popup should be non-zero if the func involves popping up a menu.

Return value

Reference to Image, ImageOverlay or AsciiText widget.

See also

Visual(3), Cmap(3), Image(3), ImageOverlay(3), ximage(3), visualFromName(3)

Author

Otto Milvang and Svein Bøe

Doc

Svein Bøe