00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <tools/config_editor/config_edit_dialog.h>
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 ConfigEditDialog::ConfigEditDialog(Gtk::Entry *ent_value, Gtk::ComboBox *cob_bool_value,
00058 Gtk::Notebook *type_pages, Gtk::CheckButton *chb_is_default)
00059 : Gtk::Dialog()
00060 {
00061 m_ent_value = m_ent_value;
00062 m_cob_bool_value = cob_bool_value;
00063 m_type_pages = type_pages;
00064 m_chb_is_default = chb_is_default;
00065 }
00066
00067 #ifdef HAVE_GLADEMM
00068
00069
00070
00071
00072 ConfigEditDialog::ConfigEditDialog( BaseObjectType* cobject,
00073 const Glib::RefPtr<Gnome::Glade::Xml>& ref_xml )
00074 : Gtk::Dialog(cobject)
00075 {
00076 ref_xml->get_widget("entValueEdit", m_ent_value);
00077 ref_xml->get_widget("cmbBoolEdit", m_cob_bool_value);
00078 ref_xml->get_widget("nbkTypesEdit", m_type_pages);
00079 ref_xml->get_widget("chbIsDefaultEdit", m_chb_is_default);
00080 }
00081 #endif
00082
00083
00084
00085
00086
00087
00088 void
00089 ConfigEditDialog::init( const Glib::ustring& path, const Glib::ustring& type,
00090 const Glib::ustring& value )
00091 {
00092 is_bool = (type == "bool");
00093 set_title(path);
00094 m_ent_value->set_text(value);
00095 m_cob_bool_value->set_active(value == "TRUE" ? 0 : 1);
00096 m_type_pages->set_current_page(!is_bool ? 0 : 1);
00097 m_chb_is_default->set_active(false);
00098 }
00099
00100
00101 ConfigEditDialog::~ConfigEditDialog()
00102 {
00103 }
00104
00105
00106
00107
00108 Glib::ustring
00109 ConfigEditDialog::get_value() const
00110 {
00111 if (!is_bool) return m_ent_value->get_text();
00112 else
00113 {
00114 Gtk::TreeIter iter = m_cob_bool_value->get_active();
00115 Gtk::TreeRow row = *iter;
00116 Glib::ustring type;
00117
00118 row.get_value(0, type);
00119
00120 return type;
00121 }
00122 }
00123
00124
00125
00126
00127 bool
00128 ConfigEditDialog::get_is_default() const
00129 {
00130 return m_chb_is_default->get_active();
00131 }