mirror of https://gitlab.com/cppit/jucipp
8 changed files with 133 additions and 16 deletions
@ -0,0 +1,55 @@ |
|||||||
|
#include "entry.h" |
||||||
|
|
||||||
|
Entry::Model::Model() : |
||||||
|
next_("Next"), |
||||||
|
prev_("Prev"){ |
||||||
|
std::cout<<"Model Entry"<<std::endl; |
||||||
|
} |
||||||
|
Entry::View::View() : |
||||||
|
view_(Gtk::ORIENTATION_HORIZONTAL), |
||||||
|
button_apply_(Gtk::Stock::APPLY), |
||||||
|
button_cancel_(Gtk::Stock::CANCEL){ |
||||||
|
// container_.add(view_);
|
||||||
|
std::cout<<"View Entry"<<std::endl; |
||||||
|
} |
||||||
|
|
||||||
|
Gtk::Box& Entry::View::view() { |
||||||
|
return view_; |
||||||
|
} |
||||||
|
|
||||||
|
void Entry::View::OnShowSetFilenName(std::string exstension) { |
||||||
|
entry_.set_max_length(50); |
||||||
|
entry_.set_text(exstension); |
||||||
|
view_.pack_start(entry_); |
||||||
|
view_.pack_end(button_cancel_, Gtk::PACK_SHRINK); |
||||||
|
view_.pack_end(button_apply_, Gtk::PACK_SHRINK);
|
||||||
|
} |
||||||
|
void Entry::View::OnHideEntry() |
||||||
|
{ |
||||||
|
view_.remove(entry_); |
||||||
|
view_.remove(button_cancel_); |
||||||
|
view_.remove(button_apply_); |
||||||
|
} |
||||||
|
|
||||||
|
Entry::Controller::Controller() { |
||||||
|
std::cout<<"Controller Entry"<<std::endl;
|
||||||
|
|
||||||
|
} |
||||||
|
Gtk::Box& Entry::Controller::view() { |
||||||
|
return view_.view(); |
||||||
|
} |
||||||
|
|
||||||
|
Gtk::Button& Entry::Controller::button_apply(){ |
||||||
|
return view_.button_apply(); |
||||||
|
} |
||||||
|
|
||||||
|
void Entry::Controller::OnShowSetFilenName(std::string exstension) { |
||||||
|
view_.OnShowSetFilenName(exstension); |
||||||
|
view_.view().show_all(); |
||||||
|
view_.entry().grab_focus(); |
||||||
|
view_.entry().set_position(0); |
||||||
|
} |
||||||
|
|
||||||
|
void Entry::Controller::OnHideEntries(){ |
||||||
|
view_.OnHideEntry(); |
||||||
|
} |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
#ifndef JUCI_ENTRY_H_ |
||||||
|
#define JUCI_ENTRY_H_ |
||||||
|
|
||||||
|
#include <iostream> |
||||||
|
#include "gtkmm.h" |
||||||
|
#include "keybindings.h" |
||||||
|
|
||||||
|
namespace Entry { |
||||||
|
class View { |
||||||
|
public: |
||||||
|
View(); |
||||||
|
Gtk::Box& view(); |
||||||
|
Gtk::Entry& entry(){return entry_;} |
||||||
|
Gtk::Button& button_apply(){return button_apply_;}; |
||||||
|
Gtk::Button& button_cancel(){return button_cancel_;}; |
||||||
|
void OnShowSetFilenName(std::string exstension); |
||||||
|
void OnHideEntry(); |
||||||
|
protected: |
||||||
|
Gtk::Box view_; |
||||||
|
Gtk::Entry entry_; |
||||||
|
Gtk::Button button_apply_, button_cancel_; |
||||||
|
}; |
||||||
|
class Model { |
||||||
|
public: |
||||||
|
Model(); |
||||||
|
std::string next(){return next_;}; |
||||||
|
std::string prev(){return prev_;}; |
||||||
|
private: |
||||||
|
std::string next_, prev_;
|
||||||
|
}; |
||||||
|
class Controller { |
||||||
|
public: |
||||||
|
Controller(); |
||||||
|
Gtk::Box& view(); |
||||||
|
Gtk::Button& button_apply(); |
||||||
|
void OnShowSetFilenName(std::string exstension); |
||||||
|
void OnHideEntries(); |
||||||
|
View view_; |
||||||
|
};// class controller
|
||||||
|
} // namespace notebook
|
||||||
|
|
||||||
|
|
||||||
|
#endif // JUCI_ENTRY_H_
|
||||||
Loading…
Reference in new issue