Blender V2.61 - r43446
Public Member Functions | Protected Member Functions | Protected Attributes

GHOST_Window Class Reference

#include <GHOST_Window.h>

Inheritance diagram for GHOST_Window:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 GHOST_Window (GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type=GHOST_kDrawingContextTypeNone, const bool stereoVisual=false, const GHOST_TUns16 numOfAASamples=0)
virtual ~GHOST_Window ()
virtual void * getOSWindow () const
virtual GHOST_TStandardCursor getCursorShape () const
virtual GHOST_TSuccess setCursorShape (GHOST_TStandardCursor cursorShape)
virtual GHOST_TSuccess setCustomCursorShape (GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY)
virtual GHOST_TSuccess setCustomCursorShape (GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color)
virtual bool getCursorVisibility () const
virtual GHOST_TGrabCursorMode getCursorGrabMode () const
virtual void getCursorGrabInitPos (GHOST_TInt32 &x, GHOST_TInt32 &y) const
virtual void getCursorGrabAccum (GHOST_TInt32 &x, GHOST_TInt32 &y) const
virtual void setCursorGrabAccum (GHOST_TInt32 x, GHOST_TInt32 y)
virtual GHOST_TSuccess setCursorVisibility (bool visible)
virtual GHOST_TSuccess setCursorGrab (GHOST_TGrabCursorMode mode, GHOST_Rect *bounds)
virtual GHOST_TSuccess getCursorGrabBounds (GHOST_Rect &bounds)
virtual GHOST_TSuccess setProgressBar (float progress)
virtual GHOST_TSuccess endProgressBar ()
virtual void setAcceptDragOperation (bool canAccept)
virtual bool canAcceptDragOperation () const
virtual GHOST_TSuccess setModifiedState (bool isUnsavedChanges)
virtual bool getModifiedState ()
virtual GHOST_TDrawingContextType getDrawingContextType ()
virtual GHOST_TSuccess setDrawingContextType (GHOST_TDrawingContextType type)
virtual GHOST_TUserDataPtr getUserData () const
virtual void setUserData (const GHOST_TUserDataPtr userData)

Protected Member Functions

virtual GHOST_TSuccess installDrawingContext (GHOST_TDrawingContextType type)=0
virtual GHOST_TSuccess removeDrawingContext ()=0
virtual GHOST_TSuccess setWindowCursorVisibility (bool visible)=0
virtual GHOST_TSuccess setWindowCursorGrab (GHOST_TGrabCursorMode mode)
virtual GHOST_TSuccess setWindowCursorShape (GHOST_TStandardCursor shape)=0
virtual GHOST_TSuccess setWindowCustomCursorShape (GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY)=0
virtual GHOST_TSuccess setWindowCustomCursorShape (GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int szx, int szy, int hotX, int hotY, int fg, int bg)=0

Protected Attributes

GHOST_TDrawingContextType m_drawingContextType
GHOST_TUserDataPtr m_userData
bool m_cursorVisible
GHOST_TGrabCursorMode m_cursorGrab
GHOST_TInt32 m_cursorGrabInitPos [2]
GHOST_TInt32 m_cursorGrabAccumPos [2]
GHOST_Rect m_cursorGrabBounds
GHOST_TStandardCursor m_cursorShape
bool m_progressBarVisible
bool m_canAcceptDragOperation
bool m_isUnsavedChanges
bool m_fullScreen
bool m_stereoVisual
GHOST_TUns16 m_numOfAASamples
GHOST_TUns32 m_fullScreenWidth
GHOST_TUns32 m_fullScreenHeight

Detailed Description

Platform independent implementation of GHOST_IWindow. Dimensions are given in screen coordinates that are relative to the upper-left corner of the screen. Implements part of the GHOST_IWindow interface and adds some methods to be implemented by childs of this class.

Author:
Maarten Gribnau
Date:
May 7, 2001

Definition at line 49 of file GHOST_Window.h.


Constructor & Destructor Documentation

GHOST_Window::GHOST_Window ( GHOST_TUns32  width,
GHOST_TUns32  height,
GHOST_TWindowState  state,
GHOST_TDrawingContextType  type = GHOST_kDrawingContextTypeNone,
const bool  stereoVisual = false,
const GHOST_TUns16  numOfAASamples = 0 
)

structures for CSG module.

implementation. virtual bool getValid() const = 0; virtual void setTitle(const STR_String& title) = 0; virtual void getTitle(STR_String& title) const = 0; virtual void getWindowBounds(GHOST_Rect& bounds) const = 0; virtual void getClientBounds(GHOST_Rect& bounds) const = 0; virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0; virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0; virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0; virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0; virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0; virtual GHOST_TWindowState getState() const = 0; virtual GHOST_TSuccess setState(GHOST_TWindowState state) = 0; virtual GHOST_TWindowOrder getOrder(void) = 0; virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0; virtual GHOST_TSuccess swapBuffers() = 0; virtual GHOST_TSuccess activateDrawingContext() = 0; virtual GHOST_TSuccess invalidate() = 0; Constructor. Creates a new window and opens it. To check if the window was created properly, use the getValid() method.

Parameters:
widthThe width the window.
heighThe height the window.
stateThe state the window is initially opened with.
typeThe type of drawing context installed in this window.
stereoVisualStereo visual for quad buffered stereo.
numOfAASamplesNumber of samples used for AA (zero if no AA)

Copyright (C) 2001 NaN Technologies B.V.

Author:
Maarten Gribnau
Date:
May 10, 2001

Definition at line 42 of file GHOST_Window.cpp.

References GHOST_kWindowStateFullScreen, m_canAcceptDragOperation, m_cursorGrabAccumPos, m_fullScreen, m_fullScreenHeight, m_fullScreenWidth, m_isUnsavedChanges, and m_progressBarVisible.

GHOST_Window::~GHOST_Window ( ) [virtual]

structures for CSG module.

implementation. virtual bool getValid() const = 0; virtual void setTitle(const STR_String& title) = 0; virtual void getTitle(STR_String& title) const = 0; virtual void getWindowBounds(GHOST_Rect& bounds) const = 0; virtual void getClientBounds(GHOST_Rect& bounds) const = 0; virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0; virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0; virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0; virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0; virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0; virtual GHOST_TWindowState getState() const = 0; virtual GHOST_TSuccess setState(GHOST_TWindowState state) = 0; virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0; virtual GHOST_TSuccess swapBuffers() = 0; virtual GHOST_TSuccess activateDrawingContext() = 0; virtual GHOST_TSuccess invalidate() = 0; Destructor. Closes the window and disposes resources allocated.

Definition at line 72 of file GHOST_Window.cpp.


Member Function Documentation

bool GHOST_Window::canAcceptDragOperation ( ) const [virtual]

Returns acceptance of the dropped object Usually called by the "object dropped" event handling function

Implements GHOST_IWindow.

Definition at line 172 of file GHOST_Window.cpp.

References m_canAcceptDragOperation.

Referenced by GHOST_DropTargetWin32::DragOver(), and GHOST_DropTargetWin32::Drop().

virtual GHOST_TSuccess GHOST_Window::endProgressBar ( ) [inline, virtual]

Hides the progress bar in the icon

Implements GHOST_IWindow.

Reimplemented in GHOST_WindowWin32.

Definition at line 197 of file GHOST_Window.h.

References GHOST_kFailure.

void GHOST_Window::getCursorGrabAccum ( GHOST_TInt32 x,
GHOST_TInt32 y 
) const [inline, virtual]

Definition at line 371 of file GHOST_Window.h.

References m_cursorGrabAccumPos.

Referenced by GHOST_SystemWin32::processCursorEvent().

GHOST_TSuccess GHOST_Window::getCursorGrabBounds ( GHOST_Rect bounds) [virtual]

Gets the cursor grab region, if unset the window is used. reset when grab is disabled.

Definition at line 130 of file GHOST_Window.cpp.

References GHOST_kFailure, GHOST_kSuccess, m_cursorGrabBounds, GHOST_Rect::m_l, and GHOST_Rect::m_r.

Referenced by GHOST_SystemWin32::processCursorEvent().

void GHOST_Window::getCursorGrabInitPos ( GHOST_TInt32 x,
GHOST_TInt32 y 
) const [inline, virtual]

Definition at line 365 of file GHOST_Window.h.

References m_cursorGrabInitPos.

GHOST_TGrabCursorMode GHOST_Window::getCursorGrabMode ( ) const [inline, virtual]
GHOST_TStandardCursor GHOST_Window::getCursorShape ( ) const [inline, virtual]

Returns the current cursor shape.

Returns:
The current cursor shape.

Implements GHOST_IWindow.

Definition at line 383 of file GHOST_Window.h.

References m_cursorShape.

Referenced by GHOST_SystemCarbon::handleWindowEvent(), GHOST_SystemWin32::s_wndProc(), GHOST_WindowCarbon::setWindowCursorVisibility(), and GHOST_WindowWin32::setWindowCursorVisibility().

bool GHOST_Window::getCursorVisibility ( ) const [inline, virtual]
GHOST_TDrawingContextType GHOST_Window::getDrawingContextType ( ) [inline, virtual]

Returns the type of drawing context used in this window.

Returns:
The current type of drawing context.

Implements GHOST_IWindow.

Definition at line 350 of file GHOST_Window.h.

References m_drawingContextType.

Referenced by GHOST_WindowSDL::swapBuffers().

bool GHOST_Window::getModifiedState ( ) [virtual]

Gets the window "modified" status, indicating unsaved changes

Returns:
True if there are unsaved changes

Implements GHOST_IWindow.

Definition at line 184 of file GHOST_Window.cpp.

References m_isUnsavedChanges.

void * GHOST_Window::getOSWindow ( ) const [virtual]

Returns the associated OS object/handle

Returns:
The associated OS object/handle

Implements GHOST_IWindow.

Definition at line 76 of file GHOST_Window.cpp.

References NULL.

virtual GHOST_TUserDataPtr GHOST_Window::getUserData ( ) const [inline, virtual]

Returns the window user data.

Returns:
The window user data.

Implements GHOST_IWindow.

Definition at line 242 of file GHOST_Window.h.

References m_userData.

virtual GHOST_TSuccess GHOST_Window::installDrawingContext ( GHOST_TDrawingContextType  type) [protected, pure virtual]

Tries to install a rendering context in this window.

Parameters:
typeThe type of rendering context installed.
Returns:
Indication as to whether installation has succeeded.

Implemented in GHOST_WindowCarbon, GHOST_WindowNULL, GHOST_WindowSDL, GHOST_WindowWin32, and GHOST_WindowX11.

Referenced by setDrawingContextType().

virtual GHOST_TSuccess GHOST_Window::removeDrawingContext ( ) [protected, pure virtual]

Removes the current drawing context.

Returns:
Indication as to whether removal has succeeded.

Implemented in GHOST_WindowCarbon, GHOST_WindowNULL, GHOST_WindowSDL, GHOST_WindowWin32, and GHOST_WindowX11.

Referenced by setDrawingContextType().

void GHOST_Window::setAcceptDragOperation ( bool  canAccept) [virtual]

Tells if the ongoing drag'n'drop object can be accepted upon mouse drop

Implements GHOST_IWindow.

Definition at line 167 of file GHOST_Window.cpp.

References m_canAcceptDragOperation.

Referenced by GHOST_DropTargetWin32::DragEnter().

GHOST_TSuccess GHOST_Window::setCursorGrab ( GHOST_TGrabCursorMode  mode,
GHOST_Rect bounds 
) [virtual]

Sets the cursor grab.

Parameters:
modeThe new grab state of the cursor.
Returns:
Indication of success.

Reimplemented from GHOST_IWindow.

Definition at line 108 of file GHOST_Window.cpp.

References bounds(), GHOST_IWindow::getClientBounds(), GHOST_kFailure, GHOST_kGrabDisable, GHOST_kSuccess, m_cursorGrab, m_cursorGrabBounds, GHOST_Rect::m_l, GHOST_Rect::m_r, and setWindowCursorGrab().

void GHOST_Window::setCursorGrabAccum ( GHOST_TInt32  x,
GHOST_TInt32  y 
) [inline, virtual]
GHOST_TSuccess GHOST_Window::setCursorShape ( GHOST_TStandardCursor  cursorShape) [virtual]

Set the shape of the cursor.

Parameters:
cursorThe new cursor shape type id.
Returns:
Indication of success.

Implements GHOST_IWindow.

Definition at line 136 of file GHOST_Window.cpp.

References GHOST_kFailure, GHOST_kSuccess, m_cursorShape, and setWindowCursorShape().

GHOST_TSuccess GHOST_Window::setCursorVisibility ( bool  visible) [virtual]

Shows or hides the cursor.

Parameters:
visibleThe new visibility state of the cursor.
Returns:
Indication of success.

Implements GHOST_IWindow.

Definition at line 97 of file GHOST_Window.cpp.

References GHOST_kFailure, GHOST_kSuccess, m_cursorVisible, and setWindowCursorVisibility().

GHOST_TSuccess GHOST_Window::setCustomCursorShape ( GHOST_TUns8  bitmap[16][2],
GHOST_TUns8  mask[16][2],
int  hotX,
int  hotY 
) [virtual]

Set the shape of the cursor to a custom cursor.

Parameters:
bitmapThe bitmap data for the cursor.
maskThe mask data for the cursor.
hotXThe X coordinate of the cursor hotspot.
hotYThe Y coordinate of the cursor hotspot.
Returns:
Indication of success.

Implements GHOST_IWindow.

Definition at line 147 of file GHOST_Window.cpp.

References setCustomCursorShape().

Referenced by setCustomCursorShape().

GHOST_TSuccess GHOST_Window::setCustomCursorShape ( GHOST_TUns8 bitmap,
GHOST_TUns8 mask,
int  sizex,
int  sizey,
int  hotX,
int  hotY,
int  fg_color,
int  bg_color 
) [virtual]
GHOST_TSuccess GHOST_Window::setDrawingContextType ( GHOST_TDrawingContextType  type) [virtual]

Tries to install a rendering context in this window. Child classes do not need to overload this method. They should overload the installDrawingContext and removeDrawingContext instead.

Parameters:
typeThe type of rendering context installed.
Returns:
Indication as to whether installation has succeeded.

Implements GHOST_IWindow.

Definition at line 81 of file GHOST_Window.cpp.

References GHOST_kDrawingContextTypeNone, GHOST_kSuccess, installDrawingContext(), m_drawingContextType, and removeDrawingContext().

Referenced by GHOST_WindowCarbon::GHOST_WindowCarbon(), GHOST_WindowWin32::GHOST_WindowWin32(), GHOST_WindowCarbon::~GHOST_WindowCarbon(), and GHOST_WindowWin32::~GHOST_WindowWin32().

GHOST_TSuccess GHOST_Window::setModifiedState ( bool  isUnsavedChanges) [virtual]

Sets the window "modified" status, indicating unsaved changes

Parameters:
isUnsavedChangesUnsaved changes or not
Returns:
Indication of success.

Implements GHOST_IWindow.

Definition at line 177 of file GHOST_Window.cpp.

References GHOST_kSuccess, and m_isUnsavedChanges.

virtual GHOST_TSuccess GHOST_Window::setProgressBar ( float  progress) [inline, virtual]

Sets the progress bar value displayed in the window/application icon

Parameters:
progressThe progress % (0.0 to 1.0)

Implements GHOST_IWindow.

Reimplemented in GHOST_WindowWin32.

Definition at line 192 of file GHOST_Window.h.

References GHOST_kFailure.

virtual void GHOST_Window::setUserData ( const GHOST_TUserDataPtr  userData) [inline, virtual]

Changes the window user data.

Parameters:
dataThe window user data.

Implements GHOST_IWindow.

Definition at line 251 of file GHOST_Window.h.

References m_userData.

virtual GHOST_TSuccess GHOST_Window::setWindowCursorGrab ( GHOST_TGrabCursorMode  mode) [inline, protected, virtual]

Sets the cursor grab on the window using native window system calls.

Reimplemented in GHOST_WindowNULL, GHOST_WindowSDL, GHOST_WindowWin32, and GHOST_WindowX11.

Definition at line 280 of file GHOST_Window.h.

References GHOST_kSuccess.

Referenced by setCursorGrab().

virtual GHOST_TSuccess GHOST_Window::setWindowCursorShape ( GHOST_TStandardCursor  shape) [protected, pure virtual]

Sets the cursor shape on the window using native window system calls.

Implemented in GHOST_WindowCarbon, GHOST_WindowNULL, GHOST_WindowSDL, GHOST_WindowWin32, and GHOST_WindowX11.

Referenced by setCursorShape().

virtual GHOST_TSuccess GHOST_Window::setWindowCursorVisibility ( bool  visible) [protected, pure virtual]

Sets the cursor visibility on the window using native window system calls.

Implemented in GHOST_WindowCarbon, GHOST_WindowNULL, GHOST_WindowSDL, GHOST_WindowWin32, and GHOST_WindowX11.

Referenced by setCursorVisibility().

virtual GHOST_TSuccess GHOST_Window::setWindowCustomCursorShape ( GHOST_TUns8  bitmap[16][2],
GHOST_TUns8  mask[16][2],
int  hotX,
int  hotY 
) [protected, pure virtual]

Sets the cursor shape on the window using native window system calls.

Implemented in GHOST_WindowCarbon, GHOST_WindowNULL, GHOST_WindowSDL, GHOST_WindowWin32, and GHOST_WindowX11.

Referenced by setCustomCursorShape().

virtual GHOST_TSuccess GHOST_Window::setWindowCustomCursorShape ( GHOST_TUns8 bitmap,
GHOST_TUns8 mask,
int  szx,
int  szy,
int  hotX,
int  hotY,
int  fg,
int  bg 
) [protected, pure virtual]

Member Data Documentation

The acceptance of the "drop candidate" of the current drag'n'drop operation

Definition at line 326 of file GHOST_Window.h.

Referenced by canAcceptDragOperation(), GHOST_Window(), and setAcceptDragOperation().

The current grabbed state of the cursor

Definition at line 308 of file GHOST_Window.h.

Referenced by getCursorGrabMode(), setCursorGrab(), and GHOST_WindowWin32::setWindowCursorGrab().

Accumulated offset from m_cursorGrabInitPos.

Definition at line 314 of file GHOST_Window.h.

Referenced by getCursorGrabAccum(), GHOST_Window(), and setCursorGrabAccum().

Wrap the cursor within this region.

Definition at line 317 of file GHOST_Window.h.

Referenced by getCursorGrabBounds(), setCursorGrab(), and GHOST_WindowWin32::setWindowCursorGrab().

Initial grab location.

Definition at line 311 of file GHOST_Window.h.

Referenced by getCursorGrabInitPos(), and GHOST_WindowWin32::setWindowCursorGrab().

The current shape of the cursor

Definition at line 320 of file GHOST_Window.h.

Referenced by getCursorShape(), setCursorShape(), and setCustomCursorShape().

The current visibility of the cursor

Definition at line 305 of file GHOST_Window.h.

Referenced by getCursorVisibility(), and setCursorVisibility().

bool GHOST_Window::m_fullScreen [protected]

Full-screen height

Definition at line 346 of file GHOST_Window.h.

Referenced by GHOST_Window(), and GHOST_WindowCarbon::installDrawingContext().

Full-screen width

Definition at line 344 of file GHOST_Window.h.

Referenced by GHOST_Window(), and GHOST_WindowCarbon::installDrawingContext().

Modified state : are there unsaved changes

Definition at line 329 of file GHOST_Window.h.

Referenced by getModifiedState(), GHOST_Window(), and setModifiedState().

Number of samples used in anti-aliasing, set to 0 if no AA

Definition at line 341 of file GHOST_Window.h.

Referenced by GHOST_WindowX11::GHOST_WindowX11().

The presence of progress indicator with the application icon

Definition at line 323 of file GHOST_Window.h.

Referenced by GHOST_Window().

bool GHOST_Window::m_stereoVisual [protected]

Stereo visual created. Only necessary for 'real' stereo support, ie quad buffered stereo. This is not always possible, depends on the graphics h/w

Definition at line 338 of file GHOST_Window.h.

Referenced by GHOST_WindowX11::GHOST_WindowX11(), and GHOST_WindowWin32::installDrawingContext().

The window user data

Definition at line 302 of file GHOST_Window.h.

Referenced by getUserData(), and setUserData().


The documentation for this class was generated from the following files: