Lumiera  0.pre.03
»edit your freedom«
menu-button.hpp
Go to the documentation of this file.
1 /*
2  MENU-BUTTON.hpp - button widget to invoke a menu
3 
4  Copyright (C)
5  2008, Joel Holdsworth <joel@airwebreathe.org.uk>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
22 #ifndef STAGE_WIDGET_MENU_BUTTON_H
23 #define STAGE_WIDGET_MENU_BUTTON_H
24 
25 #include "stage/gtk-base.hpp"
26 
27 
28 
29 namespace stage {
30 namespace widget {
31 
32  using namespace Gtk;
33 
37  class MenuButton
38  : public ToggleButton
39  {
40  public:
49  MenuButton();
50 
55  MenuButton (StockID const& stock_id);
56 
63  MenuButton (cuString& label, bool mnemonic=false);
64 
70  Menu& get_menu();
71 
79  void append (uString& slug, uString& title, sigc::slot<void>& callback, bool toggle=false);
80 
81 
89  void append (const char *slug, const char* title, sigc::slot<void>& callback, bool toggle=false);
90 
91 
93  void appendSeparator();
94 
95 
104  Gtk::Widget* get (uString slug);
105 
106 
108  void popup();
109 
110 
111  protected:
115  void setupButton();
116 
120  void on_pressed();
121 
125  void on_menu_deactivated();
126 
127 
128  private:
136  void on_menu_position (int& x, int& y, bool& push_in);
137 
138  private:
140  HBox hBox;
141 
143  Image image;
144 
146  Label caption;
147 
152  Arrow arrow;
153 
157  Menu menu;
158 
159  Glib::RefPtr<UIManager> uimanager;
160  Glib::RefPtr<ActionGroup> actions;
161 
162  };
163 
164 
165 }}// stage::widget
166 #endif /*STAGE_WIDGET_MENU_BUTTON_H*/
Image image
The image that will optionally display an icon.
Label caption
caption text label to show on the button.
Menu menu
The internal menu object which is the popup menu of this widget.
Arrow arrow
The arrow widget that will be displayed to hint the user that this button is a drop-down.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
A set of basic GTK includes for the UI.
HBox hBox
hBox for the layout of an image, caption and arrow.
A button that displays a menu when clicked on.
Definition: menu-button.hpp:37