display_window.h

Go to the documentation of this file.
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 **    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/Signals/signal_v0.h"
00040 #include "../../Core/Signals/signal_v1.h"
00041 #include "../../Core/Signals/signal_v2.h"
00042 #include "../../Core/Signals/callback_v1.h"
00043 #include "../../Core/Text/string_types.h"
00044 #include "../display_target.h"
00045 
00046 class CL_Size;
00047 class CL_Rect;
00048 class CL_Display;
00049 class CL_GraphicContext;
00050 class CL_DisplayWindowMode;
00051 class CL_DisplayWindowDescription;
00052 class CL_InputContext;
00053 class CL_Point;
00054 class CL_Cursor;
00055 class CL_DisplayWindowProvider;
00056 class CL_DisplayWindow_Impl;
00057 class CL_PixelBuffer;
00058 
00062 enum CL_StandardCursor
00063 {
00064         cl_cursor_arrow,
00065         cl_cursor_appstarting,
00066         cl_cursor_cross,
00067         cl_cursor_hand,
00068         cl_cursor_ibeam,
00069         cl_cursor_no,
00070         cl_cursor_size_all,
00071         cl_cursor_size_nesw,
00072         cl_cursor_size_ns,
00073         cl_cursor_size_nwse,
00074         cl_cursor_size_we,
00075         cl_cursor_uparrow,
00076         cl_cursor_wait
00077 };
00078 
00082 class CL_API_DISPLAY CL_DisplayWindow
00083 {
00086 public:
00088         CL_DisplayWindow();
00089 
00099         CL_DisplayWindow(
00100                 const CL_StringRef &title,
00101                 int width,
00102                 int height,
00103                 bool start_fullscreen = false,
00104                 bool allow_resize = false,
00105                 int flipping_buffers = 2,
00106                 CL_DisplayTarget target = CL_DisplayTarget());
00107 
00112         CL_DisplayWindow(
00113                 const CL_DisplayWindowDescription &description,
00114                 CL_DisplayTarget target = CL_DisplayTarget());
00115 
00119         CL_DisplayWindow(CL_DisplayWindowProvider *provider);
00120 
00121         ~CL_DisplayWindow();
00122 
00126 public:
00128         CL_Rect get_geometry() const;
00129 
00131         CL_Rect get_viewport() const;
00132 
00134         bool is_fullscreen() const;
00135 
00137         bool has_focus() const;
00138 
00140         CL_GraphicContext& get_gc() const;
00141 
00143         CL_InputContext& get_ic() const;
00144 
00146         CL_Signal_v0 &sig_lost_focus();
00147 
00149         CL_Signal_v0 &sig_got_focus();
00150 
00152         CL_Signal_v2<int, int> &sig_resize();
00153 
00155         CL_Signal_v1<const CL_Rect &> &sig_paint();
00156 
00158         CL_Signal_v0 &sig_window_close();
00159 
00161         CL_Signal_v0 &sig_window_minimized();
00162 
00164         CL_Signal_v0 &sig_window_maximized();
00165 
00167         CL_Callback_v1<CL_Rect &> &func_window_resize();
00168 
00170         bool is_null() const;
00171 
00173         bool is_visible() const;
00174 
00176         bool is_minimized() const;
00177 
00179         bool is_maximized() const;
00180 
00182         CL_DisplayWindowProvider *get_provider() const;
00183 
00185         bool is_clipboard_text_available() const;
00186 
00188         bool is_clipboard_image_available() const;
00189 
00191         CL_String get_clipboard_text() const;
00192 
00195         CL_PixelBuffer get_clipboard_image() const;
00196 
00197 #ifdef WIN32
00198 
00202         HWND get_hwnd() const;
00203 #endif
00204 
00208 public:
00210         CL_Point client_to_screen(const CL_Point &client);
00211 
00213         CL_Point screen_to_client(const CL_Point &screen);
00214 
00216         void capture_mouse(bool capture);
00217 
00219         void request_repaint(const CL_Rect &rect);
00220 
00222         void set_title(const CL_StringRef &title);
00223 
00228         void set_position(const CL_Rect &pos, bool client_area);
00229 
00234         void set_position(int x, int y);
00235 
00239         void set_enabled(bool enable);
00240 
00245         void set_visible(bool visible, bool activate);
00246 
00252         void set_size(int width, int height, bool client_area);
00253 
00255         void set_minimum_size(int width, int height, bool client_area);
00256 
00258         void set_maximum_size(int width, int height, bool client_area);
00259 
00261         void minimize();
00262 
00264         void restore();
00265 
00267         void maximize();
00268 
00270         void show(bool activate = true);
00271 
00273         void hide();
00274 
00276         void bring_to_front();
00277 
00281         void update(const CL_Rect &rect);
00282 
00294         void flip(int interval = -1);
00295 
00297         void show_cursor();
00298 
00300         void set_cursor(const CL_Cursor &cursor);
00301 
00305         void set_cursor(CL_StandardCursor type);
00306 
00308         void hide_cursor();
00309 
00311         void set_clipboard_text(const CL_StringRef &text);
00312 
00314         void set_clipboard_image(const CL_PixelBuffer &buf);
00315 
00317         void set_large_icon(const CL_PixelBuffer &image);
00318 
00320         void set_small_icon(const CL_PixelBuffer &image);
00321 
00325 private:
00326         CL_SharedPtr<CL_DisplayWindow_Impl> impl;
00327 
00329 };
00330 

Generated on Thu Dec 3 02:39:28 2009 for ClanLib by  doxygen 1.4.6