Browse Source

Merge branch 'master' of bitbucket.org:cppit/juci

merge-requests/365/head
forgie 11 years ago
parent
commit
9edb9f8f64
  1. 3
      juci/juci.h
  2. 19
      juci/menu.cc
  3. 4
      juci/menu.h
  4. 7
      juci/window.cc

3
juci/juci.h

@ -14,7 +14,8 @@ public:
Gtk::Box window_box_; Gtk::Box window_box_;
std::shared_ptr<Source::Controller> source(); std::shared_ptr<Source::Controller> source();
private: private:
Menu::Controller menu; Keybindings::Controller keybindings_;
Menu::Controller menu_;
Source::Controller source_; Source::Controller source_;
/*signal handler*/ /*signal handler*/
void onSystemQuit(); void onSystemQuit();

19
juci/menu.cc

@ -47,18 +47,18 @@ Menu::Model::Model() {
Menu::Model::~Model() { Menu::Model::~Model() {
} }
/***********************************/
/* VIEW */ // VIEW
/***********************************/
Menu::View::View(Gtk::Orientation orientation) : Menu::View::View(Gtk::Orientation orientation) :
view_(orientation) { view_(orientation) {
} }
Glib::RefPtr<Gtk::Box> Menu::View::view( Gtk::Box& Menu::View::view(
Glib::RefPtr<Gtk::UIManager> ui_manager) { Glib::RefPtr<Gtk::UIManager> ui_manager) {
view_.pack_start(*ui_manager->get_widget("/MenuBar"), Gtk::PACK_SHRINK); view_.pack_start(*ui_manager->get_widget("/MenuBar"), Gtk::PACK_SHRINK);
return Glib::RefPtr<Gtk::Box>(&view_); return view_;
} }
Menu::View::~View() { Menu::View::~View() {
@ -87,6 +87,7 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) :
[this]() { [this]() {
OnFileNewCCFile(); OnFileNewCCFile();
}); });
keybindings_.action_group()->add(Gtk::Action::create("FileNewH", keybindings_.action_group()->add(Gtk::Action::create("FileNewH",
Gtk::Stock::NEW, "New h file", "Create a new h file"), Gtk::Stock::NEW, "New h file", "Create a new h file"),
Gtk::AccelKey("<control><alt>h"), Gtk::AccelKey("<control><alt>h"),
@ -168,6 +169,10 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) :
Menu::Controller::~Controller() { Menu::Controller::~Controller() {
} }
Gtk::Box& Menu::Controller::view() {
return menu_view_.view(keybindings_.ui_manager());
}
void Menu::Controller::OnFileNewEmptyfile() { void Menu::Controller::OnFileNewEmptyfile() {
std::cout << "New file clicked" << std::endl; std::cout << "New file clicked" << std::endl;
//TODO(Oyvang) Legg til funksjon //TODO(Oyvang) Legg til funksjon
@ -179,14 +184,14 @@ void Menu::Controller::OnFileNewCCFile() {
} }
void Menu::Controller::OnFileNewHeaderFile() { void Menu::Controller::OnFileNewHeaderFile() {
std::cout << "New cc file clicked" << std::endl; std::cout << "New header file clicked" << std::endl;
//TODO(Oyvang) Legg til funksjon //TODO(Oyvang) Legg til funksjon
} }
void Menu::Controller::OnSystemQuit() { void Menu::Controller::OnSystemQuit() {
//TODO(Oyvang, Zalox, Forgie) Add everything that needs to be done before quiting //TODO(Oyvang, Zalox, Forgie) Add everything that needs to be done before quiting
/*Quit the system*/ /*Quit the system*/
Gtk::Main::quit(); //TODO(Oyvang, Zalox, Forgie) methode is depricated, find a better solution.
} }
void Menu::Controller::OnPluginAddSnippet() { void Menu::Controller::OnPluginAddSnippet() {

4
juci/menu.h

@ -19,7 +19,7 @@ namespace Menu {
public: public:
explicit View(Gtk::Orientation orient); explicit View(Gtk::Orientation orient);
virtual ~View(); virtual ~View();
Glib::RefPtr<Gtk::Box> view(Glib::RefPtr<Gtk::UIManager> ui_manager); Gtk::Box& view(Glib::RefPtr<Gtk::UIManager> ui_manager);
protected: protected:
Gtk::Box view_; Gtk::Box view_;
@ -29,7 +29,7 @@ namespace Menu {
public: public:
explicit Controller(Keybindings::Controller keybindings); explicit Controller(Keybindings::Controller keybindings);
virtual ~Controller(); virtual ~Controller();
Gtk::Box& view();
private: private:
Keybindings::Controller keybindings_; Keybindings::Controller keybindings_;
View menu_view_; View menu_view_;

7
juci/window.cc

@ -2,14 +2,15 @@
Window::Window() : Window::Window() :
window_box_(Gtk::ORIENTATION_HORIZONTAL), window_box_(Gtk::ORIENTATION_HORIZONTAL),
menu() { menu_(keybindings_) {
set_title("example juCi++"); set_title("example juCi++");
set_default_size(600, 600); set_default_size(600, 600);
// window_box_.add(*source_.sourceview()); // window_box_.add(*source_.sourceview());
add(window_box_); add(window_box_);
add_accel_group(menu.ui_manager()->get_accel_group()); add_accel_group(keybindings_.ui_manager()->get_accel_group());
window_box_.pack_start(menu.view()); window_box_.pack_start(menu_.view());
show_all_children(); show_all_children();
} }
std::shared_ptr<Source::Controller> Window::source() { std::shared_ptr<Source::Controller> Window::source() {

Loading…
Cancel
Save