diff options
Diffstat (limited to 'intern/ghost/intern/GHOST_C-api.cpp')
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 665 |
1 files changed, 272 insertions, 393 deletions
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index 24456b841da..8d9570a39f3 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -34,110 +34,97 @@ GHOST_SystemHandle GHOST_CreateSystem(void) { - GHOST_ISystem::createSystem(); - GHOST_ISystem *system = GHOST_ISystem::getSystem(); + GHOST_ISystem::createSystem(); + GHOST_ISystem *system = GHOST_ISystem::getSystem(); - return (GHOST_SystemHandle)system; + return (GHOST_SystemHandle)system; } - - GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return system->disposeSystem(); + return system->disposeSystem(); } - GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback, GHOST_TUserDataPtr userdata) { - return (GHOST_EventConsumerHandle) new GHOST_CallbackEventConsumer(eventCallback, userdata); + return (GHOST_EventConsumerHandle) new GHOST_CallbackEventConsumer(eventCallback, userdata); } - GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle) { - delete ((GHOST_CallbackEventConsumer *)consumerhandle); - return GHOST_kSuccess; + delete ((GHOST_CallbackEventConsumer *)consumerhandle); + return GHOST_kSuccess; } - GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return system->getMilliSeconds(); + return system->getMilliSeconds(); } - - GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle, GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerproc, GHOST_TUserDataPtr userdata) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return (GHOST_TimerTaskHandle) system->installTimer(delay, interval, timerproc, userdata); + return (GHOST_TimerTaskHandle)system->installTimer(delay, interval, timerproc, userdata); } - - GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle, GHOST_TimerTaskHandle timertaskhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; - GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; + GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle; - return system->removeTimer(timertask); + return system->removeTimer(timertask); } - - GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return system->getNumDisplays(); + return system->getNumDisplays(); } - - void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle, GHOST_TUns32 *width, GHOST_TUns32 *height) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - system->getMainDisplayDimensions(*width, *height); + system->getMainDisplayDimensions(*width, *height); } void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle, - GHOST_TUns32 *width, - GHOST_TUns32 *height) + GHOST_TUns32 *width, + GHOST_TUns32 *height) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - system->getAllDisplayDimensions(*width, *height); + system->getAllDisplayDimensions(*width, *height); } GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return (GHOST_ContextHandle) system->createOffscreenContext(); + return (GHOST_ContextHandle)system->createOffscreenContext(); } GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle, - GHOST_ContextHandle contexthandle) + GHOST_ContextHandle contexthandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; - GHOST_IContext *context = (GHOST_IContext *) contexthandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; + GHOST_IContext *context = (GHOST_IContext *)contexthandle; - return system->disposeContext(context); + return system->disposeContext(context); } GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle, @@ -150,146 +137,131 @@ GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return (GHOST_WindowHandle) system->createWindow(title, left, top, width, height, - state, type, glSettings, false); + return (GHOST_WindowHandle)system->createWindow( + title, left, top, width, height, state, type, glSettings, false); } GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->getUserData(); + return window->getUserData(); } void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr userdata) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - window->setUserData(userdata); + window->setUserData(userdata); } GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return system->disposeWindow(window); + return system->disposeWindow(window); } - - -int GHOST_ValidWindow(GHOST_SystemHandle systemhandle, - GHOST_WindowHandle windowhandle) +int GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return (int) system->validWindow(window); + return (int)system->validWindow(window); } - - GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle, GHOST_DisplaySetting *setting, const int stereoVisual) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; - GHOST_IWindow *window = NULL; - bool bstereoVisual; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; + GHOST_IWindow *window = NULL; + bool bstereoVisual; - if (stereoVisual) - bstereoVisual = true; - else - bstereoVisual = false; + if (stereoVisual) + bstereoVisual = true; + else + bstereoVisual = false; - system->beginFullScreen(*setting, &window, bstereoVisual); + system->beginFullScreen(*setting, &window, bstereoVisual); - return (GHOST_WindowHandle)window; + return (GHOST_WindowHandle)window; } - - GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return system->endFullScreen(); + return system->endFullScreen(); } - - int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return (int) system->getFullScreen(); + return (int)system->getFullScreen(); } - - int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return (int) system->processEvents(waitForEvent ? true : false); + return (int)system->processEvents(waitForEvent ? true : false); } - - void GHOST_DispatchEvents(GHOST_SystemHandle systemhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - system->dispatchEvents(); + system->dispatchEvents(); } - -GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle) +GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, + GHOST_EventConsumerHandle consumerhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return system->addEventConsumer((GHOST_CallbackEventConsumer *)consumerhandle); + return system->addEventConsumer((GHOST_CallbackEventConsumer *)consumerhandle); } -GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle) +GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle, + GHOST_EventConsumerHandle consumerhandle) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return system->removeEventConsumer((GHOST_CallbackEventConsumer *)consumerhandle); + return system->removeEventConsumer((GHOST_CallbackEventConsumer *)consumerhandle); } GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setProgressBar(progress); + return window->setProgressBar(progress); } GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->endProgressBar(); + return window->endProgressBar(); } - GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->getCursorShape(); + return window->getCursorShape(); } - - GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle, GHOST_TStandardCursor cursorshape) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setCursorShape(cursorshape); + return window->setCursorShape(cursorshape); } GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle, @@ -298,9 +270,9 @@ GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle, int hotX, int hotY) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setCustomCursorShape(bitmap, mask, hotX, hotY); + return window->setCustomCursorShape(bitmap, mask, hotX, hotY); } GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle, @@ -313,664 +285,571 @@ GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle, int fg_color, int bg_color) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setCustomCursorShape(bitmap, mask, sizex, sizey, - hotX, hotY, fg_color, bg_color); + return window->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, fg_color, bg_color); } - - int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return (int) window->getCursorVisibility(); + return (int)window->getCursorVisibility(); } - - -GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, - int visible) +GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, int visible) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setCursorVisibility(visible ? true : false); + return window->setCursorVisibility(visible ? true : false); } - - GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle, GHOST_TInt32 *x, GHOST_TInt32 *y) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return system->getCursorPosition(*x, *y); + return system->getCursorPosition(*x, *y); } - - GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, GHOST_TInt32 x, GHOST_TInt32 y) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return system->setCursorPosition(x, y); + return system->setCursorPosition(x, y); } - GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, GHOST_TGrabCursorMode mode, - int bounds[4], const int mouse_ungrab_xy[2]) + int bounds[4], + const int mouse_ungrab_xy[2]) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; - GHOST_Rect bounds_rect; - GHOST_TInt32 mouse_xy[2]; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; + GHOST_Rect bounds_rect; + GHOST_TInt32 mouse_xy[2]; - if (bounds) { - bounds_rect = GHOST_Rect(bounds[0], bounds[1], bounds[2], bounds[3]); - } - if (mouse_ungrab_xy) { - mouse_xy[0] = mouse_ungrab_xy[0]; - mouse_xy[1] = mouse_ungrab_xy[1]; - } + if (bounds) { + bounds_rect = GHOST_Rect(bounds[0], bounds[1], bounds[2], bounds[3]); + } + if (mouse_ungrab_xy) { + mouse_xy[0] = mouse_ungrab_xy[0]; + mouse_xy[1] = mouse_ungrab_xy[1]; + } - return window->setCursorGrab(mode, - bounds ? &bounds_rect : NULL, - mouse_ungrab_xy ? mouse_xy : NULL); + return window->setCursorGrab( + mode, bounds ? &bounds_rect : NULL, mouse_ungrab_xy ? mouse_xy : NULL); } - GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle, GHOST_TModifierKeyMask mask, int *isDown) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; - GHOST_TSuccess result; - bool isdown = false; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; + GHOST_TSuccess result; + bool isdown = false; - result = system->getModifierKeyState(mask, isdown); - *isDown = (int) isdown; + result = system->getModifierKeyState(mask, isdown); + *isDown = (int)isdown; - return result; + return result; } - - GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle, GHOST_TButtonMask mask, int *isDown) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; - GHOST_TSuccess result; - bool isdown = false; + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; + GHOST_TSuccess result; + bool isdown = false; - result = system->getButtonState(mask, isdown); - *isDown = (int) isdown; + result = system->getButtonState(mask, isdown); + *isDown = (int)isdown; - return result; + return result; } - #ifdef WITH_INPUT_NDOF void GHOST_setNDOFDeadZone(float deadzone) { - GHOST_ISystem *system = GHOST_ISystem::getSystem(); - system->setNDOFDeadZone(deadzone); + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + system->setNDOFDeadZone(deadzone); } #endif void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - window->setAcceptDragOperation(canAccept); + window->setAcceptDragOperation(canAccept); } - GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle) { - GHOST_IEvent *event = (GHOST_IEvent *) eventhandle; + GHOST_IEvent *event = (GHOST_IEvent *)eventhandle; - return event->getType(); + return event->getType(); } - - GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle) { - GHOST_IEvent *event = (GHOST_IEvent *) eventhandle; + GHOST_IEvent *event = (GHOST_IEvent *)eventhandle; - return event->getTime(); + return event->getTime(); } - GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle) { - GHOST_IEvent *event = (GHOST_IEvent *) eventhandle; + GHOST_IEvent *event = (GHOST_IEvent *)eventhandle; - return (GHOST_WindowHandle) event->getWindow(); + return (GHOST_WindowHandle)event->getWindow(); } - GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle) { - GHOST_IEvent *event = (GHOST_IEvent *) eventhandle; + GHOST_IEvent *event = (GHOST_IEvent *)eventhandle; - return event->getData(); + return event->getData(); } - - GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle) { - GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle; + GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle; - return timertask->getTimerProc(); + return timertask->getTimerProc(); } - - -void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle, - GHOST_TimerProcPtr timerproc) +void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle, GHOST_TimerProcPtr timerproc) { - GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle; + GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle; - timertask->setTimerProc(timerproc); + timertask->setTimerProc(timerproc); } - - GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle) { - GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle; + GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle; - return timertask->getUserData(); + return timertask->getUserData(); } - - -void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle, - GHOST_TUserDataPtr userdata) +void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle, GHOST_TUserDataPtr userdata) { - GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle; + GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle; - timertask->setUserData(userdata); + timertask->setUserData(userdata); } - - int GHOST_GetValid(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return (int) window->getValid(); + return (int)window->getValid(); } - - GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->getDrawingContextType(); + return window->getDrawingContextType(); } - - GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle, GHOST_TDrawingContextType type) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setDrawingContextType(type); + return window->setDrawingContextType(type); } - - -void GHOST_SetTitle(GHOST_WindowHandle windowhandle, - const char *title) +void GHOST_SetTitle(GHOST_WindowHandle windowhandle, const char *title) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - window->setTitle(title); + window->setTitle(title); } - char *GHOST_GetTitle(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; - STR_String title; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; + STR_String title; - window->getTitle(title); + window->getTitle(title); - char *ctitle = (char *) malloc(title.Length() + 1); + char *ctitle = (char *)malloc(title.Length() + 1); - if (ctitle == NULL) { - return NULL; - } + if (ctitle == NULL) { + return NULL; + } - strcpy(ctitle, title.Ptr()); + strcpy(ctitle, title.Ptr()); - return ctitle; + return ctitle; } - - GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; - GHOST_Rect *rectangle = NULL; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; + GHOST_Rect *rectangle = NULL; - rectangle = new GHOST_Rect(); - window->getWindowBounds(*rectangle); + rectangle = new GHOST_Rect(); + window->getWindowBounds(*rectangle); - return (GHOST_RectangleHandle)rectangle; + return (GHOST_RectangleHandle)rectangle; } - - GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; - GHOST_Rect *rectangle = NULL; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; + GHOST_Rect *rectangle = NULL; - rectangle = new GHOST_Rect(); - window->getClientBounds(*rectangle); + rectangle = new GHOST_Rect(); + window->getClientBounds(*rectangle); - return (GHOST_RectangleHandle)rectangle; + return (GHOST_RectangleHandle)rectangle; } - - void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle) { - delete (GHOST_Rect *) rectanglehandle; + delete (GHOST_Rect *)rectanglehandle; } - - -GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, - GHOST_TUns32 width) +GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOST_TUns32 width) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setClientWidth(width); + return window->setClientWidth(width); } - - -GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, - GHOST_TUns32 height) +GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHOST_TUns32 height) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setClientHeight(height); + return window->setClientHeight(height); } - - GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle, GHOST_TUns32 width, GHOST_TUns32 height) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setClientSize(width, height); + return window->setClientSize(width, height); } - - void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle, GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 *outX, GHOST_TInt32 *outY) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - window->screenToClient(inX, inY, *outX, *outY); + window->screenToClient(inX, inY, *outX, *outY); } - - void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle, GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 *outX, GHOST_TInt32 *outY) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - window->clientToScreen(inX, inY, *outX, *outY); + window->clientToScreen(inX, inY, *outX, *outY); } - - GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->getState(); + return window->getState(); } - - -GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, - GHOST_TWindowState state) +GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, GHOST_TWindowState state) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setState(state); + return window->setState(state); } - -GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, GHOST_TUns8 isUnsavedChanges) +GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, + GHOST_TUns8 isUnsavedChanges) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setModifiedState(isUnsavedChanges); + return window->setModifiedState(isUnsavedChanges); } - -GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle, - GHOST_TWindowOrder order) +GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle, GHOST_TWindowOrder order) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setOrder(order); + return window->setOrder(order); } - - GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->swapBuffers(); + return window->swapBuffers(); } GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int interval) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->setSwapInterval(interval); + return window->setSwapInterval(interval); } -GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int* intervalOut) +GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int *intervalOut) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->getSwapInterval(*intervalOut); + return window->getSwapInterval(*intervalOut); } - GHOST_TUns16 GHOST_GetNumOfAASamples(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->getNumOfAASamples(); + return window->getNumOfAASamples(); } GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->activateDrawingContext(); + return window->activateDrawingContext(); } GHOST_TSuccess GHOST_ActivateOpenGLContext(GHOST_ContextHandle contexthandle) { - GHOST_IContext *context = (GHOST_IContext *) contexthandle; + GHOST_IContext *context = (GHOST_IContext *)contexthandle; - return context->activateDrawingContext(); + return context->activateDrawingContext(); } GHOST_TSuccess GHOST_ReleaseOpenGLContext(GHOST_ContextHandle contexthandle) { - GHOST_IContext *context = (GHOST_IContext *) contexthandle; + GHOST_IContext *context = (GHOST_IContext *)contexthandle; - return context->releaseDrawingContext(); + return context->releaseDrawingContext(); } GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->invalidate(); + return window->invalidate(); } void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api) { - GHOST_ISystem *system = (GHOST_ISystem *) systemhandle; - system->setTabletAPI(api); + GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; + system->setTabletAPI(api); } const GHOST_TabletData *GHOST_GetTabletData(GHOST_WindowHandle windowhandle) { - return ((GHOST_IWindow *)windowhandle)->GetTabletData(); + return ((GHOST_IWindow *)windowhandle)->GetTabletData(); } - GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle) { - return ((GHOST_Rect *)rectanglehandle)->getWidth(); + return ((GHOST_Rect *)rectanglehandle)->getWidth(); } - - GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle) { - return ((GHOST_Rect *)rectanglehandle)->getHeight(); + return ((GHOST_Rect *)rectanglehandle)->getHeight(); } - - void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 *l, GHOST_TInt32 *t, GHOST_TInt32 *r, GHOST_TInt32 *b) { - GHOST_Rect *rect = (GHOST_Rect *) rectanglehandle; + GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle; - *l = rect->m_l; - *t = rect->m_t; - *r = rect->m_r; - *b = rect->m_b; + *l = rect->m_l; + *t = rect->m_t; + *r = rect->m_r; + *b = rect->m_b; } - void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b) { - ((GHOST_Rect *)rectanglehandle)->set(l, t, r, b); + ((GHOST_Rect *)rectanglehandle)->set(l, t, r, b); } - - GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle) { - GHOST_TSuccess result = GHOST_kFailure; + GHOST_TSuccess result = GHOST_kFailure; - if (((GHOST_Rect *)rectanglehandle)->isEmpty()) - result = GHOST_kSuccess; + if (((GHOST_Rect *)rectanglehandle)->isEmpty()) + result = GHOST_kSuccess; - return result; + return result; } - - GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle) { - GHOST_TSuccess result = GHOST_kFailure; + GHOST_TSuccess result = GHOST_kFailure; - if (((GHOST_Rect *)rectanglehandle)->isValid()) - result = GHOST_kSuccess; + if (((GHOST_Rect *)rectanglehandle)->isValid()) + result = GHOST_kSuccess; - return result; + return result; } - - -void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, - GHOST_TInt32 i) +void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 i) { - ((GHOST_Rect *)rectanglehandle)->inset(i); + ((GHOST_Rect *)rectanglehandle)->inset(i); } - - void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_RectangleHandle anotherrectanglehandle) { - ((GHOST_Rect *)rectanglehandle)->unionRect(*(GHOST_Rect *)anotherrectanglehandle); + ((GHOST_Rect *)rectanglehandle)->unionRect(*(GHOST_Rect *)anotherrectanglehandle); } - - void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 x, GHOST_TInt32 y) { - ((GHOST_Rect *)rectanglehandle)->unionPoint(x, y); + ((GHOST_Rect *)rectanglehandle)->unionPoint(x, y); } - - GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 x, GHOST_TInt32 y) { - GHOST_TSuccess result = GHOST_kFailure; + GHOST_TSuccess result = GHOST_kFailure; - if (((GHOST_Rect *)rectanglehandle)->isInside(x, y)) - result = GHOST_kSuccess; + if (((GHOST_Rect *)rectanglehandle)->isInside(x, y)) + result = GHOST_kSuccess; - return result; + return result; } - - GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle, GHOST_RectangleHandle anotherrectanglehandle) { - GHOST_TVisibility visible = GHOST_kNotVisible; + GHOST_TVisibility visible = GHOST_kNotVisible; - visible = ((GHOST_Rect *)rectanglehandle)->getVisibility(*(GHOST_Rect *)anotherrectanglehandle); + visible = ((GHOST_Rect *)rectanglehandle)->getVisibility(*(GHOST_Rect *)anotherrectanglehandle); - return visible; + return visible; } - - void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 cx, GHOST_TInt32 cy) { - ((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy); + ((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy); } - - void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h) { - ((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy, w, h); + ((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy, w, h); } - - GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_RectangleHandle anotherrectanglehandle) { - GHOST_TSuccess result = GHOST_kFailure; + GHOST_TSuccess result = GHOST_kFailure; - if (((GHOST_Rect *)rectanglehandle)->clip(*(GHOST_Rect *)anotherrectanglehandle)) - result = GHOST_kSuccess; + if (((GHOST_Rect *)rectanglehandle)->clip(*(GHOST_Rect *)anotherrectanglehandle)) + result = GHOST_kSuccess; - return result; + return result; } GHOST_TUns8 *GHOST_getClipboard(int selection) { - GHOST_ISystem *system = GHOST_ISystem::getSystem(); - return system->getClipboard(selection); + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + return system->getClipboard(selection); } void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection) { - GHOST_ISystem *system = GHOST_ISystem::getSystem(); - system->putClipboard(buffer, selection); + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + system->putClipboard(buffer, selection); } int GHOST_toggleConsole(int action) { - GHOST_ISystem *system = GHOST_ISystem::getSystem(); - return system->toggleConsole(action); + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + return system->toggleConsole(action); } int GHOST_SupportsNativeDialogs(void) { - GHOST_ISystem *system = GHOST_ISystem::getSystem(); - return system->supportsNativeDialogs(); + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + return system->supportsNativeDialogs(); } int GHOST_confirmQuit(GHOST_WindowHandle windowhandle) { - GHOST_ISystem *system = GHOST_ISystem::getSystem(); - return system->confirmQuit((GHOST_IWindow *) windowhandle); + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + return system->confirmQuit((GHOST_IWindow *)windowhandle); } int GHOST_UseNativePixels(void) { - GHOST_ISystem *system = GHOST_ISystem::getSystem(); - return system->useNativePixel(); + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + return system->useNativePixel(); } void GHOST_UseWindowFocus(int use_focus) { - GHOST_ISystem *system = GHOST_ISystem::getSystem(); - return system->useWindowFocus(use_focus); + GHOST_ISystem *system = GHOST_ISystem::getSystem(); + return system->useWindowFocus(use_focus); } float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; - if (window) - return window->getNativePixelSize(); - return 1.0f; + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; + if (window) + return window->getNativePixelSize(); + return 1.0f; } GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; - return window->getDPIHint(); + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; + return window->getDPIHint(); } #ifdef WITH_INPUT_IME void GHOST_BeginIME(GHOST_WindowHandle windowhandle, - GHOST_TInt32 x, GHOST_TInt32 y, - GHOST_TInt32 w, GHOST_TInt32 h, + GHOST_TInt32 x, + GHOST_TInt32 y, + GHOST_TInt32 w, + GHOST_TInt32 h, int complete) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; - window->beginIME(x, y, w, h, complete); + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; + window->beginIME(x, y, w, h, complete); } void GHOST_EndIME(GHOST_WindowHandle windowhandle) { - GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; - window->endIME(); + GHOST_IWindow *window = (GHOST_IWindow *)windowhandle; + window->endIME(); } -#endif /* WITH_INPUT_IME */ +#endif /* WITH_INPUT_IME */ |