Horizon
preferences_window_canvas.hpp
1 #pragma once
2 #include <gtkmm.h>
3 #include "preferences/preferences.hpp"
4 #include "nlohmann/json.hpp"
5 
6 namespace horizon {
7 using json = nlohmann::json;
8 class CanvasPreferencesEditor : public Gtk::Box {
9 public:
10  CanvasPreferencesEditor(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &x, class Preferences &prefs,
11  bool layered);
12  static CanvasPreferencesEditor *create(Preferences &prefs, bool layered);
13 
14 private:
15  Preferences &preferences;
16  CanvasPreferences &canvas_preferences;
17  const bool is_layered;
18  json color_presets;
19  Gtk::FlowBox *canvas_colors_fb = nullptr;
20  Glib::RefPtr<Gtk::ColorChooser> color_chooser;
21  sigc::connection color_chooser_conn;
22  void handle_export();
23  void handle_import();
24  void handle_default();
25  void handle_load_preset(unsigned int idx);
26  void load_colors(const json &j);
27  void update_color_chooser();
28 };
29 
30 
31 } // namespace horizon
Definition: preferences_window_canvas.hpp:8
Definition: preferences.hpp:15
Definition: preferences.hpp:108
a class to store JSON values
Definition: json.hpp:166
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61