Fl_Menu_Button.H 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // "$Id: Fl_Menu_Button.H 7903 2010-11-28 21:06:39Z matt $"
  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.gif</P>
  37. \image latex menu_button.eps " 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. , see below. </P>
  42. <P>The menu will also pop up in response to shortcuts indicated by
  43. putting a '&' character in the label(). </P>
  44. <P>Typing the shortcut() of any of the menu items will cause
  45. callbacks exactly the same as when you pick the item with the mouse.
  46. The '&' character in menu item names are only looked at when the menu is
  47. popped up, however. </P>
  48. <P>When the user picks an item off the menu, the item's callback is
  49. done with the menu_button as the Fl_Widget* argument. If the
  50. item does not have a callback the menu_button's callback is done
  51. instead.
  52. */
  53. class FL_EXPORT Fl_Menu_Button : public Fl_Menu_ {
  54. protected:
  55. void draw();
  56. public:
  57. // values for type:
  58. enum {POPUP1 = 1, POPUP2, POPUP12, POPUP3, POPUP13, POPUP23, POPUP123};
  59. int handle(int);
  60. const Fl_Menu_Item* popup();
  61. Fl_Menu_Button(int,int,int,int,const char * =0);
  62. };
  63. #endif
  64. //
  65. // End of "$Id: Fl_Menu_Button.H 7903 2010-11-28 21:06:39Z matt $".
  66. //