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

GHOST_SystemWin32 Class Reference

#include <GHOST_SystemWin32.h>

Inheritance diagram for GHOST_SystemWin32:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 GHOST_SystemWin32 ()
virtual ~GHOST_SystemWin32 ()
virtual GHOST_TUns64 getMilliSeconds () const
virtual GHOST_TUns8 getNumDisplays () const
virtual void getMainDisplayDimensions (GHOST_TUns32 &width, GHOST_TUns32 &height) const
virtual GHOST_IWindowcreateWindow (const STR_String &title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, const bool stereoVisual=false, const GHOST_TUns16 numOfAASamples=0, const GHOST_TEmbedderWindowID parentWindow=0)
virtual bool processEvents (bool waitForEvent)
virtual GHOST_TSuccess getCursorPosition (GHOST_TInt32 &x, GHOST_TInt32 &y) const
virtual GHOST_TSuccess setCursorPosition (GHOST_TInt32 x, GHOST_TInt32 y)
virtual GHOST_TSuccess getModifierKeys (GHOST_ModifierKeys &keys) const
virtual GHOST_TSuccess getButtons (GHOST_Buttons &buttons) const
virtual GHOST_TUns8getClipboard (bool selection) const
virtual void putClipboard (GHOST_TInt8 *buffer, bool selection) const

Static Public Member Functions

static GHOST_TSuccess pushDragDropEvent (GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_IWindow *window, int mouseX, int mouseY, void *data)

Protected Member Functions

virtual GHOST_TSuccess init ()
virtual GHOST_TSuccess exit ()
virtual GHOST_TKey convertKey (GHOST_IWindow *window, short vKey, short ScanCode, short extend) const
virtual GHOST_TKey hardKey (GHOST_IWindow *window, RAWINPUT const &raw, int *keyDown, char *vk)
GHOST_EventKeyprocessModifierKeys (GHOST_IWindow *window)
virtual GHOST_TKey processSpecialKey (GHOST_IWindow *window, short vKey, short scanCode) const
 note: this function can be extended to include other exotic cases as they arise.
virtual void retrieveModifierKeys (GHOST_ModifierKeys &keys) const
virtual void storeModifierKeys (const GHOST_ModifierKeys &keys)
virtual void handleKeyboardChange (void)
int toggleConsole (int action)

Static Protected Member Functions

static GHOST_EventButtonprocessButtonEvent (GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask mask)
static GHOST_EventCursorprocessCursorEvent (GHOST_TEventType type, GHOST_IWindow *Iwindow)
static GHOST_EventWheelprocessWheelEvent (GHOST_IWindow *window, WPARAM wParam, LPARAM lParam)
static GHOST_EventKeyprocessKeyEvent (GHOST_IWindow *window, RAWINPUT const &raw)
static GHOST_EventprocessWindowEvent (GHOST_TEventType type, GHOST_IWindow *window)
static void processMinMaxInfo (MINMAXINFO *minmax)
static LRESULT WINAPI s_wndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)

Protected Attributes

GHOST_ModifierKeys m_modifierKeys
bool m_hasPerformanceCounter
__int64 m_freq
__int64 m_start
bool m_hasAltGr
WORD m_langId
HKL m_keylayout
int m_consoleStatus

Detailed Description

WIN32 Implementation of GHOST_System class.

See also:
GHOST_System.
Author:
Maarten Gribnau
Date:
May 10, 2001

Definition at line 64 of file GHOST_SystemWin32.h.


Constructor & Destructor Documentation

GHOST_SystemWin32::GHOST_SystemWin32 ( )
GHOST_SystemWin32::~GHOST_SystemWin32 ( ) [virtual]

Destructor.

Definition at line 179 of file GHOST_SystemWin32.cpp.

References toggleConsole().


Member Function Documentation

GHOST_TKey GHOST_SystemWin32::convertKey ( GHOST_IWindow window,
short  vKey,
short  ScanCode,
short  extend 
) const [protected, virtual]

Converts raw WIN32 key codes from the wndproc to GHOST keys.

Parameters:
window->The window for this handling
vKeyThe virtual key from hardKey
ScanCodeThe ScanCode of pressed key (simular to PS/2 Set 1)
extendFlag if key is not primerly (left or right)
Returns:
The GHOST key (GHOST_kKeyUnknown if no match).

Definition at line 525 of file GHOST_SystemWin32.cpp.

References GHOST_ISystem::getSystem(), GHOST_kKey0, GHOST_kKeyA, GHOST_kKeyAccentGrave, GHOST_kKeyBackslash, GHOST_kKeyBackSpace, GHOST_kKeyCapsLock, GHOST_kKeyComma, GHOST_kKeyDelete, GHOST_kKeyDownArrow, GHOST_kKeyDownPage, GHOST_kKeyEnd, GHOST_kKeyEnter, GHOST_kKeyEqual, GHOST_kKeyEsc, GHOST_kKeyF1, GHOST_kKeyGrLess, GHOST_kKeyHome, GHOST_kKeyInsert, GHOST_kKeyLeftAlt, GHOST_kKeyLeftArrow, GHOST_kKeyLeftBracket, GHOST_kKeyLeftControl, GHOST_kKeyLeftShift, GHOST_kKeyMediaFirst, GHOST_kKeyMediaLast, GHOST_kKeyMediaPlay, GHOST_kKeyMediaStop, GHOST_kKeyMinus, GHOST_kKeyNumLock, GHOST_kKeyNumpad0, GHOST_kKeyNumpad1, GHOST_kKeyNumpad2, GHOST_kKeyNumpad3, GHOST_kKeyNumpad4, GHOST_kKeyNumpad5, GHOST_kKeyNumpad6, GHOST_kKeyNumpad7, GHOST_kKeyNumpad8, GHOST_kKeyNumpad9, GHOST_kKeyNumpadAsterisk, GHOST_kKeyNumpadEnter, GHOST_kKeyNumpadMinus, GHOST_kKeyNumpadPeriod, GHOST_kKeyNumpadPlus, GHOST_kKeyNumpadSlash, GHOST_kKeyOS, GHOST_kKeyPause, GHOST_kKeyPeriod, GHOST_kKeyPrintScreen, GHOST_kKeyQuote, GHOST_kKeyRightAlt, GHOST_kKeyRightArrow, GHOST_kKeyRightBracket, GHOST_kKeyRightControl, GHOST_kKeyRightShift, GHOST_kKeyScrollLock, GHOST_kKeySemicolon, GHOST_kKeySlash, GHOST_kKeySpace, GHOST_kKeyTab, GHOST_kKeyUnknown, GHOST_kKeyUpArrow, GHOST_kKeyUpPage, processSpecialKey(), VK_BACK_QUOTE, VK_BACK_SLASH, VK_CLOSE_BRACKET, VK_COMMA, VK_EQUALS, VK_GR_LESS, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PLAY_PAUSE, VK_MEDIA_PREV_TRACK, VK_MEDIA_STOP, VK_MINUS, VK_OPEN_BRACKET, VK_PERIOD, VK_QUOTE, VK_SEMICOLON, and VK_SLASH.

Referenced by hardKey().

GHOST_IWindow * GHOST_SystemWin32::createWindow ( const STR_String title,
GHOST_TInt32  left,
GHOST_TInt32  top,
GHOST_TUns32  width,
GHOST_TUns32  height,
GHOST_TWindowState  state,
GHOST_TDrawingContextType  type,
const bool  stereoVisual = false,
const GHOST_TUns16  numOfAASamples = 0,
const GHOST_TEmbedderWindowID  parentWindow = 0 
) [virtual]

Create a new window. The new window is added to the list of windows managed. Never explicitly delete the window, use disposeWindow() instead.

Parameters:
titleThe name of the window (displayed in the title bar of the window if the OS supports it).
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 of the window when opened.
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)
parentWindowParent (embedder) window
Returns:
The new window (or 0 if creation failed).

Implements GHOST_ISystem.

Definition at line 222 of file GHOST_SystemWin32.cpp.

References GHOST_WindowManager::addWindow(), GHOST_WindowWin32::getNextWindow(), GHOST_WindowWin32::getValid(), GHOST_IWindow::getValid(), GHOST_System::m_windowManager, NULL, and GHOST_WindowManager::setActiveWindow().

GHOST_TSuccess GHOST_SystemWin32::exit ( ) [protected, virtual]

Closes the system down.

Returns:
A success value.

Reimplemented from GHOST_System.

Definition at line 423 of file GHOST_SystemWin32.cpp.

GHOST_TSuccess GHOST_SystemWin32::getButtons ( GHOST_Buttons buttons) const [virtual]

Returns the state of the mouse buttons (ouside the message queue).

Parameters:
buttonsThe state of the buttons.
Returns:
Indication of success.

Implements GHOST_System.

Definition at line 352 of file GHOST_SystemWin32.cpp.

References GHOST_kButtonMaskLeft, GHOST_kButtonMaskMiddle, GHOST_kButtonMaskRight, GHOST_kSuccess, GHOST_Buttons::set(), and TRUE.

GHOST_TUns8 * GHOST_SystemWin32::getClipboard ( bool  selection) const [virtual]

Returns unsinged char from CUT_BUFFER0

Parameters:
selectionUsed by X11 only
Returns:
Returns the Clipboard

Implements GHOST_System.

Definition at line 1241 of file GHOST_SystemWin32.cpp.

References len(), and NULL.

GHOST_TSuccess GHOST_SystemWin32::getCursorPosition ( GHOST_TInt32 x,
GHOST_TInt32 y 
) const [virtual]

Returns the current location of the cursor (location in screen coordinates)

Parameters:
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns:
Indication of success.

Implements GHOST_ISystem.

Definition at line 305 of file GHOST_SystemWin32.cpp.

References GHOST_kFailure, GHOST_kSuccess, and point::x.

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

void GHOST_SystemWin32::getMainDisplayDimensions ( GHOST_TUns32 width,
GHOST_TUns32 height 
) const [virtual]

Returns the dimensions of the main display on this system.

Returns:
The dimension of the main display.

Implements GHOST_ISystem.

Definition at line 215 of file GHOST_SystemWin32.cpp.

GHOST_TUns64 GHOST_SystemWin32::getMilliSeconds ( ) const [virtual]

Returns the system time. Returns the number of milliseconds since the start of the system process. This overloaded method uses the high frequency timer if available.

Returns:
The number of milliseconds.

Reimplemented from GHOST_System.

Definition at line 187 of file GHOST_SystemWin32.cpp.

References m_freq, m_hasPerformanceCounter, and m_start.

Referenced by processButtonEvent(), processCursorEvent(), processEvents(), processKeyEvent(), processWheelEvent(), and pushDragDropEvent().

GHOST_TSuccess GHOST_SystemWin32::getModifierKeys ( GHOST_ModifierKeys keys) const [virtual]

Returns the state of all modifier keys.

Parameters:
keysThe state of all modifier keys (true == pressed).
Returns:
Indication of success.

Implements GHOST_System.

Definition at line 325 of file GHOST_SystemWin32.cpp.

References GHOST_kModifierKeyLeftAlt, GHOST_kModifierKeyLeftControl, GHOST_kModifierKeyLeftShift, GHOST_kModifierKeyOS, GHOST_kModifierKeyRightAlt, GHOST_kModifierKeyRightControl, GHOST_kModifierKeyRightShift, GHOST_kSuccess, and GHOST_ModifierKeys::set().

GHOST_TUns8 GHOST_SystemWin32::getNumDisplays ( ) const [virtual]

Returns the number of displays on this system.

Returns:
The number of displays.

Implements GHOST_ISystem.

Definition at line 206 of file GHOST_SystemWin32.cpp.

References GHOST_DisplayManager::getNumDisplays(), GHOST_ASSERT, and GHOST_System::m_displayManager.

void GHOST_SystemWin32::handleKeyboardChange ( void  ) [inline, protected, virtual]

Check current key layout for AltGr

Definition at line 378 of file GHOST_SystemWin32.h.

References i, m_hasAltGr, m_keylayout, and m_langId.

Referenced by GHOST_SystemWin32(), and s_wndProc().

GHOST_TKey GHOST_SystemWin32::hardKey ( GHOST_IWindow window,
RAWINPUT const &  raw,
int *  keyDown,
char *  vk 
) [protected, virtual]

Catches raw WIN32 key codes from WM_INPUT in the wndproc.

Parameters:
windowThe window for this handling
rawRawInput structure with detailed info about the key event
keyDownPointer flag that specify if a key is down
vkPointer to virtual key
Returns:
The GHOST key (GHOST_kKeyUnknown if no match).

Definition at line 428 of file GHOST_SystemWin32.cpp.

References convertKey(), GHOST_ModifierKeys::get(), GHOST_ISystem::getSystem(), GHOST_kKeyLeftAlt, GHOST_kKeyLeftControl, GHOST_kKeyLeftShift, GHOST_kKeyRightAlt, GHOST_kKeyRightControl, GHOST_kKeyRightShift, GHOST_kKeyUnknown, GHOST_kModifierKeyLeftAlt, GHOST_kModifierKeyLeftControl, GHOST_kModifierKeyLeftShift, GHOST_kModifierKeyRightAlt, GHOST_kModifierKeyRightControl, GHOST_kModifierKeyRightShift, retrieveModifierKeys(), GHOST_ModifierKeys::set(), and storeModifierKeys().

Referenced by processKeyEvent().

GHOST_TSuccess GHOST_SystemWin32::init ( ) [protected, virtual]

Initializes the system. For now, it justs registers the window class (WNDCLASS).

Returns:
A success value.

Reimplemented from GHOST_System.

Definition at line 371 of file GHOST_SystemWin32.cpp.

References BOOL, GHOST_WindowWin32::getWindowClassName(), GHOST_kFailure, GHOST_PRINT, initRawInput(), m_freq, m_hasPerformanceCounter, m_start, NULL, s_wndProc(), and TRUE.

GHOST_EventButton * GHOST_SystemWin32::processButtonEvent ( GHOST_TEventType  type,
GHOST_IWindow window,
GHOST_TButtonMask  mask 
) [static, protected]

Creates mouse button event.

Parameters:
typeThe type of event to create.
windowThe window receiving the event (the active window).
maskThe button mask of this event.
Returns:
The event created.

Definition at line 636 of file GHOST_SystemWin32.cpp.

References getMilliSeconds(), and GHOST_ISystem::getSystem().

Referenced by s_wndProc().

GHOST_EventCursor * GHOST_SystemWin32::processCursorEvent ( GHOST_TEventType  type,
GHOST_IWindow Iwindow 
) [static, protected]
bool GHOST_SystemWin32::processEvents ( bool  waitForEvent) [virtual]

Gets events from the system and stores them in the queue.

Parameters:
waitForEventFlag to wait for an event (or return immediately).
Returns:
Indication of the presence of events.

Implements GHOST_ISystem.

Definition at line 265 of file GHOST_SystemWin32.cpp.

References GHOST_TimerManager::fireTimers(), getMilliSeconds(), GHOST_System::getTimerManager(), GHOST_kFireTimeNever, next, GHOST_TimerManager::nextFireTime(), NULL, and Sleep.

GHOST_EventKey * GHOST_SystemWin32::processKeyEvent ( GHOST_IWindow window,
RAWINPUT const &  raw 
) [static, protected]

Creates a key event and updates the key data stored locally (m_modifierKeys). In most cases this is a straightforward conversion of key codes. For the modifier keys however, we want to distinguish left and right keys.

Parameters:
windowThe window receiving the event (the active window).
rawRawInput structure with detailed info about the key event

Definition at line 710 of file GHOST_SystemWin32.cpp.

References BYTE, getMilliSeconds(), GHOST_ISystem::getSystem(), GHOST_kEventKeyDown, GHOST_kEventKeyUp, GHOST_kKeyUnknown, hardKey(), m_keylayout, NULL, and state.

Referenced by s_wndProc().

void GHOST_SystemWin32::processMinMaxInfo ( MINMAXINFO *  minmax) [static, protected]

Handles minimum window size.

Parameters:
minmaxThe MINMAXINFO structure.

Definition at line 771 of file GHOST_SystemWin32.cpp.

Referenced by s_wndProc().

GHOST_EventKey* GHOST_SystemWin32::processModifierKeys ( GHOST_IWindow window) [protected]

Creates modifier key event(s) and updates the key data stored locally (m_modifierKeys). With the modifier keys, we want to distinguish left and right keys. Sometimes this is not possible (Windows ME for instance). Then, we want events generated for both keys.

Parameters:
windowThe window receiving the event (the active window).
GHOST_TKey GHOST_SystemWin32::processSpecialKey ( GHOST_IWindow window,
short  vKey,
short  scanCode 
) const [protected, virtual]

note: this function can be extended to include other exotic cases as they arise.

Process special keys (VK_OEM_*), to see if current key layout gives us anything special, like ! on french AZERTY.

Parameters:
windowThe window receiving the event (the active window).
vKeyThe virtual key from hardKey
ScanCodeThe ScanCode of pressed key (simular to PS/2 Set 1)

Definition at line 513 of file GHOST_SystemWin32.cpp.

References GHOST_kKeyF13, GHOST_kKeyUnknown, and m_langId.

Referenced by convertKey().

GHOST_EventWheel * GHOST_SystemWin32::processWheelEvent ( GHOST_IWindow window,
WPARAM  wParam,
LPARAM  lParam 
) [static, protected]

Creates a mouse wheel event.

Parameters:
windowThe window receiving the event (the active window).
wParamThe wParam from the wndproc
lParamThe lParam from the wndproc

Definition at line 695 of file GHOST_SystemWin32.cpp.

References getMilliSeconds(), and GHOST_ISystem::getSystem().

Referenced by s_wndProc().

GHOST_Event * GHOST_SystemWin32::processWindowEvent ( GHOST_TEventType  type,
GHOST_IWindow window 
) [static, protected]

Creates a window event.

Parameters:
typeThe type of event to create.
windowThe window receiving the event (the active window).
Returns:
The event created.

Definition at line 746 of file GHOST_SystemWin32.cpp.

References GHOST_System::getMilliSeconds(), GHOST_ISystem::getSystem(), GHOST_System::getWindowManager(), GHOST_kEventWindowActivate, and GHOST_WindowManager::setActiveWindow().

Referenced by s_wndProc().

GHOST_TSuccess GHOST_SystemWin32::pushDragDropEvent ( GHOST_TEventType  eventType,
GHOST_TDragnDropTypes  draggedObjectType,
GHOST_IWindow window,
int  mouseX,
int  mouseY,
void *  data 
) [static]

Creates a drag'n'drop event and pushes it immediately onto the event queue. Called by GHOST_DropTargetWin32 class.

Parameters:
eventTypeThe type of drag'n'drop event
draggedObjectTypeThe type object concerned (currently array of file names, string, ?bitmap)
mouseXx mouse coordinate (in window coordinates)
mouseYy mouse coordinate
windowThe window on which the event occurred
Returns:
Indication whether the event was handled.

Definition at line 757 of file GHOST_SystemWin32.cpp.

References data, getMilliSeconds(), GHOST_ISystem::getSystem(), and GHOST_System::pushEvent().

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

void GHOST_SystemWin32::putClipboard ( GHOST_TInt8 buffer,
bool  selection 
) const [virtual]

Puts buffer to system clipboard

Parameters:
selectionUsed by X11 only
Returns:
No return

Implements GHOST_System.

Definition at line 1274 of file GHOST_SystemWin32.cpp.

References data, and NULL.

void GHOST_SystemWin32::retrieveModifierKeys ( GHOST_ModifierKeys keys) const [inline, protected, virtual]

Returns the local state of the modifier keys (from the message queue).

Parameters:
keysThe state of the keys.

Definition at line 368 of file GHOST_SystemWin32.h.

References m_modifierKeys.

Referenced by hardKey().

LRESULT WINAPI GHOST_SystemWin32::s_wndProc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
) [static, protected]
GHOST_TSuccess GHOST_SystemWin32::setCursorPosition ( GHOST_TInt32  x,
GHOST_TInt32  y 
) [virtual]

Updates the location of the cursor (location in screen coordinates).

Parameters:
xThe x-coordinate of the cursor.
yThe y-coordinate of the cursor.
Returns:
Indication of success.

Implements GHOST_ISystem.

Definition at line 317 of file GHOST_SystemWin32.cpp.

References GHOST_kFailure, GHOST_kSuccess, and TRUE.

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

void GHOST_SystemWin32::storeModifierKeys ( const GHOST_ModifierKeys keys) [inline, protected, virtual]

Stores the state of the modifier keys locally. For internal use only!

Parameters:
keysThe new state of the modifier keys.

Definition at line 373 of file GHOST_SystemWin32.h.

References m_modifierKeys.

Referenced by hardKey(), and s_wndProc().

int GHOST_SystemWin32::toggleConsole ( int  action) [protected, virtual]

Toggles console 0 - Hides 1 - Shows 2 - Toggles 3 - Hides if it runs not from command line

  • Does nothing
    Returns:
    current status (1 -visible, 0 - hidden)

Implements GHOST_ISystem.

Definition at line 1301 of file GHOST_SystemWin32.cpp.

References DWORD, credits_svn_gen::e, and m_consoleStatus.

Referenced by ~GHOST_SystemWin32().


Member Data Documentation

Console status

Definition at line 365 of file GHOST_SystemWin32.h.

Referenced by GHOST_SystemWin32(), and toggleConsole().

__int64 GHOST_SystemWin32::m_freq [protected]

High frequency timer variable.

Definition at line 354 of file GHOST_SystemWin32.h.

Referenced by getMilliSeconds(), and init().

AltGr on current keyboard layout.

Definition at line 358 of file GHOST_SystemWin32.h.

Referenced by handleKeyboardChange().

State variable set at initialization.

Definition at line 352 of file GHOST_SystemWin32.h.

Referenced by getMilliSeconds(), and init().

stores keyboard layout.

Definition at line 362 of file GHOST_SystemWin32.h.

Referenced by handleKeyboardChange(), and processKeyEvent().

WORD GHOST_SystemWin32::m_langId [protected]

language identifier.

Definition at line 360 of file GHOST_SystemWin32.h.

Referenced by handleKeyboardChange(), and processSpecialKey().

The current state of the modifier keys.

Definition at line 350 of file GHOST_SystemWin32.h.

Referenced by retrieveModifierKeys(), and storeModifierKeys().

__int64 GHOST_SystemWin32::m_start [protected]

High frequency timer variable.

Definition at line 356 of file GHOST_SystemWin32.h.

Referenced by getMilliSeconds(), and init().


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