home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / Xaw / MenuButton < prev    next >
Encoding:
Text File  |  1991-07-29  |  6.1 KB  |  209 lines

  1. .NH 2
  2. MenuButton Widget
  3. .XS
  4.     MenuButton Widget
  5. .XE
  6. .IN "MenuButton widget" "" "@DEF@"
  7. .sp
  8. .Ds 0
  9. .TA 2.0i
  10. .ta 2.0i
  11. Application Header file    <X11/Xaw/MenuButton.h>
  12. .IN "MenuButton.h" ""
  13. Class Header file    <X11/Xaw/MenuButtonP.h>
  14. .IN "MenuButtonP.h" ""
  15. Class        menuButtonWidgetClass
  16. .IN "menuButtonWidgetClass" ""
  17. Class Name    MenuButton
  18. .IN "MenuButton widget" "class name"
  19. Superclass    Command
  20. .De
  21. .LP
  22. .sp
  23. The MenuButton widget is an area, often rectangular, that contains a
  24. text label or bitmap image.  When the pointer cursor is on the button,
  25. the button becomes highlighted by drawing a rectangle around its
  26. perimeter.  This highlighting indicates that the button is ready for
  27. selection.  When a pointer button is pressed, the MenuButton widget will
  28. pop up the menu that has been named in the \fBmenuName\fP resource.
  29. .NH 3
  30. Resources
  31. .LP
  32. When creating a MenuButton widget instance, 
  33. the following resources are retrieved from the argument list
  34. or from the resource database:
  35. .LP
  36. .IN "MenuButton widget" "resources"
  37. .ps 9
  38. .nr PS 9
  39. .vs 11
  40. .nr VS 11
  41. .TS H
  42. expand;
  43. lw(1i) lw(1i) lw(1i) lw(.5i) lw(2i).
  44. _
  45. .sp 3p
  46. .TB
  47. Name    Class    Type    Notes    Default Value
  48. .sp 3p
  49. _
  50. .TH
  51. .R
  52. .sp 3p
  53. accelerators    Accelerators    AcceleratorTable        NULL
  54. ancestorSensitive    AncestorSensitive    Boolean    D    True
  55. background    Background    Pixel        XtDefaultBackground
  56. backgroundPixmap    Pixmap    Pixmap        XtUnspecifiedPixmap
  57. bitmap    Bitmap    Pixmap        None
  58. borderColor    BorderColor    Pixel        XtDefaultForeground
  59. borderPixmap    Pixmap    Pixmap        XtUnspecifiedPixmap
  60. borderWidth    BorderWidth    Dimension        1
  61. callback    Callback    XtCallbackList        NULL
  62. colormap    Colormap    Colormap        Parent's Colormap
  63. cornerRoundPercent    CornerRoundPercent    Dimension        25
  64. cursor    Cursor    Cursor        None
  65. cursorName    Cursor    String        None
  66. depth    Depth    int    C    Parent's Depth
  67. destroyCallback    Callback    XtCallbackList        NULL
  68. encoding    Encoding    UnsignedChar        XawTextEncoding8bit
  69. font    Font    XFontStruct        XtDefaultFont
  70. foreground    Foreground    Pixel        XtDefaultForeground
  71. height    Height    Dimension    A    Font height + 2 * \fBinternalHeight\fP
  72. highlightThickness    Thickness    Dimension    A    2 (0 if Shaped)
  73. insensitiveBorder    Insensitive    Pixmap        GreyPixmap
  74. internalHeight    Height    Dimension        2
  75. internalWidth    Width    Dimension        4
  76. justify    Justify    Justify        XtJustifyCenter (center)
  77. label    Label    String        name of widget
  78. leftBitmap    LeftBitmap    Bitmap        None
  79. mappedWhenManaged    MappedWhenManaged    Boolean        True
  80. menuName    MenuName    String        "menu"
  81. pointerColor    Foreground    Pixel        XtDefaultForeground
  82. pointerColorBackground    Background    Pixel        XtDefaultBackground
  83. resize    Resize    Boolean        True
  84. screen    Screen    Screen    R    Parent's Screen
  85. sensitive    Sensitive    Boolean        True
  86. shapeStype    ShapeStyle    ShapeStyle        Rectangle
  87. translations    Translations    TranslationTable        See below
  88. width    Width    Dimension    A    \fBlabel\fP width + 2 * \fBinternalWidth\fP
  89. x    Position    Position        0
  90. y    Position    Position        0
  91. .sp 3p
  92. _
  93. .TE
  94. .ps 11
  95. .nr PS 11
  96. .vs 13
  97. .nr VS 13
  98. .Ac
  99. .As
  100. .Bg
  101. .Gp
  102. .Bm
  103. .Bc
  104. .Bp
  105. .Bw
  106. .Cb
  107. .Cm
  108. .Cr
  109. .Cu
  110. .Pn
  111. .De
  112. .Dc
  113. .Lf
  114. .Lg
  115. .Hw
  116. .Ht
  117. .Ib
  118. .Ih
  119. .Ju
  120. .La
  121. .Mm
  122. .IP \fBmenuName\fP 1.5i
  123. The name of a popup shell to popup as a menu.  The MenuButton
  124. will search for this name using \fBXtNameToWidget\fP starting with itself
  125. as the reference widget.  If it is unsuccessful it will continue up the widget
  126. tree using each of its ancestors as the reference widget.  If it is still
  127. unsuccessful it will print a warning message and give up.  When the
  128. menu is found it will be popped up exclusive and spring_loaded.
  129. The MenuButton widget does not copy the value of this resource into newly
  130. allocated memory. The application programmer must pass the resource value
  131. in nonvolatile memory.
  132. .Pf
  133. .Pb
  134. .Re
  135. .Sc
  136. .Se
  137. .Ss
  138. .Tr
  139. .Xy
  140. .NH 3
  141. MenuButton Actions
  142. .IN "MenuButton widget" "actions"
  143. .LP
  144. The MenuButton widget supports the following actions:
  145. .IP \(bu 5
  146. Switching the button between the foreground and background
  147. colors with \fBset\fP and \fBunset\fP
  148. .IP \(bu 5
  149. Processing application callbacks with \fBnotify\fP
  150. .IP \(bu 5
  151. Switching the internal border between highlighted
  152. and unhighlighted states with \fBhighlight\fP and \fBunhighlight\fP
  153. .IP \(bu 5
  154. Popping up a menu with \fBPopupMenu\fP
  155. .LE
  156. .LP
  157. The following are the default translation bindings used by the
  158. MenuButton widget: 
  159. .LP
  160. .sp
  161. .Ds 0
  162. .TA .5i 2.25i
  163. .ta .5i 2.25i
  164.     <EnterWindow>:    highlight(\|)
  165.     <LeaveWindow>:    reset(\|)
  166.     <BtnDown>:    reset(\|) PopupMenu(\)
  167. .De
  168. .NH 3
  169. MenuButton Actions
  170. .LP
  171. The full list of actions supported by MenuButton is:
  172. .IP \fBhighlight\fP(\fIcondition\fP) 1.5i
  173. Displays the internal highlight border in the color (\fBforeground\fP
  174. or \fBbackground\fP ) that contrasts with the interior color of the
  175. Command widget.  The conditions \fBWhenUnset\fP and \fBAlways\fP are
  176. understood by this action procedure.  If no argument is passed,
  177. \fBWhenUnset\fP is assumed.
  178. .IP \fBunhighlight\fP(\|) 1.5i
  179. Displays the internal highlight border in the color (\fBXtNforeground\fP
  180. or \fBbackground\fP ) that matches the interior color of the
  181. MenuButton widget.  
  182. .IP \fBset\fP(\|) 1.5i
  183. Enters the \fIset\fP state, in which \fBnotify\fP is possible.  This
  184. action causes the button to display its interior in the
  185. \fBforeground\fP color.  The label or bitmap is displayed in the
  186. \fBbackground\fP color. 
  187. .IP \fBunset\fP(\|) 1.5i
  188. Cancels the \fIset\fP state and displays the interior of the button in the
  189. \fBbackground\fP color.  The label or bitmap is displayed in the
  190. \fBforeground\fP color.
  191. .IP \fBreset\fP(\|) 1.5i
  192. Cancels any \fBset\fP or \fBhighlight\fP and displays the interior of the
  193. button in the \fBbackground\fP color, with the label displayed in the 
  194. \fBforeground\fP color.
  195. .IP \fBnotify\fP(\|) 1.5i
  196. When the button is in the \fBset\fP state this action calls all functions in
  197. the callback list named by the \fBcallback\fP resource.  The value of
  198. the call_data argument in these callback functions is undefined. 
  199. .IP \fBPopupMenu\fP(\|) 1.5i
  200. Pops up the menu specified by the \fBmenuName\fP resource.
  201. .LP
  202. The MenuButton widget does not place a server grab on itself.
  203. Instead, PopupMenu is registered as a grab action.
  204. As a result, clients which popup menus without using XtMenuPopup
  205. or MenuPopup or PopupMenu in translations will fail to have a grab active.
  206. They should make a call to XtRegisterGrabAction on the appropriate action
  207. in the application initialization routine, or use a different translation.
  208. .bp
  209.