PullDown

Table of Contents

## NAME

XfwfPullDown

## DESCRIPTION

A PullDown button looks like a normal button, but when it is clicked or pressed, a menu drops down. The menu can be spec ified in two ways: as a string or as a widget. If a string is given, it must be in the correct syntax for the Xfwf TextMenu widget and a widget will be created automatically. If a widget is given instead, it must be a widget that is able to pop up: in other words: a Shell widget or a subclass of Shell.

The most likely application of this widget is as a menu in a menu bar. A menu bar can be created, e.g., with a RowCol widget and a number of PullDown buttons.

When the popup is passed in as a string in the menu resource, the widget will call the activate callback (see XfwfButton) when the user exits the menu with a valid selec tion. It will also call the changeSelection callback (see below) when the user moves from one menu item to the next. Neither of these callbacks will be called when the popup is passed in as a ready-made widget in the popup resource.

Note however, that the call_data argument of the activate callback will contain the number of the selected item (0, 1, 2, etc.) and not the event, as is the case in an XfwfButton widget.

Public variables
______________________________________________________________

|
  XfwfPullDown

| Name
  | Class | Type | Default

| XtNpopup
  | XtCPopup | Widget | NULL

| XtNmenu
  | XtCMenu | String | NULL

| XtNcascaded
  | XtCCascaded | Boolean | False

| XtNhotkey
  | XtCHotkey | String | NULL | XtNmenuCursor | XtCMenuCursor | Cursor | "arrow"

| XtNprepare
  | XtCPrepare | Callback| NULL | XtNchangeSelection| XtCChangeSelection| Callback| NULL

|
  | | | |___________________|____________________|__________|_________

XtNpopup
Two resources determine the menu. The popup resource can be pointed at the widget that should pop up when the button is pressed, but when the popup resource is NULL, the menu will be created from the menu resource. If the popup resource is set, it must be set to a widget that is (a subclass of) a Shell widget.

XtNmenu
When popup is NULL, the widget will be created from the textual description in menu. For the syntax of this string, see the XfwfTextMenu.

XtNcascaded
When the button is part of a dialog or menu, that has already caused a grab of the pointer, the resource cas caded should be True. If the button is inserted into an XfwfMenuBar, the resource is set to True automatically.

XtNhotkey
The pull down button installs an event handler that catches all keyboard events for the whole application and checks for a special key combination. If that key is detected, the menu will be popped up. Thus, the menu can be used even if the keyboard focus is some where else. The hotkey resource is usually a string such as "Alt<Key>a", or "Ctrl<Key>f".

When the hotkey resource is used, any accelerators will be ignored.

XtNmenuCursor
The cursor shape that is used in the menu can be set with the menuCursor resource. By default it is an arrow pointing to the upper right.

XtNprepare
The prepare callback is invoked by the prepare action, normally just before the menu is popped up.

XtNchangeSelection
When the user moves from one item to another in the menu that was created from the menu resource, the changeSelection callback is called, with the number of the new selection as call_data. This callback is called even when the new selection is an inactive (grayed out) item. It is also called when the mouse leaves the menu, in which case the argument will be -1. This callback will notbe called when the menu is a ready-made widget, passed in via the popup resource.

XtNframeWidth
Since the most likely place for this type of button will be in a menubar, the default frame width is reset to zero.

XtNshrinkToFit
The shrinkToFit resource is set to a new default of True.

________________________________________________

|
  XfwfButton

| Name
  | Class | Type | Default | XtNactivate| XtCActivate| Callback| NULL | XtNenter | XtCEnter | Callback| NULL | XtNleave | XtCLeave | Callback| NULL | | | | |____________|_____________|__________|_________

_______________________________________________________________________ | XfwfLabel | Name | Class | Type | Default | XtNlabel | XtCLabel | String | NULL | XtNtablist | XtCTablist | String | NULL | XtNfont | XtCFont | FontStruct| XtDefaultFont | XtNforeground | XtCForeground | Pixel | XtDefaultForeground | XtNhlForeground| XtCHlForeground| Pixel | XtDefaultForeground | XtNalignment | XtCAlignment | Alignment | 0 | XtNtopMargin | XtCTopMargin | Dimension | 2 | XtNbottomMargin| XtCBottomMargin| Dimension | 2 | XtNleftMargin | XtCLeftMargin | Dimension | 2 | XtNrightMargin | XtCRightMargin | Dimension | 2 | XtNshrinkToFit | XtCShrinkToFit | Boolean | False | XtNrvStart | XtCRvStart | Int | 0 | XtNrvLength | XtCRvLength | Int | 0 | XtNhlStart | XtCHlStart | Int | 0 | XtNhlLength | XtCHlLength | Int | 0 | | | | |________________|_________________|____________|______________________

_____________________________________________________

|
  XfwfBoard

| Name
  | Class | Type | Default

| XtNabs_x
  | XtCAbs_x | Position | 0

| XtNrel_x
  | XtCRel_x | Float | "0.0"

| XtNabs_y
  | XtCAbs_y | Position | 0

| XtNrel_y
  | XtCRel_y | Float | "0.0" | XtNabs_width | XtCAbs_width | Position | 0 | XtNrel_width | XtCRel_width | Float | "1.0" | XtNabs_height| XtCAbs_height| Position | 0 | XtNrel_height| XtCRel_height| Float | "1.0"

| XtNhunit
  | XtCHunit | Float | "1.0"

| XtNvunit
  | XtCVunit | Float | "1.0" | XtNlocation | XtCLocation | String | NULL | | | | |______________|_______________|___________|_________

________________________________________________________________________________________ XfwfFrame
Name Class Type Default XtNcursor XtCCursor Cursor None XtNframeType XtCFrameType FrameType XfwfRaised XtNframeWidth XtCFrameWidth Dimension 0 XtNouterOffset XtCOuterOffset Dimension 0 XtNinnerOffset XtCInnerOffset Dimension 0 XtNshadowScheme XtCShadowScheme ShadowScheme XfwfAuto XtNtopShadowColor XtCTopShadowColor Pixel compute_topcolor XtNbottomShadowColor XtCBottomShadowColor Pixel compute_bottomcolor XtNtopShadowStipple XtCTopShadowStipple Bitmap NULL XtNbottomShadowStipple XtCBottomShadowStipple Bitmap NULL

________________________________________________________________________________________

|
  | | | |_______________________|________________________|_______________|__________________

|
  | XfwfCommon | | |

| Name
  || Class | |Type | De|fault |

|
  XtNtraversalOn || XtCTraversalOn | |Boolean | Tr|ue | | XtNhighlightThickness|| XtCHighlightThickness| |Dimension | 2 | | | XtNhighlightColor || XtCHighlightColor | |Pixel | Xt|DefaultForeground | | XtNhighlightPixmap || XtCHighlightPixmap | |Pixmap | No|ne |

|
  XtNnextTop || XtCNextTop | |Callback | NU|LL |

|
  XtNuserData || XtCUserData | |Pointer | NU|LL |

|
  || | | | | | |______________________||______________________|_|__________|____|_________________| | | | | | ________________|________________________|_______________|___ | | | Composite | | | | | Name || Class | Typ|e | Defa|ult| | | XtNchildren || XtCChildren | Wid|getList | NULL| | | | insertPosition|| XtCInsertPosition| XTO|rderProc | NULL| | | | numChildren || XtCNumChildren | Car|dinal | 0 | | | | || | | | | | | |_______________||__________________|_____|________|______|__| | | | | | ____________________|________________________|_______________|________ | | | Core | | | | | Name | |Class | T|ype | |Default| | | XtNx | |XtCX | P|osition | |0 | | | XtNy | |XtCY | P|osition | |0 | | | XtNwidth | |XtCWidth | D|imension | |0 | | | XtNheight | |XtCHeight | D|imension | |0 | | | borderWidth | |XtCBorderWidth | D|imension | |0 | | | XtNcolormap | |XtCColormap | C|olormap | |NULL | | | XtNdepth | |XtCDepth | I|nt | |0 | | | destroyCallback | |XtCDestroyCallback | X|TCallbackList | |NULL | | | XtNsensitive | |XtCSensitive | B|oolean | |True | | | XtNtm | |XtCTm | X|TTMRec | |NULL | | | ancestorSensitive| |XtCAncestorSensitive| B|oolean | |False | | | accelerators | |XtCAccelerators | X|TTranslations | |NULL | | | borderColor | |XtCBorderColor | P|ixel | |0 | | borderPixmap | |XtCBorderPixmap | P|ixmap | |NULL

| background
  | XtCBackground | Pixel | 0 | backgroundPixmap | XtCBackgroundPixmap | Pixmap | NULL | mappedWhenManaged| XtCMappedWhenManaged| Boolean | True

| XtNscreen
  | XtCScreen | Screen * | NULL | | | | |__________________|______________________|_________________|_________

Translations
<Btn1Down>: prepare() open_menu()

Button1<Enter>: prepare() open_menu() enter() <Key>Return: prepare() open_menu()

<Btn1Up>: popdown_maybe()

<EnterNotify>: enter()

<LeaveNotify>: leave()

prepare

The prepare action just calls the prepare callback functions, passing the XEvent pointer in the call_data argument.

open_menu

The open_menu action computes the coordinates of the menu, such that it will appear directly below the but ton. A local grab is added, so that the button itself will continu to receive events, even after the popped up menu has grabbed the pointer and keyboard. The accelerators of the menu are installed in the pulldown button, which will continue to have the focus. It then pops up the menu.

popdown_maybe

The podown_maybe action only pops down the menu when the pointer is outside the button. When the pointer is on the button, the menu stays posted.

Table of Contents

- NAME
- DESCRIPTION