Horizon
editor_window.hpp
1 #pragma once
2 #include <gtkmm.h>
3 #include "common/common.hpp"
4 #include <memory>
5 #include "editor_interface.hpp"
6 #include "util/window_state_store.hpp"
7 #include "util/pool_goto_provider.hpp"
8 
9 namespace horizon {
11 public:
12  EditorWindowStore(const std::string &fn);
13  void save();
14  virtual void save_as(const std::string &fn) = 0;
15  virtual std::string get_name() const = 0;
16  std::string filename;
17  virtual ~EditorWindowStore()
18  {
19  }
20 };
21 
22 class EditorWindow : public Gtk::Window, public PoolGotoProvider {
23 public:
24  EditorWindow(ObjectType type, const std::string &filename, class Pool *p, class PoolParametric *pp, bool read_only,
25  bool is_temp);
26  void reload();
27  bool get_need_update();
28  static std::string fix_filename(std::string s);
29  void save();
30  void force_close();
31  bool get_needs_save();
32  std::string get_filename() const;
33  void set_original_filename(const std::string &s);
34 
35  typedef sigc::signal<void, std::string> type_signal_filename_changed;
36  type_signal_filename_changed signal_filename_changed()
37  {
38  return s_signal_filename_changed;
39  }
40 
41 private:
42  ObjectType type;
43  std::unique_ptr<EditorWindowStore> store = nullptr;
44  PoolEditorInterface *iface = nullptr;
45  Gtk::Button *save_button = nullptr;
46  class Pool *pool;
47  class PoolParametric *pool_parametric;
48  bool need_update = false;
49  std::string original_filename;
50 
51  type_signal_filename_changed s_signal_filename_changed;
52 
53  WindowStateStore state_store;
54 };
55 } // namespace horizon
horizon::EditorWindow
Definition: editor_window.hpp:22
horizon::PoolGotoProvider
Definition: pool_goto_provider.hpp:7
horizon::WindowStateStore
Definition: window_state_store.hpp:20
horizon::PoolEditorInterface
Definition: editor_interface.hpp:5
horizon::EditorWindowStore
Definition: editor_window.hpp:10
horizon::Pool
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:21
horizon::PoolParametric
Definition: pool_parametric.hpp:10