diff --git a/src/gui/widgets/menu-button.cpp b/src/gui/widgets/menu-button.cpp index 95e8ff306..fb58845f7 100644 --- a/src/gui/widgets/menu-button.cpp +++ b/src/gui/widgets/menu-button.cpp @@ -30,17 +30,29 @@ using namespace sigc; namespace gui { namespace widgets { +const ArrowType arrowType = ARROW_DOWN; +const ShadowType shadowType = SHADOW_NONE; + MenuButton::MenuButton() : - Button() -{} + Button(), + arrow(arrowType, shadowType) +{ + setup_button(); +} -MenuButton::MenuButton(const Gtk::StockID& stock_id) - : Button(stock_id) -{} +MenuButton::MenuButton(const Gtk::StockID& stock_id) : + Button(stock_id), + arrow(arrowType, shadowType) +{ + setup_button(); +} -MenuButton::MenuButton(const Glib::ustring& label, bool mnemonic) - : Button(label, mnemonic) -{} +MenuButton::MenuButton(const Glib::ustring& label, bool mnemonic) : + Button(label, mnemonic), + arrow(arrowType, shadowType) +{ + setup_button(); +} Gtk::Menu& MenuButton::get_menu() @@ -48,12 +60,6 @@ MenuButton::get_menu() return menu; } -void -MenuButton::on_pressed() -{ - popup(); -} - void MenuButton::popup() { @@ -61,6 +67,20 @@ MenuButton::popup() 0, gtk_get_current_event_time()); } +void +MenuButton::setup_button() +{ + arrow.set(ARROW_DOWN, SHADOW_NONE); + set_image_position(POS_RIGHT); + set_image(arrow); +} + +void +MenuButton::on_pressed() +{ + popup(); +} + void MenuButton::on_menu_position(int& x, int& y, bool& push_in) { diff --git a/src/gui/widgets/menu-button.hpp b/src/gui/widgets/menu-button.hpp index 38c21cdfc..37a9b0447 100644 --- a/src/gui/widgets/menu-button.hpp +++ b/src/gui/widgets/menu-button.hpp @@ -78,6 +78,11 @@ public: protected: + /** + * An internal method which sets up the button at creat time. + **/ + void setup_button(); + /** * An event handler for when the button is pressed. **/ @@ -103,6 +108,12 @@ private: * The internal menu object which is the popup menu of this widget. **/ Gtk::Menu menu; + + /** + * The arrow widget that will be displayed to hint the user that this + * button is a drop-down. + **/ + Gtk::Arrow arrow; }; } // gui