3 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version. The Blender
9 * Foundation also sells licenses for use in proprietary software under
10 * the Blender License. See http://www.blender.org/BL/ for information
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL/BL DUAL LICENSE BLOCK *****
35 * Copyright (C) 2001 NaN Technologies B.V.
36 * @author Maarten Gribnau
40 #ifndef _GHOST_IWINDOW_H_
41 #define _GHOST_IWINDOW_H_
43 #include "STR_String.h"
44 #include "GHOST_Rect.h"
45 #include "GHOST_Types.h"
49 * Interface for GHOST windows.
50 * Dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
51 * @author Maarten Gribnau
61 virtual ~GHOST_IWindow()
66 * Returns indication as to whether the window is valid.
67 * @return The validity of the window.
69 virtual bool getValid() const = 0;
72 * Returns the type of drawing context used in this window.
73 * @return The current type of drawing context.
75 inline virtual GHOST_TDrawingContextType getDrawingContextType() = 0;
78 * Tries to install a rendering context in this window.
79 * @param type The type of rendering context installed.
80 * @return Indication as to whether installation has succeeded.
82 virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) = 0;
85 * Sets the title displayed in the title bar.
86 * @param title The title to display in the title bar.
88 virtual void setTitle(const STR_String& title) = 0;
91 * Returns the title displayed in the title bar.
92 * @param title The title displayed in the title bar.
94 virtual void getTitle(STR_String& title) const = 0;
97 * Returns the window rectangle dimensions.
98 * These are screen coordinates.
99 * @param bounds The bounding rectangle of the window.
101 virtual void getWindowBounds(GHOST_Rect& bounds) const = 0;
104 * Returns the client rectangle dimensions.
105 * The left and top members of the rectangle are always zero.
106 * @param bounds The bounding rectangle of the client area of the window.
108 virtual void getClientBounds(GHOST_Rect& bounds) const = 0;
111 * Resizes client rectangle width.
112 * @param width The new width of the client area of the window.
114 virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
117 * Resizes client rectangle height.
118 * @param height The new height of the client area of the window.
120 virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
123 * Resizes client rectangle.
124 * @param width The new width of the client area of the window.
125 * @param height The new height of the client area of the window.
127 virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
130 * Converts a point in screen coordinates to client rectangle coordinates
131 * @param inX The x-coordinate on the screen.
132 * @param inY The y-coordinate on the screen.
133 * @param outX The x-coordinate in the client rectangle.
134 * @param outY The y-coordinate in the client rectangle.
136 virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
139 * Converts a point in screen coordinates to client rectangle coordinates
140 * @param inX The x-coordinate in the client rectangle.
141 * @param inY The y-coordinate in the client rectangle.
142 * @param outX The x-coordinate on the screen.
143 * @param outY The y-coordinate on the screen.
145 virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
148 * Returns the state of the window (normal, minimized, maximized).
149 * @return The state of the window.
151 virtual GHOST_TWindowState getState() const = 0;
154 * Sets the state of the window (normal, minimized, maximized).
155 * @param state The state of the window.
156 * @return Indication of success.
158 virtual GHOST_TSuccess setState(GHOST_TWindowState state) = 0;
161 * Sets the order of the window (bottom, top).
162 * @param order The order of the window.
163 * @return Indication of success.
165 virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0;
168 * Swaps front and back buffers of a window.
169 * @return A boolean success indicator.
171 virtual GHOST_TSuccess swapBuffers() = 0;
174 * Activates the drawing context of this window.
175 * @return A boolean success indicator.
177 virtual GHOST_TSuccess activateDrawingContext() = 0;
180 * Invalidates the contents of this window.
181 * @return Indication of success.
183 virtual GHOST_TSuccess invalidate() = 0;
186 * Returns the window user data.
187 * @return The window user data.
189 inline virtual GHOST_TUserDataPtr getUserData() const = 0;
192 * Changes the window user data.
193 * @param data The window user data.
195 virtual void setUserData(const GHOST_TUserDataPtr userData) = 0;
197 /***************************************************************************************
198 ** Cursor management functionality
199 ***************************************************************************************/
202 * Returns the current cursor shape.
203 * @return The current cursor shape.
205 virtual GHOST_TStandardCursor getCursorShape() const = 0;
208 * Set the shape of the cursor.
209 * @param cursor The new cursor shape type id.
210 * @return Indication of success.
212 virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape) = 0;
215 * Set the shape of the cursor to a custom cursor.
216 * @param bitmap The bitmap data for the cursor.
217 * @param mask The mask data for the cursor.
218 * @param hotX The X coordinate of the cursor hotspot.
219 * @param hotY The Y coordinate of the cursor hotspot.
220 * @return Indication of success.
222 virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
223 GHOST_TUns8 mask[16][2],
228 * Returns the visibility state of the cursor.
229 * @return The visibility state of the cursor.
231 virtual bool getCursorVisibility() const = 0;
234 * Shows or hides the cursor.
235 * @param visible The new visibility state of the cursor.
236 * @return Indication of success.
238 virtual GHOST_TSuccess setCursorVisibility(bool visible) = 0;
241 #endif // _GHOST_IWINDOW_H_