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  class CanvasPreferences *canvas_prefs, bool layered);
12  static CanvasPreferencesEditor *create(Preferences *prefs, CanvasPreferences *canvas_prefs, bool layered);
13  Preferences *preferences;
14  CanvasPreferences *canvas_preferences;
15 
16 private:
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
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
horizon::Preferences
Definition: preferences.hpp:73
horizon::CanvasPreferences
Definition: preferences.hpp:13
horizon::CanvasPreferencesEditor
Definition: preferences_window_canvas.hpp:8
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:161