mirror of https://gitlab.com/cppit/jucipp
11 changed files with 406 additions and 278 deletions
@ -1,27 +1,79 @@
|
||||
cmake_minimum_required (VERSION 2.8.4) |
||||
project (juci) |
||||
set(project_name juci) |
||||
|
||||
project (${project_name}) |
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") |
||||
|
||||
INCLUDE(FindPkgConfig) |
||||
|
||||
#### Finding boost, the variables below is set ##### |
||||
#PYTHONLIBS_FOUND - True if headers and requested libraries were found |
||||
#PYTHON_INCLUDE_DIRS - Boost include directories |
||||
#PYTHON_LIBRARIES - Boost component libraries to be linked |
||||
find_package(PythonLibs 2.7) |
||||
|
||||
#If python is found |
||||
if(${PYTHONLIBS_FOUND}) |
||||
message("Python libraries found. Continuing") |
||||
else() |
||||
message("Please install python libraries. The libraries where not found.") |
||||
message("Python include dirs: ${PYTHON_INCLUDE_DIRS}") |
||||
message("Python link dirs ${PYTHON_LIBRARIES}") |
||||
message(FATAL_ERROR "The python libraries are required. Quitting.") |
||||
endif() |
||||
|
||||
#### Finding boost, the variables below is set ##### |
||||
#Boost_FOUND - True if headers and requested libraries were found |
||||
#Boost_INCLUDE_DIRS - Boost include directories |
||||
#Boost_LIBRARY_DIRS - Link directories for Boost libraries |
||||
#Boost_LIBRARIES - Boost component libraries to be linked |
||||
find_package(Boost 1.5 REQUIRED) |
||||
|
||||
#If boost is not found |
||||
if(${Boost_FOUND}) |
||||
message("Boost libraries found. Continuing") |
||||
else() |
||||
message("Please install boost libraries. The libraries where not found.") |
||||
message("Boost library dirs: ${Boost_LIBRARY_DIRS}") |
||||
message("Boost include dirs: ${Boost_INCLUDE_DIRS}") |
||||
message("Boost link dirs ${Boost_LIBRARIES}") |
||||
message(FATAL_ERROR "The boost libraries are required. Quitting.") |
||||
endif() |
||||
|
||||
#### Finding gtkmm, the variables below is set ##### |
||||
#GTKMM_FOUND - True if headers and requested libraries were found |
||||
#GTKMM_INCLUDE_DIRS - GTKMM include directories |
||||
#GTKMM_LIBRARY_DIRS - Link directories for GTKMM libraries |
||||
#GTKMM_LIBRARIES - GTKMM libraries to be linked |
||||
pkg_check_modules(GTKMM gtkmm-3.0) # The name GTKMM is set here for the variables abouve |
||||
|
||||
#If gtkmm is not found |
||||
if(${GTKMM_FOUND}) |
||||
message("Gtkmm libraries found. Continuing") |
||||
else() |
||||
message("Please install gtkmm libraries. The libraries where not found.") |
||||
message("Gtkmm library dirs ${GTKMM_LIBRARY_DIRS}") |
||||
message("Gtkmm include dirs ${GTKMM_INCLUDE_DIRS}") |
||||
message("Gtkmm link dirs ${GTKMM_LIBRARIES}") |
||||
message(FATAL_ERROR "The gtkmm libraries are required. Quitting.") |
||||
endif() |
||||
|
||||
|
||||
# name of the executable on Windows will be example.exe |
||||
add_executable(juci |
||||
add_executable(${project_name} |
||||
# list of every needed file to create the executable |
||||
model.h |
||||
models.cc |
||||
menu.h |
||||
|
||||
view.h |
||||
views.cc |
||||
|
||||
controller.h |
||||
controllers.cc |
||||
menu.cc |
||||
|
||||
window.cc |
||||
juci.cc |
||||
) |
||||
|
||||
# dependencies |
||||
pkg_check_modules(GTKMM REQUIRED gtkmm-3.0) |
||||
include_directories(${GTKMM_INCLUDE_DIRS} ) |
||||
link_directories(${GTKMM_LIBRARY_DIRS}) |
||||
target_link_libraries(juci ${GTKMM_LIBRARIES}) |
||||
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS}) |
||||
link_directories(${GTKMM_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS}) |
||||
target_link_libraries(${project_name} ${GTKMM_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) |
||||
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
/*juCi++ controller header file*/ |
||||
#ifndef CONTROLLER_H |
||||
#define CONTROLLER_H |
||||
|
||||
#include "view.h" |
||||
#include "model.h" |
||||
|
||||
/* -------------------------- HOW TO ----------------------------- */ |
||||
/* Controll classes under Controller->public */ |
||||
/* Model object under Controller::class->private name:class_model */ |
||||
/* View object under Controller::class->private name:class_view */ |
||||
/* ------------------ Remove these comments ---------------------- */ |
||||
|
||||
class Controller { |
||||
public: |
||||
class Menu { |
||||
public: |
||||
Menu(); |
||||
|
||||
virtual ~Menu(); |
||||
Gtk::Box &view(); |
||||
|
||||
Glib::RefPtr<Gtk::UIManager> ui_manager() { |
||||
return menu_view_.ui_manager(); |
||||
}; |
||||
|
||||
private: |
||||
View::Menu menu_view_; |
||||
Model::Menu menu_model_; |
||||
/*Signal handlers*/ |
||||
void onFileNewEmptyfile(); |
||||
void onFileNewCCFile(); |
||||
void onFileNewHeaderFile(); |
||||
void onFileOpenFile(); |
||||
void onFileOpenFolder(); |
||||
void onSystemQuit(); |
||||
void onPluginAddSnippet(); |
||||
|
||||
}; |
||||
}; |
||||
|
||||
|
||||
#endif //CONTROLLER_H
|
||||
@ -1,80 +0,0 @@
|
||||
#include "controller.h" |
||||
|
||||
Controller::Menu::Menu() : |
||||
menu_view_(Gtk::ORIENTATION_VERTICAL), |
||||
menu_model_() { |
||||
/*Add action to menues*/ |
||||
/*File menu*/ |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileMenu", Gtk::Stock::FILE)); |
||||
/*File->New files*/ |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileNew", "New")); |
||||
|
||||
menu_view_.action_group()->add(Gtk::Action::create("FileNewStandard", |
||||
Gtk::Stock::NEW, "New empty file", "Create a new file"), |
||||
[this]() { |
||||
onFileNewEmptyfile(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileNewCC", |
||||
Gtk::Stock::NEW, "New cc file", "Create a new cc file"), |
||||
Gtk::AccelKey("<control><alt>c"), |
||||
[this]() { |
||||
onFileNewCCFile(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileNewH", |
||||
Gtk::Stock::NEW, "New h file", "Create a new h file"), |
||||
Gtk::AccelKey("<control><alt>h"), |
||||
[this]() { |
||||
onFileNewHeaderFile(); |
||||
}); |
||||
/* File-> New files end */ |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileOpenFile", Gtk::Stock::OPEN), |
||||
[this]() { |
||||
onFileNewEmptyfile(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileOpenFolder", "Open folder"), |
||||
[this]() { |
||||
onFileNewEmptyfile(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), |
||||
[this]() { |
||||
onSystemQuit(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("PluginMenu", "Plugins")); |
||||
menu_view_.action_group()->add(Gtk::Action::create("PluginSnippet", "Snippet")); |
||||
menu_view_.action_group()->add(Gtk::Action::create("PluginAddSnippet", "Add snippet"), |
||||
Gtk::AccelKey("<alt>space"), |
||||
[this]() { |
||||
onPluginAddSnippet(); |
||||
}); |
||||
|
||||
|
||||
menu_view_.set_ui_manager_action_group(menu_view_.action_group()); |
||||
menu_view_.set_ui_manger_string(menu_model_.ui_string()); |
||||
} |
||||
|
||||
Controller::Menu::~Menu() { |
||||
|
||||
} |
||||
|
||||
Gtk::Box &Controller::Menu::view() { |
||||
return menu_view_.view(); |
||||
} |
||||
|
||||
void Controller::Menu::onFileNewEmptyfile() { |
||||
std::cout << "New file clicked" << std::endl; |
||||
} |
||||
void Controller::Menu::onFileNewCCFile() { |
||||
std::cout << "New cc file clicked" << std::endl; |
||||
} |
||||
|
||||
void Controller::Menu::onFileNewHeaderFile() { |
||||
std::cout << "New cc file clicked" << std::endl; |
||||
} |
||||
void Controller::Menu::onSystemQuit(){ |
||||
//TODO(Oyvang, Zalox, Forgie) Add everything that needs to be done before quiting
|
||||
/*Quit the system*/ |
||||
Gtk::Main::quit(); //TODO(Oyvang, Zalox, Forgie) methode is depricated, find a better solution.
|
||||
} |
||||
void Controller::Menu::onPluginAddSnippet() { |
||||
std::cout << "Add snipper" << std::endl; //TODO(Forgi add you snippet magic code)
|
||||
} |
||||
@ -0,0 +1,247 @@
|
||||
#include "menu.h" |
||||
|
||||
/***********************************/ |
||||
/* MODEL */ |
||||
/***********************************/ |
||||
|
||||
|
||||
Menu::Model::Model() { |
||||
ui_string_ = |
||||
"<ui> " |
||||
" <menubar name='MenuBar'> " |
||||
" <menu action='FileMenu'> " |
||||
" <menu action='FileNew'> " |
||||
" <menuitem action='FileNewStandard'/> " |
||||
" <menuitem action='FileNewCC'/> " |
||||
" <menuitem action='FileNewH'/> " |
||||
" </menu> " |
||||
" <menuitem action='FileOpenFile'/> " |
||||
" <menuitem action='FileOpenFolder'/> " |
||||
" <separator/> " |
||||
" <menuitem action='FileQuit'/> " |
||||
" </menu> " |
||||
" <menu action='EditMenu'> " |
||||
" <menuitem action='EditCopy'/> " |
||||
" <menuitem action='EditCut'/> " |
||||
" <menuitem action='EditPaste'/> " |
||||
" <separator/> " |
||||
" <menuitem action='EditFind'/> " |
||||
" </menu> " |
||||
" <menu action='WindowMenu'> " |
||||
" <menuitem action='WindowCloseTab'/> " |
||||
" <menuitem action='WindowSplitWindow'/> " |
||||
" </menu> " |
||||
" <menu action='PluginMenu'> " |
||||
" <menu action='PluginSnippet'> " |
||||
" <menuitem action='PluginAddSnippet'/> " |
||||
" </menu> " |
||||
" </menu> " |
||||
" <menu action='HelpMenu'> " |
||||
" <menuitem action='HelpAbout'/> " |
||||
" </menu> " |
||||
" </menubar> " |
||||
"</ui> "; |
||||
|
||||
} |
||||
|
||||
Menu::Model::~Model() { |
||||
} |
||||
|
||||
/***********************************/ |
||||
/* VIEW */ |
||||
/***********************************/ |
||||
Menu::View::View(Gtk::Orientation orientation) : |
||||
view_(orientation) { |
||||
|
||||
action_group_ = Gtk::ActionGroup::create(); |
||||
ui_manager_ = Gtk::UIManager::create(); |
||||
|
||||
|
||||
} |
||||
|
||||
void Menu::View::set_ui_manger_string(std::string ui_string) { |
||||
try { |
||||
ui_manager_->add_ui_from_string(ui_string); |
||||
} |
||||
catch (const Glib::Error &ex) { |
||||
std::cerr << "building menus failed: " << ex.what(); |
||||
} |
||||
} |
||||
|
||||
void Menu::View::set_ui_manager_action_group(Glib::RefPtr<Gtk::ActionGroup> action_group) { |
||||
ui_manager_->insert_action_group(action_group); |
||||
} |
||||
|
||||
Gtk::Box &Menu::View::view() { |
||||
view_.pack_start(*ui_manager_->get_widget("/MenuBar"), Gtk::PACK_SHRINK); |
||||
return view_; |
||||
} |
||||
|
||||
|
||||
Menu::View::~View() { |
||||
} |
||||
|
||||
/***********************************/ |
||||
/* CONTROLLER */ |
||||
/***********************************/ |
||||
Menu::Controller::Controller() : |
||||
menu_view_(Gtk::ORIENTATION_VERTICAL), |
||||
menu_model_() { |
||||
/* Add action to menues */ |
||||
/* START file menu */ |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileMenu", Gtk::Stock::FILE)); |
||||
/* File->New files */ |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileNew", "New")); |
||||
|
||||
menu_view_.action_group()->add(Gtk::Action::create("FileNewStandard", |
||||
Gtk::Stock::NEW, "New empty file", "Create a new file"), |
||||
[this]() { |
||||
onFileNewEmptyfile(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileNewCC", |
||||
Gtk::Stock::NEW, "New cc file", "Create a new cc file"), |
||||
Gtk::AccelKey("<control><alt>c"), |
||||
[this]() { |
||||
onFileNewCCFile(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileNewH", |
||||
Gtk::Stock::NEW, "New h file", "Create a new h file"), |
||||
Gtk::AccelKey("<control><alt>h"), |
||||
[this]() { |
||||
onFileNewHeaderFile(); |
||||
}); |
||||
/* File-> New files end */ |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileOpenFile", Gtk::Stock::OPEN), |
||||
[this]() { |
||||
onFileOpenFile(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileOpenFolder", "Open folder"), |
||||
[this]() { |
||||
onFileOpenFolder(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), |
||||
[this]() { |
||||
onSystemQuit(); |
||||
}); |
||||
/* END file menu */ |
||||
/* START edit menu */ |
||||
menu_view_.action_group()->add(Gtk::Action::create("EditMenu", Gtk::Stock::EDIT)); |
||||
menu_view_.action_group()->add(Gtk::Action::create("EditCopy", Gtk::Stock::COPY), |
||||
[this]() { |
||||
onEditCopy(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("EditCut", Gtk::Stock::CUT), |
||||
[this]() { |
||||
onEditCut(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("EditPaste", Gtk::Stock::PASTE), |
||||
[this]() { |
||||
onEditPaste(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("EditFind", Gtk::Stock::FIND), |
||||
[this]() { |
||||
onEditFind(); |
||||
}); |
||||
/* END edit menu */ |
||||
/* START window menu */ |
||||
menu_view_.action_group()->add(Gtk::Action::create("WindowMenu", "_Window")); |
||||
menu_view_.action_group()->add(Gtk::Action::create("WindowCloseTab", "Close tab"), |
||||
Gtk::AccelKey("<control>w"), |
||||
[this]() { |
||||
onWindowCloseTab(); |
||||
}); |
||||
menu_view_.action_group()->add(Gtk::Action::create("WindowSplitWindow", "Split window"), |
||||
Gtk::AccelKey("<control><alt>S"), |
||||
[this]() { |
||||
onWindowSplitWindow(); |
||||
}); |
||||
/* END window menu */ |
||||
/* START Plugin menu */ |
||||
menu_view_.action_group()->add(Gtk::Action::create("PluginMenu", "_Plugins")); |
||||
/*Plugin->snippet*/ |
||||
menu_view_.action_group()->add(Gtk::Action::create("PluginSnippet", "Snippet")); |
||||
menu_view_.action_group()->add(Gtk::Action::create("PluginAddSnippet", "Add snippet"), |
||||
Gtk::AccelKey("<alt>space"), |
||||
[this]() { |
||||
onPluginAddSnippet(); |
||||
}); |
||||
/* End snippet */ |
||||
/* END plugin menu */ |
||||
/* START help menu */ |
||||
menu_view_.action_group()->add(Gtk::Action::create("HelpMenu", Gtk::Stock::HELP)); |
||||
menu_view_.action_group()->add(Gtk::Action::create("HelpAbout", Gtk::Stock::ABOUT), |
||||
[this]() { |
||||
onHelpAbout(); |
||||
}); |
||||
/* END help menu */ |
||||
|
||||
|
||||
menu_view_.set_ui_manager_action_group(menu_view_.action_group()); |
||||
menu_view_.set_ui_manger_string(menu_model_.ui_string()); |
||||
} |
||||
|
||||
Menu::Controller::~Controller() { |
||||
|
||||
} |
||||
|
||||
Gtk::Box &Menu::Controller::view() { |
||||
return menu_view_.view(); |
||||
} |
||||
|
||||
void Menu::Controller::onFileNewEmptyfile() { |
||||
std::cout << "New file clicked" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onFileNewCCFile() { |
||||
std::cout << "New cc file clicked" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
|
||||
void Menu::Controller::onFileNewHeaderFile() { |
||||
std::cout << "New cc file clicked" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onSystemQuit(){ |
||||
//TODO(Oyvang, Zalox, Forgie) Add everything that needs to be done before quiting
|
||||
/*Quit the system*/ |
||||
Gtk::Main::quit(); //TODO(Oyvang, Zalox, Forgie) methode is depricated, find a better solution.
|
||||
} |
||||
void Menu::Controller::onPluginAddSnippet() { |
||||
std::cout << "Add snipper" << std::endl; //TODO(Forgi add you snippet magic code)
|
||||
} |
||||
void Menu::Controller::onFileOpenFile() { |
||||
std::cout << "Open file clicked" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onFileOpenFolder() { |
||||
std::cout << "Open folder clicked" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onWindowCloseTab() { |
||||
std::cout << "Closing tab clicked" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onEditCopy() { |
||||
std::cout << "Clicked copy" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onEditCut() { |
||||
std::cout << "Clicked cut" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onEditPaste() { |
||||
std::cout << "Clicked paste" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onEditFind() { |
||||
std::cout << "Clicked find" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onWindowSplitWindow() { |
||||
std::cout << "Clicked split window" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
void Menu::Controller::onHelpAbout() { |
||||
std::cout << "Clicked about" << std::endl; |
||||
//TODO(Oyvang) Legg til funksjon
|
||||
} |
||||
@ -0,0 +1,90 @@
|
||||
#include <iostream> |
||||
#include "gtkmm.h" |
||||
namespace Menu { |
||||
class Model { |
||||
public: |
||||
Model(); |
||||
|
||||
virtual~Model(); |
||||
|
||||
std::string ui_string() { |
||||
return ui_string_; |
||||
}; |
||||
private: |
||||
std::string ui_string_; |
||||
}; |
||||
|
||||
|
||||
class View { |
||||
public: |
||||
View(Gtk::Orientation orient); |
||||
|
||||
virtual ~View(); |
||||
|
||||
Gtk::Box &view(); |
||||
|
||||
Glib::RefPtr <Gtk::ActionGroup> action_group() { |
||||
return action_group_; |
||||
}; |
||||
|
||||
Glib::RefPtr <Gtk::UIManager> ui_manager() { |
||||
return ui_manager_; |
||||
}; |
||||
|
||||
void set_ui_manger_string(std::string ui_string); |
||||
|
||||
void set_ui_manager_action_group(Glib::RefPtr <Gtk::ActionGroup> action_group); |
||||
|
||||
protected: |
||||
Gtk::Box view_; |
||||
Glib::RefPtr <Gtk::UIManager> ui_manager_; |
||||
Glib::RefPtr <Gtk::ActionGroup> action_group_; |
||||
}; |
||||
|
||||
class Controller { |
||||
public: |
||||
Controller(); |
||||
|
||||
virtual ~Controller(); |
||||
|
||||
Gtk::Box &view(); |
||||
|
||||
Glib::RefPtr <Gtk::UIManager> ui_manager() { |
||||
return menu_view_.ui_manager(); |
||||
}; |
||||
|
||||
private: |
||||
Menu::View menu_view_; |
||||
Menu::Model menu_model_; |
||||
|
||||
/*Signal handlers*/ |
||||
void onFileNewEmptyfile(); |
||||
|
||||
void onFileNewCCFile(); |
||||
|
||||
void onFileNewHeaderFile(); |
||||
|
||||
void onFileOpenFile(); |
||||
|
||||
void onFileOpenFolder(); |
||||
|
||||
void onSystemQuit(); |
||||
|
||||
void onPluginAddSnippet(); |
||||
|
||||
void onWindowCloseTab(); |
||||
|
||||
void onEditCopy(); |
||||
|
||||
void onEditCut(); |
||||
|
||||
void onEditPaste(); |
||||
|
||||
void onEditFind(); |
||||
|
||||
void onWindowSplitWindow(); |
||||
|
||||
void onHelpAbout(); |
||||
|
||||
}; |
||||
} |
||||
@ -1,28 +0,0 @@
|
||||
/*juCi++ model header file*/ |
||||
#ifndef MODEL_H |
||||
#define MODEL_H |
||||
|
||||
#include "gtkmm.h" |
||||
|
||||
/* -------------------------- HOW TO -------------------------- */ |
||||
/* Model classes under Model if possible */ |
||||
/* ------------------ Remove these comments ------------------- */ |
||||
|
||||
class Model { |
||||
public: |
||||
class Menu { |
||||
public: |
||||
Menu(); |
||||
|
||||
virtual~Menu(); |
||||
|
||||
std::string ui_string() { |
||||
return ui_string_; |
||||
}; |
||||
private: |
||||
std::string ui_string_; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
#endif //MODEL_H
|
||||
@ -1,30 +0,0 @@
|
||||
#include "model.h" |
||||
|
||||
Model::Menu::Menu() { |
||||
ui_string_ = |
||||
"<ui> " |
||||
" <menubar name='MenuBar'> " |
||||
" <menu action='FileMenu'> " |
||||
" <menu action='FileNew'> " |
||||
" <menuitem action='FileNewStandard'/> " |
||||
" <menuitem action='FileNewCC'/> " |
||||
" <menuitem action='FileNewH'/> " |
||||
" </menu> " |
||||
// " <menuitem action='FileOpenFile'/> "
|
||||
//" <menuitem action='FileOpenFolder'/> "
|
||||
" <separator/> " |
||||
" <menuitem action='FileQuit'/> " |
||||
" </menu> " |
||||
" <menu action='PluginMenu'> " |
||||
" <menu action='PluginSnippet'> " |
||||
" <menuitem action='PluginAddSnippet'/> " |
||||
" </menu> " |
||||
" </menu> " |
||||
" </menubar> " |
||||
"</ui> "; |
||||
|
||||
// TODO(oyvang) legg til <menuitem action='FileCloseTab'/> under en meny Window
|
||||
} |
||||
|
||||
Model::Menu::~Menu() { |
||||
} |
||||
@ -1,43 +0,0 @@
|
||||
/*juCi++ view header file*/ |
||||
#ifndef VIEW_H |
||||
#define VIEW_H |
||||
|
||||
#include "gtkmm.h" |
||||
#include "iostream" |
||||
|
||||
/* -------------------------- HOW TO -------------------------- */ |
||||
/* All view shall be under View if possible */ |
||||
/* ------------------ Remove these comments ------------------- */ |
||||
|
||||
|
||||
class View { |
||||
public: |
||||
class Menu { |
||||
public: |
||||
Menu(Gtk::Orientation orient); |
||||
|
||||
virtual ~Menu(); |
||||
|
||||
Gtk::Box &view(); |
||||
Glib::RefPtr<Gtk::ActionGroup> action_group() { |
||||
return action_group_; |
||||
}; |
||||
|
||||
Glib::RefPtr<Gtk::UIManager> ui_manager() { |
||||
return ui_manager_; |
||||
}; |
||||
|
||||
void set_ui_manger_string(std::string ui_string); |
||||
|
||||
void set_ui_manager_action_group(Glib::RefPtr<Gtk::ActionGroup> action_group); |
||||
|
||||
protected: |
||||
Gtk::Box view_; |
||||
Glib::RefPtr<Gtk::UIManager> ui_manager_; |
||||
Glib::RefPtr<Gtk::ActionGroup> action_group_; |
||||
}; |
||||
|
||||
|
||||
}; |
||||
|
||||
#endif // VIEW_H
|
||||
@ -1,36 +0,0 @@
|
||||
#include "view.h" |
||||
|
||||
|
||||
/***********************************/ |
||||
/* MENU */ |
||||
/***********************************/ |
||||
View::Menu::Menu(Gtk::Orientation orientation) : |
||||
view_(orientation) { |
||||
|
||||
action_group_ = Gtk::ActionGroup::create(); |
||||
ui_manager_ = Gtk::UIManager::create(); |
||||
|
||||
|
||||
} |
||||
|
||||
void View::Menu::set_ui_manger_string(std::string ui_string) { |
||||
try { |
||||
ui_manager_->add_ui_from_string(ui_string); |
||||
} |
||||
catch (const Glib::Error &ex) { |
||||
std::cerr << "building menus failed: " << ex.what(); |
||||
} |
||||
} |
||||
|
||||
void View::Menu::set_ui_manager_action_group(Glib::RefPtr<Gtk::ActionGroup> action_group) { |
||||
ui_manager_->insert_action_group(action_group); |
||||
} |
||||
|
||||
Gtk::Box &View::Menu::view() { |
||||
view_.pack_start(*ui_manager_->get_widget("/MenuBar"), Gtk::PACK_SHRINK); |
||||
return view_; |
||||
} |
||||
|
||||
|
||||
View::Menu::~Menu() { |
||||
} |
||||
Loading…
Reference in new issue