3 * ***** BEGIN GPL 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.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20 * All rights reserved.
22 * The Original Code is: all of this file.
24 * Contributor(s): none yet.
26 * ***** END GPL LICENSE BLOCK *****
29 * @file GHOST_IWindow.h
30 * Declaration of GHOST_IWindow interface class.
33 #ifndef _GHOST_IWINDOW_H_
34 #define _GHOST_IWINDOW_H_
36 #include "STR_String.h"
37 #include "GHOST_Rect.h"
38 #include "GHOST_Types.h"
42 * Interface for GHOST windows.
44 * You can create a window with the system's GHOST_ISystem::createWindow
46 * @see GHOST_ISystem#createWindow
48 * There are two coordinate systems:
50 * <li>The screen coordinate system. The origin of the screen is located in the
51 * upper left corner of the screen.</li>
52 * <li>The client rectangle coordinate system. The client rectangle of a window
53 * is the area that is drawable by the application (excluding title bars etc.).
56 * @author Maarten Gribnau
65 virtual ~GHOST_IWindow()
70 * Returns indication as to whether the window is valid.
71 * @return The validity of the window.
73 virtual bool getValid() const = 0;
76 * Returns the type of drawing context used in this window.
77 * @return The current type of drawing context.
79 virtual GHOST_TDrawingContextType getDrawingContextType() = 0;
82 * Tries to install a rendering context in this window.
83 * @param type The type of rendering context installed.
84 * @return Indication as to whether installation has succeeded.
86 virtual GHOST_TSuccess setDrawingContextType(GHOST_TDrawingContextType type) = 0;
89 * Sets the title displayed in the title bar.
90 * @param title The title to display in the title bar.
92 virtual void setTitle(const STR_String& title) = 0;
95 * Returns the title displayed in the title bar.
96 * @param title The title displayed in the title bar.
98 virtual void getTitle(STR_String& title) const = 0;
101 * Returns the window rectangle dimensions.
102 * These are screen coordinates.
103 * @param bounds The bounding rectangle of the window.
105 virtual void getWindowBounds(GHOST_Rect& bounds) const = 0;
108 * Returns the client rectangle dimensions.
109 * The left and top members of the rectangle are always zero.
110 * @param bounds The bounding rectangle of the client area of the window.
112 virtual void getClientBounds(GHOST_Rect& bounds) const = 0;
115 * Resizes client rectangle width.
116 * @param width The new width of the client area of the window.
118 virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
121 * Resizes client rectangle height.
122 * @param height The new height of the client area of the window.
124 virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
127 * Resizes client rectangle.
128 * @param width The new width of the client area of the window.
129 * @param height The new height of the client area of the window.
131 virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
134 * Converts a point in screen coordinates to client rectangle coordinates
135 * @param inX The x-coordinate on the screen.
136 * @param inY The y-coordinate on the screen.
137 * @param outX The x-coordinate in the client rectangle.
138 * @param outY The y-coordinate in the client rectangle.
140 virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
143 * Converts a point in screen coordinates to client rectangle coordinates
144 * @param inX The x-coordinate in the client rectangle.
145 * @param inY The y-coordinate in the client rectangle.
146 * @param outX The x-coordinate on the screen.
147 * @param outY The y-coordinate on the screen.
149 virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
152 * Returns the state of the window (normal, minimized, maximized).
153 * @return The state of the window.
155 virtual GHOST_TWindowState getState() const = 0;
158 * Sets the state of the window (normal, minimized, maximized).
159 * @param state The state of the window.
160 * @return Indication of success.
162 virtual GHOST_TSuccess setState(GHOST_TWindowState state) = 0;
165 * Sets the order of the window (bottom, top).
166 * @param order The order of the window.
167 * @return Indication of success.
169 virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0;
172 * Swaps front and back buffers of a window.
173 * @return A boolean success indicator.
175 virtual GHOST_TSuccess swapBuffers() = 0;
178 * Activates the drawing context of this window.
179 * @return A boolean success indicator.
181 virtual GHOST_TSuccess activateDrawingContext() = 0;
184 * Invalidates the contents of this window.
185 * @return Indication of success.
187 virtual GHOST_TSuccess invalidate() = 0;
190 * Returns the window user data.
191 * @return The window user data.
193 virtual GHOST_TUserDataPtr getUserData() const = 0;
196 * Changes the window user data.
197 * @param data The window user data.
199 virtual void setUserData(const GHOST_TUserDataPtr userData) = 0;
202 * Returns the tablet data (pressure etc).
203 * @return The tablet data (pressure etc).
205 virtual const GHOST_TabletData* GetTabletData() = 0;
207 /***************************************************************************************
208 ** Cursor management functionality
209 ***************************************************************************************/
212 * Returns the current cursor shape.
213 * @return The current cursor shape.
215 virtual GHOST_TStandardCursor getCursorShape() const = 0;
218 * Set the shape of the cursor.
219 * @param cursor The new cursor shape type id.
220 * @return Indication of success.
222 virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursorShape) = 0;
225 * Set the shape of the cursor to a custom cursor.
226 * @param bitmap The bitmap data for the cursor.
227 * @param mask The mask data for the cursor.
228 * @param hotX The X coordinate of the cursor hotspot.
229 * @param hotY The Y coordinate of the cursor hotspot.
230 * @return Indication of success.
232 virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
233 GHOST_TUns8 mask[16][2],
237 virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
239 int sizex, int sizey,
241 int fg_color, int bg_color) = 0;
244 * Returns the visibility state of the cursor.
245 * @return The visibility state of the cursor.
247 virtual bool getCursorVisibility() const = 0;
250 * Shows or hides the cursor.
251 * @param visible The new visibility state of the cursor.
252 * @return Indication of success.
254 virtual GHOST_TSuccess setCursorVisibility(bool visible) = 0;
257 * Grabs the cursor for a modal operation.
258 * @param grab The new grab state of the cursor.
259 * @return Indication of success.
261 virtual GHOST_TSuccess setCursorGrab(bool grab) { return GHOST_kSuccess; };
265 #endif // _GHOST_IWINDOW_H_