ClanLib  2.3.7
gui_manager.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 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 
33 
34 #pragma once
35 
36 #include "api_gui.h"
37 #include "../Core/System/sharedptr.h"
38 #include "../Core/System/weakptr.h"
39 #include "../Core/Signals/callback_0.h"
40 #include "../Core/Signals/callback_1.h"
41 #include "../Core/Signals/callback_2.h"
42 #include "../Core/Signals/signal_v1.h"
43 #include "../Core/Math/point.h"
44 #include "accelerator_table.h"
45 
46 class CL_Size;
47 class CL_Rect;
48 class CL_CSSDocument;
49 class CL_CSSLayout;
50 class CL_GUIComponent;
51 class CL_GUIMessage;
52 class CL_GUITheme;
54 class CL_GUIManager_Impl;
55 class CL_Font;
56 class CL_FontDescription;
58 class CL_DisplayWindow;
59 class CL_ResourceManager;
60 
65 {
68 public:
72  CL_GUIManager();
73 
79  CL_GUIManager(const CL_DisplayWindow &display_window);
80 
84  CL_GUIManager(const CL_String &path_to_theme);
85 
90  CL_GUIManager(const CL_DisplayWindow &display_window, const CL_String &path_to_theme);
91 
96  CL_GUIManager(CL_GUIWindowManager &window_manager, const CL_String &path_to_theme);
97 
101  CL_GUIManager(CL_SharedPtr<CL_GUIManager_Impl> impl);
102 
103  virtual ~CL_GUIManager();
104 
108 public:
110  bool is_gui_manager() const { return true; }
111 
113  CL_GUITheme get_theme() const;
114 
116  CL_CSSDocument get_css_document() const;
117 
119  CL_GUIWindowManager get_window_manager() const;
120 
122  CL_GUIComponent *get_capture_component() const;
123 
125  CL_GUIComponent *get_focused_component();
126 
128  bool get_exit_flag() const;
129 
131  int get_exit_code() const;
132 
134  CL_Font get_registered_font(const CL_FontDescription &desc);
135 
139  CL_String get_clipboard_text() const;
140 
144 public:
146  CL_Signal_v1<CL_GUIMessage &> &sig_filter_message();
147 
149  CL_Callback_0<int> &func_exec_handler();
150 
154 public:
157  void add_theme(const CL_String &path_to_theme);
158 
160  void set_theme(CL_GUITheme &theme);
161 
163  void set_css_document(CL_CSSDocument css);
164 
166  void set_css_document(const CL_String &fullname);
167 
172  void set_css_document(const CL_String &filename, const CL_VirtualDirectory &directory);
173 
175  void add_resources(const CL_ResourceManager &resources);
176 
178  void add_resources(const CL_String &filename);
179 
181  void add_resources(const CL_String &filename, const CL_VirtualDirectory &directory);
182 
184  void initialize_layout_manager(const CL_String &xml_fullname, const CL_String &css_fullname);
185 
187  void set_window_manager(CL_GUIWindowManager &window_manager);
188 
190  int exec();
191 
195  void process_messages(int timeout);
196 
198  void dispatch_message(CL_GUIMessage message);
199 
201  void exit_with_code(int exit_code);
202 
204  void clear_exit_flag();
205 
207  void set_capture_component(CL_GUIComponent *component, bool state);
208 
210  void request_repaint(const CL_Rect &rect, CL_GUIComponent *root_component);
211 
213  void register_font(const CL_Font &font, const CL_FontDescription &desc);
214 
216  void render_windows();
217 
219  void set_clipboard_text(const CL_StringRef &str);
220 
222  void set_tablet_proximity_component(CL_GUIComponent *, bool state);
223 
225  void set_accelerator_table(const CL_AcceleratorTable &table);
226 
228  CL_CSSLayout create_layout(CL_GUIComponent *component);
229 
231  bool has_layout(CL_GUIComponent *component);
232 
236 private:
237  void initialize(CL_GUIWindowManager &window_manager, const CL_String & path_to_theme);
238 
239  CL_SharedPtr<CL_GUIManager_Impl> impl;
240 
241  friend class CL_GUIComponent_Impl;
242  friend class CL_GUIThemePart;
243  friend class CL_GUIThemePart_Impl;
245 };
246