gui_manager.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 ** Kenneth Gangstoe
29 */
30 
31 
32 #pragma once
33 
34 #include "api_gui.h"
35 #include "../Core/Signals/callback_0.h"
36 #include "../Core/Signals/callback_1.h"
37 #include "../Core/Signals/callback_2.h"
38 #include "../Core/Signals/signal_v1.h"
39 #include "../Core/Math/point.h"
40 #include "accelerator_table.h"
41 #include <memory>
42 
43 namespace clan
44 {
47 
48 class Size;
49 class Rect;
50 class CSSDocument;
51 class CSSLayout;
52 class GUIComponent;
53 class GUIMessage;
54 class GUIWindowManager;
55 class GUIManager_Impl;
56 class Font;
57 class FontDescription;
58 class FileSystem;
59 class DisplayWindow;
60 class ResourceManager;
61 class XMLResourceDocument;
62 
64 class CL_API_GUI GUIManager
65 {
68 public:
72  GUIManager();
73 
79  GUIManager(const DisplayWindow &display_window);
80 
84  GUIManager(const std::string &path_to_css_and_resources);
85 
90  GUIManager(const DisplayWindow &display_window, const std::string &path_to_css_and_resources);
91 
96  GUIManager(GUIWindowManager &window_manager, const std::string &path_to_css_and_resources);
97 
101  GUIManager(std::shared_ptr<GUIManager_Impl> impl);
102 
103  virtual ~GUIManager();
104 
108 public:
110  ResourceManager get_resource_manager() const;
111 
113  CSSDocument get_css_document() const;
114 
116  GUIWindowManager get_window_manager() const;
117 
119  GUIComponent *get_capture_component() const;
120 
122  GUIComponent *get_focused_component();
123 
125  bool get_exit_flag() const;
126 
128  int get_exit_code() const;
129 
133  std::string get_clipboard_text() const;
134 
138 public:
140  Signal_v1<std::shared_ptr<GUIMessage> &> &sig_filter_message();
141 
143  Callback_0<int> &func_exec_handler();
144 
148 public:
150  void set_resource_manager(ResourceManager &resource_manager);
151 
155  void add_theme(const std::string &fullname);
156 
160  void add_theme(const std::string &fullname, const FileSystem &fs);
161 
163  void set_theme(CSSDocument css);
164 
166  void set_theme(const std::string &fullname);
167 
172  void set_theme(const std::string &filename, const FileSystem &fs);
173 
175  void add_resources(const XMLResourceDocument &resources);
176 
178  void add_resources(const std::string &filename);
179 
181  void add_resources(const std::string &filename, const FileSystem &fs);
182 
184  void set_window_manager(GUIWindowManager &window_manager);
185 
187  int exec();
188 
192  void process_messages(int timeout);
193 
195  void dispatch_message(std::shared_ptr<GUIMessage> message);
196 
198  void exit_with_code(int exit_code);
199 
201  void clear_exit_flag();
202 
204  void set_capture_component(GUIComponent *component, bool state);
205 
207  void request_repaint(const Rect &rect, GUIComponent *root_component);
208 
210  void render_windows();
211 
213  void set_clipboard_text(const std::string &str);
214 
216  void set_tablet_proximity_component(GUIComponent *, bool state);
217 
219  void set_accelerator_table(const AcceleratorTable &table);
220 
224 private:
225  void initialize(GUIWindowManager &window_manager, const std::string & path_to_css_and_resources);
226 
227  std::shared_ptr<GUIManager_Impl> impl;
228 
229  friend class GUIComponent_Impl;
231 };
232 
233 }
234 
Definition: css_document.h:55
Callback_0.
Definition: callback_0.h:156
GUI base component class.
Definition: gui_component.h:81
2D (left,top,right,bottom) rectangle structure - Integer
Definition: rect.h:453
GUI window manager interface.
Definition: gui_window_manager.h:85
Signal_v1.
Definition: signal_v1.h:110
Virtual File System (VFS).
Definition: file_system.h:48
Resource manager.
Definition: resource_manager.h:45
GUI manager.
Definition: gui_manager.h:64
XML Resource Document.
Definition: xml_resource_document.h:49
Top-level window class.
Definition: display_window.h:85
GUI Accelerator Table.
Definition: accelerator_table.h:48