[Summary] Adding support of Gtk::Entry, Gtk::Box. Improving code style.

This commit is contained in:
VKamyshniy 2014-06-24 19:06:00 +03:00
parent a32512968d
commit 9ab042cfd1
2 changed files with 30 additions and 4 deletions

View file

@ -33,7 +33,7 @@ using namespace ARDOUR;
std::map<std::string, const XMLTree*> WavesUI::__xml_tree_cache;
WavesUI::WavesUI (std::string layout_script_file, Gtk::Container& root)
WavesUI::WavesUI (const std::string& layout_script_file, Gtk::Container& root)
: _xml_tree (NULL)
{
// To avoid a need of reading the same file many times:
@ -287,7 +287,7 @@ WavesUI::create_ui (const XMLTree& layout, Gtk::Container& root)
}
const XMLTree*
WavesUI::load_layout (const std::string xml_file_name)
WavesUI::load_layout (const std::string& xml_file_name)
{
std::map<std::string, const XMLTree*>::const_iterator it = __xml_tree_cache.find(xml_file_name);
if (it != __xml_tree_cache.end()) {
@ -478,6 +478,19 @@ WavesUI::get_adjustment(const char* id)
return *child;
}
Gtk::Box&
WavesUI::get_box (const char* id)
{
Gtk::Box* child = dynamic_cast<Gtk::Box*> (get_object(id));
if (child == NULL ) {
dbg_msg (std::string("Gtk::Box ") + id + " not found !");
throw std::exception();
}
return *child;
}
Gtk::VBox&
WavesUI::get_v_box (const char* id)
{
@ -538,6 +551,17 @@ WavesUI::get_combo_box_text (const char* id)
}
Gtk::Entry&
WavesUI::get_entry(const char* id)
{
Gtk::Entry* child = dynamic_cast<Gtk::Entry*> (get_object(id));
if (child == NULL ) {
dbg_msg (std::string("Gtk::Entry ") + id + " not found !");
throw std::exception();
}
return *child;
}
WavesButton&
WavesUI::get_waves_button (const char* id)
{

View file

@ -39,15 +39,17 @@ using namespace ArdourCanvas::XMLUI;
class WavesUI : public std::map<std::string, Gtk::Object*> {
public:
WavesUI (std::string layout_script_file, Gtk::Container& root);
WavesUI (const std::string& layout_script_file, Gtk::Container& root);
Gtk::Adjustment& get_adjustment (const char* id);
Gtk::Box& get_box (const char* id);
Gtk::VBox& get_v_box (const char* id);
Gtk::HBox& get_h_box (const char* id);
Gtk::Layout& get_layout (const char* id);
Gtk::Label& get_label (const char* id);
Gtk::Image& get_image (const char* id);
Gtk::ComboBoxText& get_combo_box_text (const char* id);
Gtk::Entry& get_entry(const char* id);
WavesButton& get_waves_button (const char* id);
Gtkmm2ext::Fader& get_fader (const char* id);
const XMLTree* xml_tree() { return _xml_tree; }
@ -60,7 +62,7 @@ class WavesUI : public std::map<std::string, Gtk::Object*> {
const XMLTree* _xml_tree;
Gtk::Object* get_object(const char *id);
const XMLTree* load_layout (const std::string xml_file_name);
const XMLTree* load_layout (const std::string& xml_file_name);
void create_ui (const XMLTree& layout, Gtk::Container& root);
void create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk::Container& root);
Gtk::Widget* create_widget (const XMLNode& definition, const XMLNodeMap& styles);