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

GHOST_WindowCarbon Class Reference

#include <GHOST_WindowCarbon.h>

Inheritance diagram for GHOST_WindowCarbon:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 GHOST_WindowCarbon (const STR_String &title, GHOST_TInt32 left, GHOST_TInt32 top, 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_WindowCarbon ()
virtual bool getValid () const
virtual void setTitle (const STR_String &title)
virtual void getTitle (STR_String &title) const
virtual void getWindowBounds (GHOST_Rect &bounds) const
virtual void getClientBounds (GHOST_Rect &bounds) const
virtual GHOST_TSuccess setClientWidth (GHOST_TUns32 width)
virtual GHOST_TSuccess setClientHeight (GHOST_TUns32 height)
virtual GHOST_TSuccess setClientSize (GHOST_TUns32 width, GHOST_TUns32 height)
virtual GHOST_TWindowState getState () const
virtual void screenToClient (GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
virtual void clientToScreen (GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 &outX, GHOST_TInt32 &outY) const
virtual GHOST_TSuccess setState (GHOST_TWindowState state)
virtual GHOST_TSuccess setOrder (GHOST_TWindowOrder order)
virtual GHOST_TSuccess swapBuffers ()
GHOST_TSuccess updateDrawingContext ()
virtual GHOST_TSuccess activateDrawingContext ()
virtual void loadCursor (bool visible, GHOST_TStandardCursor cursor) const
virtual bool getFullScreenDirty ()
virtual void setMac_windowState (short value)
virtual short getMac_windowState ()
const GHOST_TabletDataGetTabletData ()
GHOST_TabletDataGetCarbonTabletData ()

Protected Member Functions

virtual GHOST_TSuccess installDrawingContext (GHOST_TDrawingContextType type)
virtual GHOST_TSuccess removeDrawingContext ()
virtual GHOST_TSuccess invalidate ()
virtual GHOST_TSuccess setWindowCursorVisibility (bool visible)
virtual GHOST_TSuccess setWindowCursorShape (GHOST_TStandardCursor shape)
virtual GHOST_TSuccess setWindowCustomCursorShape (GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color)
virtual GHOST_TSuccess setWindowCustomCursorShape (GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY)
virtual void gen2mac (const STR_String &in, Str255 out) const
virtual void mac2gen (const Str255 in, STR_String &out) const

Protected Attributes

WindowRef m_windowRef
CGrafPtr m_grafPtr
AGLContext m_aglCtx
Cursor * m_customCursor
GHOST_TabletData m_tablet
bool m_fullScreenDirty
short mac_windowState

Static Protected Attributes

static AGLContext s_firstaglCtx = NULL

Detailed Description

Window on Mac OSX/Carbon. Carbon windows have a size widget in the lower right corner of the window. To force it to be visible, the height of the client rectangle is reduced so that applications do not draw in that area. GHOST will manage that area which is called the gutter. When OpenGL contexts are active, GHOST will use AGL_BUFFER_RECT to prevent OpenGL drawing outside the reduced client rectangle.

Author:
Maarten Gribnau
Date:
May 23, 2001

Definition at line 60 of file GHOST_WindowCarbon.h.


Constructor & Destructor Documentation

GHOST_WindowCarbon::GHOST_WindowCarbon ( const STR_String title,
GHOST_TInt32  left,
GHOST_TInt32  top,
GHOST_TUns32  width,
GHOST_TUns32  height,
GHOST_TWindowState  state,
GHOST_TDrawingContextType  type = GHOST_kDrawingContextTypeNone,
const bool  stereoVisual = false,
const GHOST_TUns16  numOfAASamples = 0 
)

Constructor. Creates a new window and opens it. To check if the window was created properly, use the getValid() method.

Parameters:
titleThe text shown in the title bar of the window.
leftThe coordinate of the left edge of the window.
topThe coordinate of the top edge of the window.
widthThe width the window.
heightThe 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.

Definition at line 93 of file GHOST_WindowCarbon.cpp.

References activateDrawingContext(), GHOST_TabletData::Active, err, gen2mac(), GHOST_kDrawingContextTypeOpenGL, GHOST_kTabletModeNone, GHOST_kWindowState8FullScreen, GHOST_kWindowState8Maximized, GHOST_kWindowState8Minimized, GHOST_kWindowState8Normal, GHOST_kWindowStateFullScreen, GHOST_kWindowStateMaximized, GHOST_kWindowStateMinimized, GHOST_kWindowStateNormal, installDrawingContext(), kWEvents, left(), m_grafPtr, m_tablet, m_windowRef, myWEventHandlerProc(), NULL, GHOST_Window::setDrawingContextType(), setMac_windowState(), setTitle(), ugly_hack, and updateDrawingContext().

GHOST_WindowCarbon::~GHOST_WindowCarbon ( ) [virtual]

Destructor. Closes the window and disposes resources allocated.

Definition at line 192 of file GHOST_WindowCarbon.cpp.

References GHOST_kDrawingContextTypeNone, m_customCursor, m_windowRef, NULL, GHOST_Window::setDrawingContextType(), and ugly_hack.


Member Function Documentation

GHOST_TSuccess GHOST_WindowCarbon::activateDrawingContext ( ) [virtual]

Activates the drawing context of this window.

Returns:
A boolean success indicator.

Implements GHOST_IWindow.

Definition at line 451 of file GHOST_WindowCarbon.cpp.

References getClientBounds(), GHOST_kDrawingContextTypeOpenGL, GHOST_kFailure, GHOST_kSuccess, m_aglCtx, GHOST_Rect::m_b, GHOST_Window::m_drawingContextType, GHOST_Rect::m_l, GHOST_Rect::m_r, and GHOST_Rect::m_t.

Referenced by GHOST_WindowCarbon().

void GHOST_WindowCarbon::clientToScreen ( GHOST_TInt32  inX,
GHOST_TInt32  inY,
GHOST_TInt32 outX,
GHOST_TInt32 outY 
) const [virtual]

Converts a point in screen coordinates to client rectangle coordinates

Parameters:
inXThe x-coordinate in the client rectangle.
inYThe y-coordinate in the client rectangle.
outXThe x-coordinate on the screen.
outYThe y-coordinate on the screen.

Implements GHOST_IWindow.

Definition at line 359 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_ASSERT, and m_grafPtr.

void GHOST_WindowCarbon::gen2mac ( const STR_String in,
Str255  out 
) const [protected, virtual]

Converts a string object to a Mac Pascal string.

Parameters:
inThe string object to be converted.
outThe converted string.

Definition at line 576 of file GHOST_WindowCarbon.cpp.

References STR_String::Length(), and STR_String::Ptr().

Referenced by GHOST_WindowCarbon(), and setTitle().

GHOST_TabletData& GHOST_WindowCarbon::GetCarbonTabletData ( ) [inline]

Definition at line 217 of file GHOST_WindowCarbon.h.

References m_tablet.

void GHOST_WindowCarbon::getClientBounds ( GHOST_Rect bounds) const [virtual]

Returns the client rectangle dimensions. The left and top members of the rectangle are always zero.

Parameters:
boundsThe bounding rectangle of the cleient area of the window.

Implements GHOST_IWindow.

Definition at line 250 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_ASSERT, GHOST_Rect::m_b, GHOST_Rect::m_l, GHOST_Rect::m_r, GHOST_Rect::m_t, and m_windowRef.

Referenced by activateDrawingContext(), setClientHeight(), setClientSize(), and setClientWidth().

bool GHOST_WindowCarbon::getFullScreenDirty ( ) [virtual]

Returns the dirty state of the window when in full-screen mode.

Returns:
Whether it is dirty.

Definition at line 647 of file GHOST_WindowCarbon.cpp.

References GHOST_Window::m_fullScreen, and m_fullScreenDirty.

short GHOST_WindowCarbon::getMac_windowState ( ) [virtual]

Definition at line 744 of file GHOST_WindowCarbon.cpp.

References mac_windowState.

Referenced by myWEventHandlerProc().

GHOST_TWindowState GHOST_WindowCarbon::getState ( ) const [virtual]

Returns the state of the window (normal, minimized, maximized).

Returns:
The state of the window.

Implements GHOST_IWindow.

Definition at line 326 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_ASSERT, GHOST_kWindowStateMaximized, GHOST_kWindowStateMinimized, GHOST_kWindowStateNormal, m_windowRef, and state.

const GHOST_TabletData* GHOST_WindowCarbon::GetTabletData ( ) [inline, virtual]

Returns the tablet data (pressure etc).

Returns:
The tablet data (pressure etc).

Implements GHOST_IWindow.

Definition at line 214 of file GHOST_WindowCarbon.h.

References m_tablet.

void GHOST_WindowCarbon::getTitle ( STR_String title) const [virtual]

Returns the title displayed in the title bar.

Parameters:
titleThe title displayed in the title bar.

Implements GHOST_IWindow.

Definition at line 228 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_ASSERT, m_windowRef, and mac2gen().

bool GHOST_WindowCarbon::getValid ( ) const [virtual]

Returns indication as to whether the window is valid.

Returns:
The validity of the window.

Implements GHOST_IWindow.

Definition at line 206 of file GHOST_WindowCarbon.cpp.

References GHOST_Window::m_fullScreen, m_grafPtr, and m_windowRef.

Referenced by clientToScreen(), getClientBounds(), getState(), getTitle(), getWindowBounds(), installDrawingContext(), invalidate(), screenToClient(), setClientHeight(), setClientSize(), setClientWidth(), setOrder(), setState(), and setTitle().

void GHOST_WindowCarbon::getWindowBounds ( GHOST_Rect bounds) const [virtual]

Returns the window rectangle dimensions. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.

Parameters:
boundsThe bounding rectangle of the window.

Implements GHOST_IWindow.

Definition at line 237 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_ASSERT, GHOST_Rect::m_b, GHOST_Rect::m_l, GHOST_Rect::m_r, GHOST_Rect::m_t, and m_windowRef.

GHOST_TSuccess GHOST_WindowCarbon::installDrawingContext ( GHOST_TDrawingContextType  type) [protected, 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.

Implements GHOST_Window.

Definition at line 480 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_kDrawingContextTypeNone, GHOST_kDrawingContextTypeOpenGL, GHOST_kFailure, GHOST_kSuccess, m_aglCtx, GHOST_Window::m_fullScreen, GHOST_Window::m_fullScreenHeight, GHOST_Window::m_fullScreenWidth, m_grafPtr, s_firstaglCtx, sPreferredFormatFullScreen, and sPreferredFormatWindow.

Referenced by GHOST_WindowCarbon().

GHOST_TSuccess GHOST_WindowCarbon::invalidate ( void  ) [protected, virtual]

Invalidates the contents of this window.

Returns:
Indication of success.

Implements GHOST_IWindow.

Definition at line 553 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_ASSERT, GHOST_kSuccess, GHOST_Window::m_fullScreen, m_fullScreenDirty, m_grafPtr, and m_windowRef.

void GHOST_WindowCarbon::loadCursor ( bool  visible,
GHOST_TStandardCursor  cursor 
) const [virtual]
void GHOST_WindowCarbon::mac2gen ( const Str255  in,
STR_String out 
) const [protected, virtual]

Converts a Mac Pascal string to a string object.

Parameters:
inThe string to be converted.
outThe converted string object.

Definition at line 586 of file GHOST_WindowCarbon.cpp.

Referenced by getTitle().

GHOST_TSuccess GHOST_WindowCarbon::removeDrawingContext ( ) [protected, virtual]

Removes the current drawing context.

Returns:
Indication as to whether removal has succeeded.

Implements GHOST_Window.

Definition at line 529 of file GHOST_WindowCarbon.cpp.

References GHOST_kDrawingContextTypeNone, GHOST_kDrawingContextTypeOpenGL, GHOST_kFailure, GHOST_kSuccess, m_aglCtx, GHOST_Window::m_drawingContextType, NULL, and s_firstaglCtx.

void GHOST_WindowCarbon::screenToClient ( GHOST_TInt32  inX,
GHOST_TInt32  inY,
GHOST_TInt32 outX,
GHOST_TInt32 outY 
) const [virtual]

Converts a point in screen coordinates to client rectangle coordinates

Parameters:
inXThe x-coordinate on the screen.
inYThe y-coordinate on the screen.
outXThe x-coordinate in the client rectangle.
outYThe y-coordinate in the client rectangle.

Implements GHOST_IWindow.

Definition at line 343 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_ASSERT, and m_grafPtr.

GHOST_TSuccess GHOST_WindowCarbon::setClientHeight ( GHOST_TUns32  height) [virtual]

Resizes client rectangle height.

Parameters:
heightThe new height of the client area of the window.

Implements GHOST_IWindow.

Definition at line 288 of file GHOST_WindowCarbon.cpp.

References getClientBounds(), GHOST_Rect::getHeight(), getValid(), GHOST_Rect::getWidth(), GHOST_ASSERT, GHOST_kSuccess, and m_windowRef.

GHOST_TSuccess GHOST_WindowCarbon::setClientSize ( GHOST_TUns32  width,
GHOST_TUns32  height 
) [virtual]

Resizes client rectangle.

Parameters:
widthThe new width of the client area of the window.
heightThe new height of the client area of the window.

Implements GHOST_IWindow.

Definition at line 306 of file GHOST_WindowCarbon.cpp.

References getClientBounds(), GHOST_Rect::getHeight(), getValid(), GHOST_Rect::getWidth(), GHOST_ASSERT, GHOST_kSuccess, and m_windowRef.

GHOST_TSuccess GHOST_WindowCarbon::setClientWidth ( GHOST_TUns32  width) [virtual]

Resizes client rectangle width.

Parameters:
widthThe new width of the client area of the window.

Implements GHOST_IWindow.

Definition at line 276 of file GHOST_WindowCarbon.cpp.

References getClientBounds(), GHOST_Rect::getHeight(), getValid(), GHOST_Rect::getWidth(), GHOST_ASSERT, GHOST_kSuccess, and m_windowRef.

void GHOST_WindowCarbon::setMac_windowState ( short  value) [virtual]

Definition at line 739 of file GHOST_WindowCarbon.cpp.

References mac_windowState.

Referenced by GHOST_WindowCarbon(), and myWEventHandlerProc().

GHOST_TSuccess GHOST_WindowCarbon::setOrder ( GHOST_TWindowOrder  order) [virtual]

Sets the order of the window (bottom, top).

Parameters:
orderThe order of the window.
Returns:
Indication of success.

Implements GHOST_IWindow.

Definition at line 398 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_ASSERT, GHOST_kSuccess, GHOST_kWindowOrderTop, and m_windowRef.

GHOST_TSuccess GHOST_WindowCarbon::setState ( GHOST_TWindowState  state) [virtual]

Sets the state of the window (normal, minimized, maximized).

Parameters:
stateThe state of the window.
Returns:
Indication of success.

Implements GHOST_IWindow.

Definition at line 375 of file GHOST_WindowCarbon.cpp.

References getValid(), GHOST_ASSERT, GHOST_kSuccess, GHOST_kWindowStateMaximized, GHOST_kWindowStateMinimized, GHOST_kWindowStateModified, GHOST_kWindowStateNormal, GHOST_kWindowStateUnModified, and m_windowRef.

void GHOST_WindowCarbon::setTitle ( const STR_String title) [virtual]

Sets the title displayed in the title bar.

Parameters:
titleThe title to display in the title bar.

Implements GHOST_IWindow.

Definition at line 219 of file GHOST_WindowCarbon.cpp.

References gen2mac(), getValid(), GHOST_ASSERT, and m_windowRef.

Referenced by GHOST_WindowCarbon().

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

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

Implements GHOST_Window.

Definition at line 662 of file GHOST_WindowCarbon.cpp.

References GHOST_Window::getCursorVisibility(), GHOST_kSuccess, loadCursor(), m_customCursor, and m_windowRef.

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

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

Implements GHOST_Window.

Definition at line 653 of file GHOST_WindowCarbon.cpp.

References GHOST_Window::getCursorShape(), GHOST_kSuccess, loadCursor(), and m_windowRef.

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

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

Implements GHOST_Window.

Definition at line 732 of file GHOST_WindowCarbon.cpp.

References setWindowCustomCursorShape().

GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape ( GHOST_TUns8 bitmap,
GHOST_TUns8 mask,
int  sizex,
int  sizey,
int  hotX,
int  hotY,
int  fg_color,
int  bg_color 
) [protected, virtual]

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

Implements GHOST_Window.

Definition at line 698 of file GHOST_WindowCarbon.cpp.

References GHOST_Window::getCursorVisibility(), GHOST_kFailure, GHOST_kStandardCursorCustom, GHOST_kSuccess, loadCursor(), m_customCursor, m_windowRef, and uns16ReverseBits().

Referenced by setWindowCustomCursorShape().

GHOST_TSuccess GHOST_WindowCarbon::swapBuffers ( ) [virtual]

Swaps front and back buffers of a window.

Returns:
A boolean success indicator.

Implements GHOST_IWindow.

Definition at line 417 of file GHOST_WindowCarbon.cpp.

References GHOST_kDrawingContextTypeOpenGL, GHOST_kFailure, GHOST_kSuccess, m_aglCtx, and GHOST_Window::m_drawingContextType.

GHOST_TSuccess GHOST_WindowCarbon::updateDrawingContext ( )

Updates the drawing context of this window. Needed whenever the window is changed.

Returns:
Indication of success.

Definition at line 437 of file GHOST_WindowCarbon.cpp.

References GHOST_kDrawingContextTypeOpenGL, GHOST_kFailure, GHOST_kSuccess, m_aglCtx, and GHOST_Window::m_drawingContextType.

Referenced by GHOST_WindowCarbon(), and GHOST_SystemCarbon::handleWindowEvent().


Member Data Documentation

AGLContext GHOST_WindowCarbon::m_aglCtx [protected]

When running in full-screen this tells whether to refresh the window.

Definition at line 286 of file GHOST_WindowCarbon.h.

Referenced by getFullScreenDirty(), and invalidate().

CGrafPtr GHOST_WindowCarbon::m_grafPtr [protected]

Definition at line 283 of file GHOST_WindowCarbon.h.

Referenced by GetCarbonTabletData(), GetTabletData(), and GHOST_WindowCarbon().

WindowRef GHOST_WindowCarbon::m_windowRef [protected]

specific MacOs X full screen window setting as we use partially system mechanism values : 0 not maximizable default 1 normal state 2 maximized state

this will be reworked when rebuilding GHOST carbon to use new OS X apis in order to be unified with GHOST fullscreen/maximised settings

(lukep)

Definition at line 299 of file GHOST_WindowCarbon.h.

Referenced by getMac_windowState(), and setMac_windowState().

AGLContext GHOST_WindowCarbon::s_firstaglCtx = NULL [static, protected]

The first created OpenGL context (for sharing display lists)

Copyright (C) 2001 NaN Technologies B.V.

Author:
Maarten Gribnau
Date:
May 10, 2001

Definition at line 279 of file GHOST_WindowCarbon.h.

Referenced by installDrawingContext(), and removeDrawingContext().


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