1 // This file is part of GtkEveMon. 2 // 3 // GtkEveMon is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU General Public License as published by 5 // the Free Software Foundation, either version 3 of the License, or 6 // (at your option) any later version. 7 // 8 // You should have received a copy of the GNU General Public License 9 // along with GtkEveMon. If not, see <http://www.gnu.org/licenses/>. 10 11 #ifndef GTK_CONF_WIDGETS_HEADER 12 #define GTK_CONF_WIDGETS_HEADER 13 14 #include <string> 15 16 #include <gtkmm.h> 17 18 #include "bits/config.h" 19 20 class GtkConfFileChooser : public Gtk::FileChooserButton 21 { 22 private: 23 ConfValuePtr value; 24 25 void on_selection_change (void); 26 27 public: 28 GtkConfFileChooser (std::string const& key, Gtk::FileChooserAction action); 29 }; 30 31 /* ---------------------------------------------------------------- */ 32 33 class GtkConfCheckButton : public Gtk::CheckButton 34 { 35 private: 36 ConfValuePtr value; 37 38 void on_button_toggled (void); 39 40 public: 41 GtkConfCheckButton (const Glib::ustring& label, bool mnemonic, 42 std::string const& conf_key); 43 }; 44 45 /* ---------------------------------------------------------------- */ 46 47 class GtkConfTextEntry : public Gtk::Entry 48 { 49 private: 50 ConfValuePtr value; 51 52 void on_text_changed (void); 53 54 public: 55 GtkConfTextEntry (std::string const& conf_key); 56 }; 57 58 /* ---------------------------------------------------------------- */ 59 60 class GtkConfComboBox : public Gtk::ComboBoxText 61 { 62 private: 63 ConfValuePtr value; 64 std::vector<std::string> values; 65 66 void on_changed_signal (void); 67 68 public: 69 GtkConfComboBox (std::string const& conf_key); 70 void append_conf_row (std::string const& text, std::string const& value); 71 }; 72 73 /* ---------------------------------------------------------------- */ 74 75 class GtkConfSectionSelection : public Gtk::ComboBox 76 { 77 private: 78 struct GtkConfSelectionCols : public Gtk::TreeModelColumnRecord 79 { 80 Gtk::TreeModelColumn<Glib::ustring> name; 81 Gtk::TreeModelColumn<ConfSectionPtr> section; GtkConfSelectionColsGtkConfSelectionCols82 GtkConfSelectionCols (void) 83 { this->add(name); this->add(section); } 84 } selection_cols; 85 86 private: 87 ConfSectionPtr parent_section; 88 89 sigc::connection changed_conn; 90 Glib::RefPtr<Gtk::ListStore> selection_store; 91 sigc::signal<void, ConfSectionPtr> sig_conf_section_changed; 92 93 protected: 94 void on_combo_entry_changed (void); 95 void update_selection_store (std::string const& select = ""); 96 97 public: 98 GtkConfSectionSelection (void); 99 void set_parent_config_section (std::string const& section, 100 std::string const& select = ""); 101 102 ConfSectionPtr create_new_section (std::string const& name); 103 ConfSectionPtr get_active_section (void); 104 Glib::ustring get_active_name (void); 105 void set_active_section (std::string const& name); 106 void delete_section (std::string const& name); 107 void rename_section (std::string const& from, std::string const& to); 108 109 sigc::signal<void, ConfSectionPtr>& signal_conf_section_changed (void); 110 }; 111 112 #endif /* GTK_CONF_WIDGETS_HEADER */ 113