gui_window_manager.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 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 **    Mark Page
00029 */
00030 
00033 
00034 #pragma once
00035 
00036 #include "api_gui.h"
00037 #include "gui_component.h"
00038 #include "../Core/Signals/signal_v1.h"
00039 #include "../Core/Signals/signal_v2.h"
00040 #include "../Core/Signals/signal_v3.h"
00041 #include <vector>
00042 
00043 class CL_GraphicContext;
00044 class CL_InputEvent;
00045 class CL_InputState;
00046 class CL_Cursor;
00047 class CL_DisplayWindow;
00048 class CL_GUITopLevelWindow;
00049 class CL_GUIWindowManagerProvider;
00050 class CL_GUIWindowManager_Impl;
00051 
00055 class CL_API_DISPLAY CL_GUIWindowManagerSite
00056 {
00059 
00060 public:
00062         CL_Callback_v1<CL_GUITopLevelWindow *> *func_focus_lost;
00063 
00065         CL_Callback_v1<CL_GUITopLevelWindow *> *func_focus_gained;
00066 
00068         CL_Callback_v2<CL_GUITopLevelWindow *, const CL_Size &> *func_resize;
00069 
00071         CL_Callback_v2<CL_GUITopLevelWindow *, const CL_Rect &> *func_paint;
00072 
00074         CL_Callback_v1<CL_GUITopLevelWindow *> *func_close;
00075 
00077         CL_Callback_v1<CL_GUITopLevelWindow *> *func_destroy;
00078 
00080         CL_Callback_v3<CL_GUITopLevelWindow *, const CL_InputEvent &, const CL_InputState &> *func_input_received;
00082 };
00083 
00087 class CL_API_GUI CL_GUIWindowManager
00088 {
00091 
00092 public:
00093         enum CL_WindowManagerType
00094         {
00095                 cl_wm_type_system,
00096                 cl_wm_type_texture
00097         };
00099 
00102 public:
00103 
00105         CL_GUIWindowManager();
00106 
00110         CL_GUIWindowManager(CL_GUIWindowManagerProvider *provider);
00111 
00113         CL_GUIWindowManager(const CL_GUIWindowManager &src);
00114 
00115         ~CL_GUIWindowManager();
00116 
00118 
00121 public:
00122 
00126         bool is_null() const;
00127 
00129         CL_GUIWindowManagerProvider *get_provider() const;
00130 
00134         CL_WindowManagerType get_window_manager_type() const;
00135 
00139 public:
00140 
00144         void set_site(CL_GUIWindowManagerSite *site);
00145         void create_window(
00146                 CL_GUITopLevelWindow *handle,
00147                 CL_GUITopLevelWindow *owner,
00148                 CL_GUIComponent *component,
00149                 CL_GUITopLevelDescription description);
00150 
00154         void destroy_window(CL_GUITopLevelWindow *handle);
00155 
00160         void enable_window(CL_GUITopLevelWindow *handle, bool enable);
00161 
00167         bool has_focus(CL_GUITopLevelWindow *handle) const;
00168 
00174         void set_visible(CL_GUITopLevelWindow *handle, bool visible, bool activate_root_win);
00175 
00181         void set_geometry(CL_GUITopLevelWindow *handle, const CL_Rect &geometry, bool client_area);
00182 
00189         CL_Rect get_geometry(CL_GUITopLevelWindow *handle, bool client_area) const;
00190 
00198         CL_Point screen_to_window(CL_GUITopLevelWindow *handle, const CL_Point &screen_point, bool client_area) const;
00199 
00207         CL_Point window_to_screen(CL_GUITopLevelWindow *handle, const CL_Point &window_point, bool client_area) const;
00208 
00214         CL_GraphicContext& get_gc(CL_GUITopLevelWindow *handle) const;
00215 
00221         CL_InputContext& get_ic(CL_GUITopLevelWindow *handle) const;
00222 
00229         CL_GraphicContext begin_paint(CL_GUITopLevelWindow *handle, const CL_Rect &update_region);
00230 
00236         void set_cliprect(CL_GUITopLevelWindow *handle, CL_GraphicContext &gc, const CL_Rect &rect);
00237 
00242         void reset_cliprect(CL_GUITopLevelWindow *handle, CL_GraphicContext &gc);
00243 
00249         void push_cliprect(CL_GUITopLevelWindow *handle, CL_GraphicContext &gc, const CL_Rect &rect);
00250 
00255         void pop_cliprect(CL_GUITopLevelWindow *handle, CL_GraphicContext &gc);
00256 
00261         void end_paint(CL_GUITopLevelWindow *handle, const CL_Rect &update_region);
00262 
00267         void request_repaint(CL_GUITopLevelWindow *handle, const CL_Rect &update_region);
00268 
00272         void bring_to_front(CL_GUITopLevelWindow *handle);
00273 
00279         bool is_minimized(CL_GUITopLevelWindow *handle) const;
00280 
00286         bool is_maximized(CL_GUITopLevelWindow *handle) const;
00287 
00289         void process_message();
00290 
00295         void capture_mouse(CL_GUITopLevelWindow *handle, bool state);
00296 
00302         CL_DisplayWindow get_display_window(CL_GUITopLevelWindow *handle) const;
00303 
00308         void set_cursor(CL_GUITopLevelWindow *handle, const CL_Cursor &cursor);
00309 
00314         void set_cursor(CL_GUITopLevelWindow *handle, enum CL_StandardCursor type);
00315 
00319         void update();
00320 
00322         void setup_painting();
00323 
00325         void complete_painting();
00326 
00330 
00331 private:
00332         CL_SharedPtr<CL_GUIWindowManager_Impl> impl;
00334 };
00335