You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB

#include "menu.h"
#include "logging.h"
#include <iostream>
Menu::Menu() : box(Gtk::ORIENTATION_VERTICAL) {
11 years ago
INFO("Creating menu");
action_group = Gtk::ActionGroup::create();
ui_manager = Gtk::UIManager::create();
action_group->add(Gtk::Action::create("FileNew", "New File"));
action_group->add(Gtk::Action::create("EditMenu", "Edit"));
action_group->add(Gtk::Action::create("WindowMenu", "_Window"));
action_group->add(Gtk::Action::create("WindowSplitWindow", "Split window"), Gtk::AccelKey(key_map["split_window"]), [this]() {
});
action_group->add(Gtk::Action::create("ProjectMenu", "P_roject"));
action_group->add(Gtk::Action::create("SourceMenu", "_Source"));
action_group->add(Gtk::Action::create("PluginMenu", "_Plugins"));
action_group->add(Gtk::Action::create("HelpMenu", "Help"));
action_group->add(Gtk::Action::create("HelpAbout", "About"), [this]() {
});
11 years ago
INFO("Menu created");
}
Gtk::Widget& Menu::get_widget() {
return *ui_manager->get_widget("/MenuBar");
}
Gtk::Menu& Menu::get_source_menu() {
return *(Gtk::Menu*)ui_manager->get_widget("/MenuBar/SourceMenu");
}
void Menu::build() {
try {
ui_manager->add_ui_from_string(ui);
}
catch (const Glib::Error &ex) {
std::cerr << "building menu failed" << ex.what();
}
ui_manager->insert_action_group(action_group);
}