You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.2KB

  1. //
  2. // "$Id: Fl_Menu_Button.H 8016 2010-12-12 11:19:12Z manolo $"
  3. //
  4. // Menu button header file for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2010 by Bill Spitzak and others.
  7. //
  8. // This library is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU Library General Public
  10. // License as published by the Free Software Foundation; either
  11. // version 2 of the License, or (at your option) any later version.
  12. //
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. // Library General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Library General Public
  19. // License along with this library; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. // USA.
  22. //
  23. // Please report all bugs and problems on the following page:
  24. //
  25. // http://www.fltk.org/str.php
  26. //
  27. /* \file
  28. Fl_Menu_Button widget . */
  29. #ifndef Fl_Menu_Button_H
  30. #define Fl_Menu_Button_H
  31. #include "Fl_Menu_.H"
  32. /**
  33. This is a button that when pushed pops up a menu (or hierarchy of
  34. menus) defined by an array of
  35. Fl_Menu_Item objects.
  36. <P ALIGN=CENTER>\image html menu_button.png</P>
  37. \image latex menu_button.png " menu_button" width=5cm
  38. <P>Normally any mouse button will pop up a menu and it is lined up
  39. below the button as shown in the picture. However an Fl_Menu_Button
  40. may also control a pop-up menu. This is done by setting the type().
  41. If type() is zero a normal menu button is produced.
  42. If it is nonzero then this is a pop-up menu. The bits in type() indicate
  43. what mouse buttons pop up the menu (see Fl_Menu_Button::popup_buttons). </P>
  44. <P>The menu will also pop up in response to shortcuts indicated by
  45. putting a '&' character in the label(). </P>
  46. <P>Typing the shortcut() of any of the menu items will cause
  47. callbacks exactly the same as when you pick the item with the mouse.
  48. The '&' character in menu item names are only looked at when the menu is
  49. popped up, however. </P>
  50. <P>When the user picks an item off the menu, the item's callback is
  51. done with the menu_button as the Fl_Widget* argument. If the
  52. item does not have a callback the menu_button's callback is done
  53. instead.
  54. */
  55. class FL_EXPORT Fl_Menu_Button : public Fl_Menu_ {
  56. protected:
  57. void draw();
  58. public:
  59. /**
  60. \brief indicate what mouse buttons pop up the menu.
  61. Values for type() used to indicate what mouse buttons pop up the menu.
  62. Fl_Menu_Button::POPUP3 is usually what you want.
  63. */
  64. enum popup_buttons {POPUP1 = 1, /**< pops up with the mouse 1st button. */
  65. POPUP2, /**< pops up with the mouse 2nd button. */
  66. POPUP12, /**< pops up with the mouse 1st or 2nd buttons. */
  67. POPUP3, /**< pops up with the mouse 3rd button. */
  68. POPUP13, /**< pops up with the mouse 1st or 3rd buttons. */
  69. POPUP23, /**< pops up with the mouse 2nd or 3rd buttons. */
  70. POPUP123 /**< pops up with any mouse button. */
  71. };
  72. int handle(int);
  73. const Fl_Menu_Item* popup();
  74. Fl_Menu_Button(int,int,int,int,const char * =0);
  75. };
  76. #endif
  77. //
  78. // End of "$Id: Fl_Menu_Button.H 8016 2010-12-12 11:19:12Z manolo $".
  79. //