Debian Codegraph @

examples/book/buildapp/step5/exampleappprefs.h

raw
1 /* gtkmm example Copyright (C) 2016 gtkmm development team
2 *
3 * This program 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 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #ifndef GTKMM_EXAMPLEAPPPREFS_H_
18 #define GTKMM_EXAMPLEAPPPREFS_H_
19
20 #include <gtkmm.h>
21
22 #ifdef GLIBMM_CHECK_VERSION
23 #define HAS_GIO_SETTINGS_BIND_WITH_MAPPING GLIBMM_CHECK_VERSION(2,75,0)
24 #else
25 #define HAS_GIO_SETTINGS_BIND_WITH_MAPPING 0
26 #endif
27
28 class ExampleAppPrefs : public Gtk::Window
29 {
30 public:
31 ExampleAppPrefs(BaseObjectType* cobject,
32 const Glib::RefPtr<Gtk::Builder>& refBuilder);
33
34 static ExampleAppPrefs* create(Gtk::Window& parent);
35
36 protected:
37 #if HAS_GIO_SETTINGS_BIND_WITH_MAPPING
38 // Mappings from Gio::Settings to properties
39 static std::optional<unsigned int> map_from_ustring_to_int(const Glib::ustring& transition);
40 static std::optional<Glib::ustring> map_from_int_to_ustring(const unsigned int& pos);
41 #else
42 // Signal handlers
43 void on_font_setting_changed(const Glib::ustring& key);
44 void on_font_selection_changed();
45 void on_transition_setting_changed(const Glib::ustring& key);
46 void on_transition_selection_changed();
47 #endif
48 Glib::RefPtr<Gtk::Builder> m_refBuilder;
49 Glib::RefPtr<Gio::Settings> m_settings;
50 Gtk::FontDialogButton* m_font {nullptr};
51 Gtk::DropDown* m_transition {nullptr};
52 };
53
54 #endif /* GTKMM_EXAMPLEAPPPREFS_H_ */