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 *****
32 * @file GHOST_IWindow.h
33 * Declaration of GHOST_IWindow interface class.
36 #ifndef _GHOST_IWINDOW_H_
37 #define _GHOST_IWINDOW_H_
39 #include "STR_String.h"
40 #include "GHOST_Rect.h"
41 #include "GHOST_Types.h"
45 * Interface for GHOST windows.
47 * You can create a window with the system's GHOST_ISystem::createWindow
49 * @see GHOST_ISystem#createWindow
51 * There are two coordinate systems:
53 * <li>The screen coordinate system. The origin of the screen is located in the
54 * upper left corner of the screen.</li>
55 * <li>The client rectangle coordinate system. The client rectangle of a window
56 * is the area that is drawable by the application (excluding title bars etc.).
59 * @author Maarten Gribnau
68 virtual ~GHOST_IWindow()
73 * Returns indication as to whether the window is valid.
74 * @return The validity of the window.
76 virtual bool getValid() const = 0;
79 * Returns the type of drawing context used in this window.
80 * @return The current type of drawing context.
82 virtual GHOST_TDrawingContextType getDrawingContextType() = 0;
85 * Tries to install a rendering context in this window.
86 * @param type The type of rendering context installed.
87 * @return Indication as to whether installation has succeeded.
89 virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) = 0;
92 * Sets the title displayed in the title bar.
93 * @param title The title to display in the title bar.
95 virtual void setTitle(const STR_String& title) = 0;
98 * Returns the title displayed in the title bar.
99 * @param title The title displayed in the title bar.
101 virtual void getTitle(STR_String& title) const = 0;
104 * Returns the window rectangle dimensions.
105 * These are screen coordinates.
106 * @param bounds The bounding rectangle of the window.
108 virtual void getWindowBounds(GHOST_Rect& bounds) const = 0;
111 * Returns the client rectangle dimensions.
112 * The left and top members of the rectangle are always zero.
113 * @param bounds The bounding rectangle of the client area of the window.
115 virtual void getClientBounds(GHOST_Rect& bounds) const = 0;
118 * Resizes client rectangle width.
119 * @param width The new width of the client area of the window.
121 virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
124 * Resizes client rectangle height.
125 * @param height The new height of the client area of the window.
127 virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
130 * Resizes client rectangle.
131 * @param width The new width of the client area of the window.
132 * @param height The new height of the client area of the window.
134 virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
137 * Converts a point in screen coordinates to client rectangle coordinates
138 * @param inX The x-coordinate on the screen.
139 * @param inY The y-coordinate on the screen.
140 * @param outX The x-coordinate in the client rectangle.
141 * @param outY The y-coordinate in the client rectangle.
143 virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
146 * Converts a point in screen coordinates to client rectangle coordinates
147 * @param inX The x-coordinate in the client rectangle.
148 * @param inY The y-coordinate in the client rectangle.
149 * @param outX The x-coordinate on the screen.
150 * @param outY The y-coordinate on the screen.
152 virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
155 * Returns the state of the window (normal, minimized, maximized).
156 * @return The state of the window.
158 virtual GHOST_TWindowState getState() const = 0;
161 * Sets the state of the window (normal, minimized, maximized).
162 * @param state The state of the window.
163 * @return Indication of success.
165 virtual GHOST_TSuccess setState(GHOST_TWindowState state) = 0;
168 * Sets the order of the window (bottom, top).
169 * @param order The order of the window.
170 * @return Indication of success.
172 virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0;
175 * Swaps front and back buffers of a window.
176 * @return A boolean success indicator.
178 virtual GHOST_TSuccess swapBuffers() = 0;
181 * Activates the drawing context of this window.
182 * @return A boolean success indicator.
184 virtual GHOST_TSuccess activateDrawingContext() = 0;
187 * Invalidates the contents of this window.
188 * @return Indication of success.
190 virtual GHOST_TSuccess invalidate() = 0;
193 * Returns the window user data.
194 * @return The window user data.
196 virtual GHOST_TUserDataPtr getUserData() const = 0;
199 * Changes the window user data.
200 * @param data The window user data.
202 virtual void setUserData(const GHOST_TUserDataPtr userData) = 0;
205 * Returns the tablet data (pressure etc).
206 * @return The tablet data (pressure etc).
208 virtual const GHOST_TabletData* GetTabletData() = 0;
210 /***************************************************************************************
211 ** Cursor management functionality
212 ***************************************************************************************/
215 * Returns the current cursor shape.
216 * @return The current cursor shape.
218 virtual GHOST_TStandardCursor getCursorShape() const = 0;
221 * Set the shape of the cursor.
222 * @param cursor The new cursor shape type id.
223 * @return Indication of success.
225 virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape) = 0;
228 * Set the shape of the cursor to a custom cursor.
229 * @param bitmap The bitmap data for the cursor.
230 * @param mask The mask data for the cursor.
231 * @param hotX The X coordinate of the cursor hotspot.
232 * @param hotY The Y coordinate of the cursor hotspot.
233 * @return Indication of success.
235 virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
236 GHOST_TUns8 mask[16][2],
240 virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
242 int sizex, int sizey,
244 int fg_color, int bg_color) = 0;
247 * Returns the visibility state of the cursor.
248 * @return The visibility state of the cursor.
250 virtual bool getCursorVisibility() const = 0;
253 * Shows or hides the cursor.
254 * @param visible The new visibility state of the cursor.
255 * @return Indication of success.
257 virtual GHOST_TSuccess setCursorVisibility(bool visible) = 0;
260 #endif // _GHOST_IWINDOW_H_