37 #define POPUP_SLUG "TheMenu" 38 #define POPUP_PATH "/" POPUP_SLUG 44 const int CaptionPadding = 4;
45 const ArrowType arrowType = ARROW_DOWN;
46 const ShadowType shadowType = SHADOW_NONE;
51 MenuButton::MenuButton()
53 , arrow(arrowType, shadowType)
54 , uimanager(UIManager::create())
55 , actions(ActionGroup::create())
63 ,
image(stock_id, ICON_SIZE_MENU)
65 ,
arrow(arrowType, shadowType)
68 REQUIRE (StockItem::lookup (stock_id, stock_item));
69 caption.set_text_with_mnemonic (stock_item.get_label());
78 ,
arrow(arrowType, shadowType)
89 uString path (POPUP_PATH);
91 return uimanager->get_widget(path.append(slug));
99 path.append (POPUP_SLUG);
100 Menu* p_menu =
dynamic_cast<Menu*
>(
101 uimanager->get_widget(path));
109 sigc::slot<void> &callback,
bool toggle)
112 actions->add(Action::create(slug, title,
""), callback);
114 actions->add(ToggleAction::create(slug, title,
"",
false), callback);
116 uimanager->add_ui(uimanager->new_merge_id(),
117 ustring(
"ui/").append(POPUP_SLUG),
118 slug, slug, Gtk::UI_MANAGER_AUTO,
120 uimanager->ensure_update();
126 sigc::slot<void>& callback,
bool toggle)
128 uString uSlug (slug);
129 uString uTitle (_(title));
130 append (uSlug, uTitle, callback, toggle);
137 uimanager->add_ui_separator(
138 uimanager->new_merge_id(),
139 ustring(
"ui/").append(POPUP_SLUG),
140 "Separator", Gtk::UI_MANAGER_SEPARATOR,
149 0, gtk_get_current_event_time());
157 uimanager = UIManager::create();
158 actions = ActionGroup::create();
159 uimanager->insert_action_group(actions);
162 const guint rootId = uimanager->new_merge_id();
163 uimanager->add_ui(rootId,
"ui",
164 POPUP_SLUG, POPUP_SLUG,
165 Gtk::UI_MANAGER_POPUP);
167 get_menu().signal_deactivate().connect(mem_fun(
170 arrow.set(ARROW_DOWN, SHADOW_NONE);
172 hBox.pack_start(
caption, PACK_EXPAND_WIDGET, CaptionPadding);
197 Glib::RefPtr<Gdk::Window> window = get_window();
200 window->get_origin(x, y);
201 const Allocation allocation = get_allocation();
202 x += allocation.get_x();
203 y += allocation.get_y() + allocation.get_height();
Lumiera GTK UI implementation root.