28 #define POPUP_SLUG "TheMenu" 29 #define POPUP_PATH "/" POPUP_SLUG 35 const int CaptionPadding = 4;
36 const ArrowType arrowType = ARROW_DOWN;
37 const ShadowType shadowType = SHADOW_NONE;
42 MenuButton::MenuButton()
44 , arrow(arrowType, shadowType)
45 , uimanager(UIManager::create())
46 , actions(ActionGroup::create())
54 ,
image(stock_id, ICON_SIZE_MENU)
56 ,
arrow(arrowType, shadowType)
59 REQUIRE (StockItem::lookup (stock_id, stock_item));
60 caption.set_text_with_mnemonic (stock_item.get_label());
69 ,
arrow(arrowType, shadowType)
80 uString path (POPUP_PATH);
82 return uimanager->get_widget(path.append(slug));
90 path.append (POPUP_SLUG);
91 Menu* p_menu =
dynamic_cast<Menu*
>(
92 uimanager->get_widget(path));
100 sigc::slot<void> &callback,
bool toggle)
103 actions->add(Action::create(slug, title,
""), callback);
105 actions->add(ToggleAction::create(slug, title,
"",
false), callback);
107 uimanager->add_ui(uimanager->new_merge_id(),
108 ustring(
"ui/").append(POPUP_SLUG),
109 slug, slug, Gtk::UI_MANAGER_AUTO,
111 uimanager->ensure_update();
117 sigc::slot<void>& callback,
bool toggle)
119 uString uSlug (slug);
120 uString uTitle (_(title));
121 append (uSlug, uTitle, callback, toggle);
128 uimanager->add_ui_separator(
129 uimanager->new_merge_id(),
130 ustring(
"ui/").append(POPUP_SLUG),
131 "Separator", Gtk::UI_MANAGER_SEPARATOR,
140 0, gtk_get_current_event_time());
148 uimanager = UIManager::create();
149 actions = ActionGroup::create();
150 uimanager->insert_action_group(actions);
153 const guint rootId = uimanager->new_merge_id();
154 uimanager->add_ui(rootId,
"ui",
155 POPUP_SLUG, POPUP_SLUG,
156 Gtk::UI_MANAGER_POPUP);
158 get_menu().signal_deactivate().connect(mem_fun(
161 arrow.set(ARROW_DOWN, SHADOW_NONE);
163 hBox.pack_start(
caption, PACK_EXPAND_WIDGET, CaptionPadding);
188 Glib::RefPtr<Gdk::Window> window = get_window();
191 window->get_origin(x, y);
192 const Allocation allocation = get_allocation();
193 x += allocation.get_x();
194 y += allocation.get_y() + allocation.get_height();
Lumiera GTK UI implementation root.