Horizon
window_state_store.hpp
1 #pragma once
2 #include <string>
3 
4 namespace Gtk {
5 class Window;
6 }
7 
8 
9 namespace horizon {
10 namespace SQLite {
11 class Database;
12 }
13 
14 class WindowState {
15 public:
16  WindowState(int ax, int ay, int aw, int ah, bool m = false) : x(ax), y(ay), width(aw), height(ah), maximized(m){};
17  WindowState(){};
18  int x = 0;
19  int y = 0;
20  int width = 1024;
21  int height = 768;
22  bool maximized = false;
23 };
24 
26 public:
27  WindowStateStore(Gtk::Window *w, const std::string &window_name);
28  bool get_default_set() const;
29 
30 private:
31  SQLite::Database &db;
32  const std::string window_name;
33  Gtk::Window *win = nullptr;
34  WindowState window_state;
35 
36  bool load(const std::string &win, WindowState &ws);
37  void save(const std::string &win, const WindowState &ws);
38 
39  void apply(const WindowState &ws);
40  bool default_set = false;
41 };
42 } // namespace horizon
Definition: sqlite.hpp:69
Definition: window_state_store.hpp:25
Definition: window_state_store.hpp:14