mirror of https://gitlab.com/cppit/jucipp
8 changed files with 274 additions and 256 deletions
@ -1,9 +1,7 @@ |
|||||||
#include "juci.h" |
#include "juci.h" |
||||||
|
|
||||||
int main(int argc, char *argv[]) { |
int main(int argc, char *argv[]) { |
||||||
|
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "no.sout.juci"); |
||||||
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "no.sout.juci"); |
Window window; |
||||||
Window window; |
return app->run(window);; |
||||||
|
|
||||||
return app->run(window);; |
|
||||||
} |
} |
||||||
|
|||||||
@ -0,0 +1,21 @@ |
|||||||
|
#include "keybindings.h" |
||||||
|
|
||||||
|
|
||||||
|
Keybindings::Controller::Controller() { |
||||||
|
action_group_ = Gtk::ActionGroup::create(); |
||||||
|
ui_manager_ = Gtk::UIManager::create(); |
||||||
|
} |
||||||
|
Keybindings::Controller::~Controller(){ |
||||||
|
|
||||||
|
} |
||||||
|
void Keybindings::Controller::set_ui_manager_action_group(Glib::RefPtr<Gtk::ActionGroup> action_group) { |
||||||
|
ui_manager_->insert_action_group(action_group); |
||||||
|
} |
||||||
|
void Keybindings::Controller::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(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,28 @@ |
|||||||
|
#include "iostream" |
||||||
|
#include "gtkmm.h" |
||||||
|
|
||||||
|
namespace Keybindings { |
||||||
|
|
||||||
|
class Controller { |
||||||
|
public: |
||||||
|
Controller(); |
||||||
|
virtual ~Controller(); |
||||||
|
|
||||||
|
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: |
||||||
|
Glib::RefPtr<Gtk::UIManager> ui_manager_; |
||||||
|
Glib::RefPtr<Gtk::ActionGroup> action_group_; |
||||||
|
}; |
||||||
|
|
||||||
|
} |
||||||
@ -1,90 +1,69 @@ |
|||||||
#include <iostream> |
#include <iostream> |
||||||
#include "gtkmm.h" |
#include "gtkmm.h" |
||||||
|
#include "keybindings.h" |
||||||
namespace Menu { |
namespace Menu { |
||||||
class Model { |
class Model { |
||||||
public: |
public: |
||||||
Model(); |
Model(); |
||||||
|
|
||||||
virtual~Model(); |
virtual~Model(); |
||||||
|
|
||||||
std::string ui_string() { |
std::string ui_string() { |
||||||
return ui_string_; |
return ui_string_; |
||||||
}; |
}; |
||||||
private: |
private: |
||||||
std::string ui_string_; |
std::string ui_string_; |
||||||
}; |
}; |
||||||
|
|
||||||
|
|
||||||
class View { |
class View { |
||||||
public: |
public: |
||||||
View(Gtk::Orientation orient); |
View(Gtk::Orientation orient); |
||||||
|
virtual ~View(); |
||||||
virtual ~View(); |
Gtk::Box &view(Glib::RefPtr<Gtk::UIManager> ui_manager); |
||||||
|
|
||||||
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: |
protected: |
||||||
Gtk::Box view_; |
Gtk::Box view_; |
||||||
Glib::RefPtr <Gtk::UIManager> ui_manager_; |
|
||||||
Glib::RefPtr <Gtk::ActionGroup> action_group_; |
|
||||||
}; |
}; |
||||||
|
|
||||||
class Controller { |
class Controller { |
||||||
public: |
public: |
||||||
Controller(); |
Controller(Keybindings::Controller keybindings); |
||||||
|
virtual ~Controller(); |
||||||
virtual ~Controller(); |
Gtk::Box &view(); |
||||||
|
|
||||||
Gtk::Box &view(); |
|
||||||
|
|
||||||
Glib::RefPtr <Gtk::UIManager> ui_manager() { |
|
||||||
return menu_view_.ui_manager(); |
|
||||||
}; |
|
||||||
|
|
||||||
private: |
private: |
||||||
Menu::View menu_view_; |
Keybindings::Controller keybindings_; |
||||||
Menu::Model menu_model_; |
Menu::View menu_view_; |
||||||
|
Menu::Model menu_model_; |
||||||
|
|
||||||
/*Signal handlers*/ |
/*Signal handlers*/ |
||||||
void onFileNewEmptyfile(); |
void OnFileNewEmptyfile(); |
||||||
|
|
||||||
void onFileNewCCFile(); |
void OnFileNewCCFile(); |
||||||
|
|
||||||
void onFileNewHeaderFile(); |
void OnFileNewHeaderFile(); |
||||||
|
|
||||||
void onFileOpenFile(); |
void OnFileOpenFile(); |
||||||
|
|
||||||
void onFileOpenFolder(); |
void OnFileOpenFolder(); |
||||||
|
|
||||||
void onSystemQuit(); |
void OnSystemQuit(); |
||||||
|
|
||||||
void onPluginAddSnippet(); |
void OnPluginAddSnippet(); |
||||||
|
|
||||||
void onWindowCloseTab(); |
void OnWindowCloseTab(); |
||||||
|
|
||||||
void onEditCopy(); |
void OnEditCopy(); |
||||||
|
|
||||||
void onEditCut(); |
void OnEditCut(); |
||||||
|
|
||||||
void onEditPaste(); |
void OnEditPaste(); |
||||||
|
|
||||||
void onEditFind(); |
void OnEditFind(); |
||||||
|
|
||||||
void onWindowSplitWindow(); |
void OnWindowSplitWindow(); |
||||||
|
|
||||||
void onHelpAbout(); |
void OnHelpAbout(); |
||||||
|
|
||||||
}; |
}; |
||||||
} |
} |
||||||
Loading…
Reference in new issue