display_window_provider.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 **    Kenneth Gangstoe
00029 */
00030 
00033 
00034 #pragma once
00035 
00036 #include "../api_display.h"
00037 #include "../../Core/System/sharedptr.h"
00038 #include "../../Core/System/weakptr.h"
00039 #include "../../Core/Text/string_types.h"
00040 #include "../../Core/Signals/signal_v0.h"
00041 #include "../../Core/Signals/signal_v1.h"
00042 #include "../../Core/Signals/signal_v2.h"
00043 #include "../../Core/Signals/callback_v1.h"
00044 #include "../Window/display_window.h"
00045 
00046 #if !defined(WIN32) && !defined(__APPLE__)
00047 #include <X11/Xlib.h>
00048 #endif
00049 
00050 class CL_Point;
00051 class CL_DisplayWindowDescription;
00052 class CL_GraphicContext;
00053 class CL_InputContext;
00054 class CL_CursorProvider;
00055 class CL_SpriteDescription;
00056 
00060 class CL_API_DISPLAY CL_DisplayWindowSite
00061 {
00064 public:
00066         CL_Signal_v0 *sig_lost_focus;
00067 
00069         CL_Signal_v0 *sig_got_focus;
00070 
00072         CL_Signal_v2<int, int> *sig_resize;
00073 
00075         CL_Signal_v1<const CL_Rect &> *sig_paint;
00076 
00078         CL_Signal_v0 *sig_window_close;
00079 
00081         CL_Signal_v0 *sig_window_destroy;
00082 
00084         CL_Signal_v0 *sig_window_minimized;
00085 
00087         CL_Signal_v0 *sig_window_maximized;
00088 
00090         CL_Signal_v0 *sig_window_restored;
00091 
00093         CL_Callback_v1<CL_Rect &> *func_window_resize;
00094 
00096         CL_Callback_0<bool> *func_minimize_clicked;
00097 
00099         CL_Signal_v0 *sig_window_moved;
00101 };
00102 
00106 class CL_API_DISPLAY CL_DisplayWindowProvider
00107 {
00110 public:
00111         virtual ~CL_DisplayWindowProvider() { return; }
00112 
00116 public:
00118         virtual CL_Rect get_geometry() const = 0;
00119 
00121         virtual CL_Rect get_viewport() const = 0;
00122 
00124         virtual bool has_focus() const = 0;
00125 
00127         virtual bool is_minimized() const = 0;
00128 
00130         virtual bool is_maximized() const = 0;
00131 
00133         virtual bool is_visible() const = 0;
00134 
00136         virtual bool is_fullscreen() const = 0;
00137 
00139         virtual CL_Size get_minimum_size(bool client_area) const = 0;
00140 
00142         virtual CL_Size get_maximum_size(bool client_area) const = 0;
00143 
00145         virtual CL_String get_title() const = 0;
00146 
00148         virtual CL_GraphicContext& get_gc() = 0;
00149 
00151         virtual CL_InputContext& get_ic() = 0;
00152 
00153 #ifdef WIN32
00154 
00158         virtual HWND get_hwnd() const = 0;
00159 #elif defined(__APPLE__)
00160         // nothing
00161 #else
00162 
00163         virtual Display *get_display() const = 0;
00164 
00166         virtual Window get_window() const = 0;
00167 #endif
00168 
00170         virtual bool is_clipboard_text_available() const = 0;
00171 
00173         virtual bool is_clipboard_image_available() const = 0;
00174 
00176         virtual CL_String get_clipboard_text() const = 0;
00177 
00179         virtual CL_PixelBuffer get_clipboard_image() const = 0;
00180 
00184 public:
00186         virtual CL_Point client_to_screen(const CL_Point &client) = 0;
00187 
00189         virtual CL_Point screen_to_client(const CL_Point &screen) = 0;
00190 
00192         virtual void capture_mouse(bool capture) = 0;
00193 
00195         virtual void request_repaint(const CL_Rect &rect) = 0;
00196 
00198         virtual void destroy() = 0;
00199 
00201         virtual void create(CL_DisplayWindowSite *site, const CL_DisplayWindowDescription &description) = 0;
00202 
00204         virtual void show_system_cursor() = 0;
00205 
00207         virtual CL_CursorProvider *create_cursor(const CL_SpriteDescription &sprite_description, const CL_Point &hotspot) = 0;
00208 
00210         virtual void set_cursor(CL_CursorProvider *cursor) = 0;
00211 
00213         virtual void set_cursor(enum CL_StandardCursor type) = 0;
00214 
00216         virtual void hide_system_cursor() = 0;
00217 
00219         virtual void set_title(const CL_StringRef &new_title) = 0;
00220 
00222         virtual void set_position(const CL_Rect &pos, bool client_area) = 0;
00223 
00229         virtual void set_size(int width, int height, bool client_area) = 0;
00230 
00236         virtual void set_minimum_size(int width, int height, bool client_area) = 0;
00237 
00243         virtual void set_maximum_size(int width, int height, bool client_area) = 0;
00244 
00246         virtual void set_enabled(bool enable) = 0;
00247 
00249         virtual void minimize() = 0;
00250 
00252         virtual void restore() = 0;
00253 
00255         virtual void maximize() = 0;
00256 
00258         virtual void show(bool activate) = 0;
00259 
00261         virtual void hide() = 0;
00262 
00264         virtual void bring_to_front() = 0;
00265 
00267         virtual void flip(int interval) = 0;
00268 
00270         virtual void update(const CL_Rect &rect) = 0;
00271 
00273         virtual void set_clipboard_text(const CL_StringRef &text) = 0;
00274 
00276         virtual void set_clipboard_image(const CL_PixelBuffer &buf) = 0;
00277 
00279         virtual void set_large_icon(const CL_PixelBuffer &image) = 0;
00280 
00282         virtual void set_small_icon(const CL_PixelBuffer &image) = 0;
00283 
00287 private:
00289 };
00290