00001 /* 00002 ** ClanLib SDK 00003 ** Copyright (c) 1997-2009 The ClanLib Team 00004 ** 00005 ** This software is provided 'as-is', without any express or implied 00006 ** warranty. In no event will the authors be held liable for any damages 00007 ** arising from the use of this software. 00008 ** 00009 ** Permission is granted to anyone to use this software for any purpose, 00010 ** including commercial applications, and to alter it and redistribute it 00011 ** freely, subject to the following restrictions: 00012 ** 00013 ** 1. The origin of this software must not be misrepresented; you must not 00014 ** claim that you wrote the original software. If you use this software 00015 ** in a product, an acknowledgment in the product documentation would be 00016 ** appreciated but is not required. 00017 ** 2. Altered source versions must be plainly marked as such, and must not be 00018 ** misrepresented as being the original software. 00019 ** 3. This notice may not be removed or altered from any source distribution. 00020 ** 00021 ** Note: Some of the libraries ClanLib may link to may have additional 00022 ** requirements or restrictions. 00023 ** 00024 ** File Author(s): 00025 ** 00026 ** Magnus Norddahl 00027 ** Harry Storbacka 00028 */ 00029 00032 00033 #pragma once 00034 00035 #include "api_gui.h" 00036 #include "../Core/System/sharedptr.h" 00037 #include "../Core/System/weakptr.h" 00038 #include "../Core/Signals/callback_1.h" 00039 #include "../Core/Signals/callback_2.h" 00040 #include "../Core/Signals/signal_v1.h" 00041 #include "../Core/Math/point.h" 00042 #include "accelerator_table.h" 00043 00044 class CL_Size; 00045 class CL_Rect; 00046 class CL_CSSDocument; 00047 class CL_GUIComponent; 00048 class CL_GUIMessage; 00049 class CL_GUITheme; 00050 class CL_GUIWindowManager; 00051 class CL_GUIManager_Impl; 00052 class CL_Font; 00053 class CL_FontDescription; 00054 class CL_VirtualDirectory; 00055 00059 class CL_API_GUI CL_GUIManager 00060 { 00063 00064 public: 00065 CL_GUIManager(); 00066 00070 CL_GUIManager(CL_SharedPtr<CL_GUIManager_Impl> impl); 00071 00072 virtual ~CL_GUIManager(); 00073 00077 00078 public: 00080 bool is_gui_manager() const { return true; } 00081 00083 CL_GUITheme get_theme() const; 00084 00086 CL_CSSDocument get_css_document() const; 00087 00089 CL_GUIWindowManager get_window_manager() const; 00090 00092 CL_GUIComponent *get_capture_component() const; 00093 00095 CL_GUIComponent *get_focused_component(); 00096 00098 bool get_exit_flag() const; 00099 00101 int get_exit_code() const; 00102 00104 CL_UnknownSharedPtr get_userdata(); 00105 00107 CL_Font get_registered_font(const CL_FontDescription &desc); 00108 00112 CL_String get_clipboard_text() const; 00113 00117 public: 00119 CL_Signal_v1<CL_GUIMessage &> &sig_filter_message(); 00120 00122 CL_Callback_1<int, bool> &func_exec_handler(); 00123 00127 public: 00129 void set_theme(CL_GUITheme &theme); 00130 00132 void set_css_document(CL_CSSDocument css); 00133 00135 void set_css_document(const CL_String &fullname); 00136 00141 void set_css_document(const CL_String &filename, const CL_VirtualDirectory &directory); 00142 00144 void set_window_manager(CL_GUIWindowManager &window_manager); 00145 00147 int exec(bool loop_until_complete = true); 00148 00152 void process_messages(int timeout); 00153 00155 void dispatch_message(CL_GUIMessage message); 00156 00158 void exit_with_code(int exit_code); 00159 00161 void clear_exit_flag(); 00162 00164 void set_capture_component(CL_GUIComponent *component, bool state); 00165 00167 void request_repaint(const CL_Rect &rect, CL_GUIComponent *root_component); 00168 00170 void set_userdata(CL_UnknownSharedPtr ptr); 00171 00173 void register_font(const CL_Font &font, const CL_FontDescription &desc); 00174 00176 void render_windows(); 00177 00179 void set_clipboard_text(const CL_StringRef &str); 00180 00182 void set_tablet_proximity_component(CL_GUIComponent *, bool state); 00183 00185 void set_accelerator_table(const CL_AcceleratorTable &table); 00186 00190 private: 00191 CL_SharedPtr<CL_GUIManager_Impl> impl; 00192 00193 friend class CL_GUIComponent_Impl; 00194 friend class CL_GUIThemePart; 00195 friend class CL_GUIThemePart_Impl; 00197 }; 00198
1.4.6