home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _66bb0fc91611360247dff7e535e7a9f2 < prev    next >
Encoding:
Text File  |  2004-06-01  |  8.4 KB  |  250 lines

  1. #  Copyright (c) 1990-1994 The Regents of the University of California.
  2. #  Copyright (c) 1994-1997 Sun Microsystems, Inc.
  3. #  See the file "license.terms" for information on usage and redistribution
  4. #  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  5. #
  6. #
  7.  
  8. =head1 NAME
  9.  
  10. Tk::Menubutton - Create and manipulate Menubutton widgets
  11.  
  12. =for category  Tk Widget Classes
  13.  
  14. =head1 SYNOPSIS
  15.  
  16. I<$menubutton> = I<$parent>-E<gt>B<Menubutton>(?I<options>?);
  17.  
  18. =head1 STANDARD OPTIONS
  19.  
  20. B<-activebackground>    B<-cursor>    B<-highlightthickness>    B<-takefocus>
  21. B<-activeforeground>    B<-disabledforeground>    B<-image>    B<-text>
  22. B<-anchor>    B<-font>    B<-justify>    B<-textvariable>
  23. B<-background>    B<-foreground>    B<-padx>    B<-underline>
  24. B<-bitmap>    B<-highlightbackground>    B<-pady>    B<-wraplength>
  25. B<-borderwidth>    B<-highlightcolor>    B<-relief>
  26.  
  27. See L<Tk::options> for details of the standard options.
  28.  
  29. =head1 WIDGET-SPECIFIC OPTIONS
  30.  
  31. =over 4
  32.  
  33. =item Command-Line Name: B<-compound>
  34.  
  35. =item Database Name:  B<compound>
  36.  
  37. =item Database Class: B<Compound>
  38.  
  39. Specifies whether the button should display both an image and text,
  40. and if so, where the image should be placed relative to the text.
  41. Valid values for this option are B<bottom>, B<center>, B<left>,
  42. B<none>, B<right> and B<top>.  The default value is B<none>, meaning
  43. that the button will display either an image or text, depending on the
  44. values of the -image and -bitmap options.
  45.  
  46. =item Name:    B<direction>
  47.  
  48. =item Class:    B<Height>
  49.  
  50. =item Switch:    B<-direction>
  51.  
  52. Specifies where the menu is going to be popup up. B<above> tries to
  53. pop the menu above the menubutton. B<below> tries to pop the menu
  54. below the menubutton. B<left> tries to pop the menu to the left of
  55. the menubutton. B<right> tries to pop the menu to the right of the
  56. menu button. B<flush> pops the menu directly over the menubutton.
  57.  
  58. =item Name:    B<height>
  59.  
  60. =item Class:    B<Height>
  61.  
  62. =item Switch:    B<-height>
  63.  
  64. Specifies a desired height for the menubutton.
  65. If an image or bitmap is being displayed in the menubutton then the value is in
  66. screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
  67. for text it is in lines of text.
  68. If this option isn't specified, the menubutton's desired height is computed
  69. from the size of the image or bitmap or text being displayed in it.
  70.  
  71. =item Name:    B<indicatorOn>
  72.  
  73. =item Class:    B<IndicatorOn>
  74.  
  75. =item Switch:    B<-indicatoron>
  76.  
  77. The value must be a proper boolean value.  If it is true then
  78. a small indicator rectangle will be displayed on the right side
  79. of the menubutton and the default menu bindings will treat this
  80. as an option menubutton.  If false then no indicator will be
  81. displayed.
  82.  
  83. =item Name:    B<menu>
  84.  
  85. =item Class:    B<MenuName>
  86.  
  87. =item Switch:    B<-menu>
  88.  
  89. Specifies the path name of the menu associated with this menubutton.
  90. The menu must be a child of the menubutton.
  91.  
  92. =item Name:    B<state>
  93.  
  94. =item Class:    B<State>
  95.  
  96. =item Switch:    B<-state>
  97.  
  98. Specifies one of three states for the menubutton:  B<normal>, B<active>,
  99. or B<disabled>.  In normal state the menubutton is displayed using the
  100. B<foreground> and B<background> options.  The active state is
  101. typically used when the pointer is over the menubutton.  In active state
  102. the menubutton is displayed using the B<activeForeground> and
  103. B<activeBackground> options.  Disabled state means that the menubutton
  104. should be insensitive:  the default bindings will refuse to activate
  105. the widget and will ignore mouse button presses.
  106. In this state the B<disabledForeground> and
  107. B<background> options determine how the button is displayed.
  108.  
  109. =item Name:    B<width>
  110.  
  111. =item Class:    B<Width>
  112.  
  113. =item Switch:    B<-width>
  114.  
  115. Specifies a desired width for the menubutton.
  116. If an image or bitmap is being displayed in the menubutton then the value is in
  117. screen units (i.e. any of the forms acceptable to B<Tk_GetPixels>);
  118. for text it is in characters.
  119. If this option isn't specified, the menubutton's desired width is computed
  120. from the size of the image or bitmap or text being displayed in it.
  121.  
  122. =back
  123.  
  124. =head1 DESCRIPTION
  125.  
  126. The B<Menubutton> method creates a new window (given by the
  127. $widget argument) and makes it into a menubutton widget.
  128. Additional
  129. options, described above, may be specified on the command line
  130. or in the option database
  131. to configure aspects of the menubutton such as its colors, font,
  132. text, and initial relief.  The B<menubutton> command returns its
  133. $widget argument.  At the time this command is invoked,
  134. there must not exist a window named $widget, but
  135. $widget's parent must exist.
  136.  
  137. A menubutton is a widget that displays a textual string, bitmap, or image
  138. and is associated with a menu widget.
  139. If text is displayed, it must all be in a single font, but it
  140. can occupy multiple lines on the screen (if it contains newlines
  141. or if wrapping occurs because of the B<wrapLength> option) and
  142. one of the characters may optionally be underlined using the
  143. B<underline> option.  In normal usage, pressing
  144. mouse button 1 over the menubutton causes the associated menu to
  145. be posted just underneath the menubutton.  If the mouse is moved over
  146. the menu before releasing the mouse button, the button release
  147. causes the underlying menu entry to be invoked.  When the button
  148. is released, the menu is unposted.
  149.  
  150. Menubuttons are typically organized into groups called menu bars
  151. that allow scanning:
  152. if the mouse button is pressed over one menubutton (causing it
  153. to post its menu) and the mouse is moved over another menubutton
  154. in the same menu bar without releasing the mouse button, then the
  155. menu of the first menubutton is unposted and the menu of the
  156. new menubutton is posted instead.
  157.  
  158. There are several interactions between menubuttons and menus;  see
  159. the B<menu> manual entry for information on various menu configurations,
  160. such as pulldown menus and option menus.
  161.  
  162. =head1 WIDGET METHODS
  163.  
  164. The B<Menubutton> method creates a widget object.
  165. This object supports the B<configure> and B<cget> methods
  166. described in L<Tk::options> which can be used to enquire and
  167. modify the options described above.
  168. The B<menu> method returns the menu associated with the widget.
  169. The widget also inherits all the methods provided by the generic
  170. L<Tk::Widget|Tk::Widget> class.
  171.  
  172. =head1 DEFAULT BINDINGS
  173.  
  174. Tk automatically creates class bindings for menubuttons that give them
  175. the following default behavior:
  176.  
  177. =over 4
  178.  
  179. =item [1]
  180.  
  181. A menubutton activates whenever the mouse passes over it and deactivates
  182. whenever the mouse leaves it.
  183.  
  184. =item [2]
  185.  
  186. Pressing mouse button 1 over a menubutton posts the menubutton:
  187. its relief changes to raised and its associated menu is posted
  188. under the menubutton.  If the mouse is dragged down into the menu
  189. with the button still down, and if the mouse button is then
  190. released over an entry in the menu, the menubutton is unposted
  191. and the menu entry is invoked.
  192.  
  193. =item [3]
  194.  
  195. If button 1 is pressed over a menubutton and then released over that
  196. menubutton, the menubutton stays posted: you can still move the mouse
  197. over the menu and click button 1 on an entry to invoke it.
  198. Once a menu entry has been invoked, the menubutton unposts itself.
  199.  
  200. =item [4]
  201.  
  202. If button 1 is pressed over a menubutton and then dragged over some
  203. other menubutton, the original menubutton unposts itself and the
  204. new menubutton posts.
  205.  
  206. =item [5]
  207.  
  208. If button 1 is pressed over a menubutton and released outside
  209. any menubutton or menu, the menubutton unposts without invoking
  210. any menu entry.
  211.  
  212. =item [6]
  213.  
  214. When a menubutton is posted, its associated menu claims the input
  215. focus to allow keyboard traversal of the menu and its submenus.
  216. See the B<menu> documentation for details on these bindings.
  217.  
  218. =item [7]
  219.  
  220. If the B<underline> option has been specified for a menubutton
  221. then keyboard traversal may be used to post the menubutton:
  222. Alt+I<x>, where I<x> is the underlined character (or its
  223. lower-case or upper-case equivalent), may be typed in any window
  224. under the menubutton's toplevel to post the menubutton.
  225.  
  226. =item [8]
  227.  
  228. The F10 key may be typed in any window to post the first menubutton
  229. under its toplevel window that isn't disabled.
  230.  
  231. =item [9]
  232.  
  233. If a menubutton has the input focus, the space and return keys
  234. post the menubutton.
  235.  
  236. If the menubutton's state is B<disabled> then none of the above
  237. actions occur:  the menubutton is completely non-responsive.
  238.  
  239. The behavior of menubuttons can be changed by defining new bindings for
  240. individual widgets or by redefining the class bindings.
  241.  
  242. =back
  243.  
  244. =head1 KEYWORDS
  245.  
  246. menubutton, widget
  247.  
  248. =cut
  249.  
  250.