Fl_Menu_Bar.H 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // "$Id: Fl_Menu_Bar.H 9637 2012-07-24 04:37:22Z matt $"
  3. //
  4. // Menu bar 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. Distribution and use rights are outlined in
  9. // the file "COPYING" which should have been included with this file. If this
  10. // file is missing or damaged, see the license at:
  11. //
  12. // http://www.fltk.org/COPYING.php
  13. //
  14. // Please report all bugs and problems on the following page:
  15. //
  16. // http://www.fltk.org/str.php
  17. //
  18. /* \file
  19. Fl_Menu_Bar widget . */
  20. #ifndef Fl_Menu_Bar_H
  21. #define Fl_Menu_Bar_H
  22. #include "Fl_Menu_.H"
  23. /**
  24. This widget provides a standard menubar interface. Usually you will
  25. put this widget along the top edge of your window. The height of the
  26. widget should be 30 for the menu titles to draw correctly with the
  27. default font.
  28. <P>The items on the bar and the menus they bring up are defined by a
  29. single Fl_Menu_Item
  30. array. Because a Fl_Menu_Item array defines a hierarchy, the
  31. top level menu defines the items in the menubar, while the submenus
  32. define the pull-down menus. Sub-sub menus and lower pop up to the right
  33. of the submenus. </P>
  34. <P ALIGN=CENTER>\image html menubar.png</P>
  35. \image latex menubar.png " menubar" width=12cm
  36. <P>If there is an item in the top menu that is not a title of a
  37. submenu, then it acts like a "button" in the menubar. Clicking on it
  38. will pick it. </P>
  39. <P>When the user picks an item off the menu, the item's callback is
  40. done with the menubar as the Fl_Widget* argument. If the item
  41. does not have a callback the menubar's callback is done instead. </P>
  42. <P>Submenus will also pop up in response to shortcuts indicated by
  43. putting a '&' character in the name field of the menu item. If you put a
  44. '&' character in a top-level "button" then the shortcut picks it. The
  45. '&' character in submenus is ignored until the menu is popped up. </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. */
  49. class FL_EXPORT Fl_Menu_Bar : public Fl_Menu_ {
  50. protected:
  51. void draw();
  52. public:
  53. int handle(int);
  54. /**
  55. Creates a new Fl_Menu_Bar widget using the given position,
  56. size, and label string. The default boxtype is FL_UP_BOX.
  57. <P>The constructor sets menu() to NULL. See
  58. Fl_Menu_ for the methods to set or change the menu. </P>
  59. <P>labelsize(), labelfont(), and labelcolor()
  60. are used to control how the menubar items are drawn. They are
  61. initialized from the Fl_Menu static variables, but you can
  62. change them if desired. </P>
  63. <P>label() is ignored unless you change align() to
  64. put it outside the menubar.
  65. <P>The destructor removes the Fl_Menu_Bar widget and all of its
  66. menu items.
  67. */
  68. Fl_Menu_Bar(int X, int Y, int W, int H,const char *l=0);
  69. DECLARE_CLASS_CHEAP_RTTI_2(Fl_Menu_Bar, Fl_Menu_)
  70. };
  71. #endif
  72. //
  73. // End of "$Id: Fl_Menu_Bar.H 9637 2012-07-24 04:37:22Z matt $".
  74. //