Blender V2.61 - r43446

GHOST_C-api.cpp

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 /*
00034 
00035  * GHOST_C-Api.cpp
00036  *
00037  * C Api for GHOST
00038  *
00039  */
00040 
00041 #include <stdlib.h>
00042 
00043 #include "intern/GHOST_Debug.h"
00044 #include "GHOST_C-api.h"
00045 #include "GHOST_ISystem.h"
00046 #include "GHOST_IEvent.h"
00047 #include "GHOST_IEventConsumer.h"
00048 #include "intern/GHOST_CallbackEventConsumer.h"
00049 
00050 GHOST_SystemHandle GHOST_CreateSystem(void)
00051 {
00052     GHOST_ISystem::createSystem();
00053     GHOST_ISystem* system = GHOST_ISystem::getSystem();
00054 
00055     return (GHOST_SystemHandle)system;
00056 }
00057 
00058 
00059 
00060 GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
00061 {
00062     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00063 
00064     return system->disposeSystem();
00065 }
00066 
00067 
00068 GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
00069                                                     GHOST_TUserDataPtr userdata)
00070 {
00071     return (GHOST_EventConsumerHandle) new GHOST_CallbackEventConsumer (eventCallback, userdata);
00072 }
00073 
00074 
00075 GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle)
00076 {
00077     delete ((GHOST_CallbackEventConsumer*)consumerhandle);
00078     return GHOST_kSuccess;
00079 }
00080 
00081 
00082 GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
00083 {
00084     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00085 
00086     return system->getMilliSeconds();
00087 }
00088 
00089 
00090 
00091 GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
00092                                          GHOST_TUns64 delay,
00093                                          GHOST_TUns64 interval,
00094                                          GHOST_TimerProcPtr timerproc,
00095                                          GHOST_TUserDataPtr userdata)
00096 {
00097     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00098 
00099     return (GHOST_TimerTaskHandle) system->installTimer(delay, interval, timerproc, userdata);
00100 }
00101 
00102 
00103 
00104 GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
00105                                  GHOST_TimerTaskHandle timertaskhandle)
00106 {
00107     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00108     GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
00109 
00110     return system->removeTimer(timertask);
00111 }
00112 
00113 
00114 
00115 GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
00116 {
00117     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00118 
00119     return system->getNumDisplays();
00120 }
00121 
00122 
00123 
00124 void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
00125                                     GHOST_TUns32* width,
00126                                     GHOST_TUns32* height)
00127 {
00128     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00129     
00130     system->getMainDisplayDimensions(*width, *height);
00131 }
00132 
00133 
00134 
00135 GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
00136                                       const char* title,
00137                                       GHOST_TInt32 left,
00138                                       GHOST_TInt32 top,
00139                                       GHOST_TUns32 width,
00140                                       GHOST_TUns32 height,
00141                                       GHOST_TWindowState state,
00142                                       GHOST_TDrawingContextType type,
00143                                       const int stereoVisual,
00144                                       const GHOST_TUns16 numOfAASamples)
00145 {
00146     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00147     bool bstereoVisual;
00148 
00149     if(stereoVisual)
00150         bstereoVisual = true;
00151     else
00152         bstereoVisual = false;
00153 
00154     return (GHOST_WindowHandle) system->createWindow(title, left, top, width, height,
00155         state, type, bstereoVisual, numOfAASamples);
00156 }
00157 
00158 GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
00159 {
00160     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00161 
00162     return window->getUserData();
00163 }
00164 void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr userdata)
00165 {
00166     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00167 
00168     window->setUserData(userdata);
00169 }
00170 
00171 GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
00172                                    GHOST_WindowHandle windowhandle)
00173 {
00174     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00175     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00176     
00177     return system->disposeWindow(window);
00178 }
00179 
00180 
00181 
00182 int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
00183                                  GHOST_WindowHandle windowhandle)
00184 {
00185     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00186     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00187     
00188     return (int) system->validWindow(window);
00189 }
00190 
00191 
00192 
00193 GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
00194                                          GHOST_DisplaySetting* setting,
00195                                          const int stereoVisual)
00196 {
00197     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00198     GHOST_IWindow* window = NULL;
00199     bool bstereoVisual;
00200 
00201     if(stereoVisual)
00202         bstereoVisual = true;
00203     else
00204         bstereoVisual = false;
00205     
00206     system->beginFullScreen(*setting, &window, bstereoVisual);
00207 
00208     return (GHOST_WindowHandle)window;
00209 }
00210 
00211 
00212 
00213 GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle)
00214 {
00215     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00216 
00217     return system->endFullScreen();
00218 }
00219 
00220 
00221 
00222 int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
00223 {
00224     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00225 
00226     return (int) system->getFullScreen();
00227 }
00228 
00229 
00230 
00231 int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent)
00232 {
00233     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00234     
00235     return (int) system->processEvents(waitForEvent?true:false);
00236 }
00237 
00238 
00239 
00240 int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
00241 {
00242     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00243     
00244     return (int) system->dispatchEvents();
00245 }
00246 
00247 
00248 GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
00249 {
00250     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00251     
00252     return system->addEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle);
00253 }
00254 
00255 GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
00256 {
00257     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00258 
00259     return system->removeEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle);
00260 }
00261 
00262 GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle,float progress)
00263 {
00264     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00265 
00266     return window->setProgressBar(progress);
00267 }
00268 
00269 GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
00270 {
00271     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00272 
00273     return window->endProgressBar();
00274 }
00275 
00276 
00277 GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle)
00278 {
00279     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00280 
00281     return window->getCursorShape();
00282 }
00283 
00284 
00285 
00286 GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
00287                                     GHOST_TStandardCursor cursorshape)
00288 {
00289     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00290 
00291     return window->setCursorShape(cursorshape);
00292 }
00293 
00294 GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
00295                                           GHOST_TUns8 bitmap[16][2], 
00296                                           GHOST_TUns8 mask[16][2], 
00297                                           int hotX, 
00298                                           int hotY)
00299 {
00300     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00301 
00302     return window->setCustomCursorShape(bitmap, mask, hotX, hotY);
00303 }
00304 
00305 GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
00306                                           GHOST_TUns8 *bitmap, 
00307                                           GHOST_TUns8 *mask, 
00308                                           int sizex, 
00309                                           int sizey,
00310                                           int hotX, 
00311                                           int hotY, 
00312                                           int fg_color, 
00313                                           int bg_color)
00314 {
00315     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00316 
00317     return window->setCustomCursorShape(bitmap, mask, sizex, sizey, 
00318                                                 hotX, hotY, fg_color, bg_color);
00319 }
00320 
00321 
00322 
00323 int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
00324 {
00325     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00326 
00327     return (int) window->getCursorVisibility();
00328 }
00329 
00330 
00331 
00332 GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
00333                                          int visible)
00334 {
00335     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00336 
00337     return window->setCursorVisibility(visible?true:false);
00338 }
00339 
00340 
00341 
00342 GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
00343                                        GHOST_TInt32* x,
00344                                        GHOST_TInt32* y)
00345 {
00346     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00347     
00348     return system->getCursorPosition(*x, *y);
00349 }
00350 
00351 
00352 
00353 GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
00354                                        GHOST_TInt32 x,
00355                                        GHOST_TInt32 y)
00356 {
00357     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00358     
00359     return system->setCursorPosition(x, y);
00360 }
00361 
00362 
00363 GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
00364                                         GHOST_TGrabCursorMode mode,
00365                                         int *bounds)
00366 {
00367     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00368     GHOST_Rect bounds_rect, bounds_win;
00369 
00370     if(bounds) {
00371         /* if this is X11 specific we need a function that converts */
00372         window->getClientBounds(bounds_win);
00373         window->clientToScreen(bounds[0], bounds_win.getHeight() - bounds[1], bounds_rect.m_l, bounds_rect.m_t);
00374         window->clientToScreen(bounds[2], bounds_win.getHeight() - bounds[3], bounds_rect.m_r, bounds_rect.m_b);
00375 
00376     }
00377     
00378     return window->setCursorGrab(mode, bounds ? &bounds_rect:NULL);
00379 }
00380 
00381 
00382 GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
00383                                          GHOST_TModifierKeyMask mask,
00384                                          int* isDown)
00385 {
00386     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00387     GHOST_TSuccess result;
00388     bool isdown= false;
00389     
00390     result = system->getModifierKeyState(mask, isdown);
00391     *isDown = (int) isdown;
00392 
00393     return result;
00394 }
00395 
00396 
00397 
00398 GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
00399                                     GHOST_TButtonMask mask,
00400                                     int* isDown)
00401 {
00402     GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
00403     GHOST_TSuccess result;
00404     bool isdown= false;
00405     
00406     result = system->getButtonState(mask, isdown);
00407     *isDown = (int) isdown;
00408 
00409     return result;
00410 }
00411 
00412 
00413 void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept)
00414 {
00415     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00416 
00417     window->setAcceptDragOperation(canAccept);
00418 }
00419 
00420 
00421 GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
00422 {
00423     GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
00424     
00425     return event->getType();
00426 }
00427 
00428 
00429 
00430 GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle)
00431 {
00432     GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
00433 
00434     return event->getTime();
00435 }
00436 
00437 
00438 GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
00439 {
00440     GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
00441 
00442     return (GHOST_WindowHandle) event->getWindow();
00443 }
00444 
00445 
00446 GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
00447 {
00448     GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
00449     
00450     return event->getData();
00451 }
00452 
00453 
00454 
00455 GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
00456 {
00457     GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
00458     
00459     return timertask->getTimerProc();
00460 }
00461 
00462 
00463 
00464 void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
00465                         GHOST_TimerProcPtr timerproc)
00466 {
00467     GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
00468     
00469     timertask->setTimerProc(timerproc);
00470 }
00471 
00472 
00473 
00474 GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle)
00475 {
00476     GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
00477 
00478     return timertask->getUserData();
00479 }
00480 
00481     
00482 
00483 void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
00484                                 GHOST_TUserDataPtr userdata)
00485 {
00486     GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
00487     
00488     timertask->setUserData(userdata);
00489 }
00490 
00491 
00492 
00493 int GHOST_GetValid(GHOST_WindowHandle windowhandle) 
00494 {
00495     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00496 
00497     return (int) window->getValid();
00498 }
00499 
00500 
00501 
00502 GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle)
00503 {
00504     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00505 
00506     return window->getDrawingContextType();
00507 }
00508 
00509 
00510 
00511 GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
00512                                            GHOST_TDrawingContextType type)
00513 {
00514     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00515 
00516     return window->setDrawingContextType(type);
00517 }
00518 
00519 
00520 
00521 void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
00522                     const char* title)
00523 {
00524     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00525     
00526     window->setTitle(title);
00527 }
00528 
00529 
00530 char* GHOST_GetTitle(GHOST_WindowHandle windowhandle)
00531 {
00532     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00533     STR_String title;
00534 
00535     window->getTitle(title);
00536 
00537     char *ctitle = (char*) malloc(title.Length() + 1);
00538 
00539     if (ctitle == NULL) return NULL;
00540     strcpy(ctitle, title.Ptr());
00541         
00542     return ctitle;
00543 }
00544 
00545 
00546 
00547 GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle) 
00548 {
00549     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00550     GHOST_Rect* rectangle = NULL;
00551 
00552     rectangle = new GHOST_Rect();
00553     window->getWindowBounds(*rectangle);
00554 
00555     return (GHOST_RectangleHandle)rectangle;
00556 }
00557 
00558 
00559 
00560 GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle) 
00561 {
00562     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00563     GHOST_Rect* rectangle = NULL;
00564 
00565     rectangle = new GHOST_Rect();
00566     window->getClientBounds(*rectangle);
00567 
00568     return (GHOST_RectangleHandle)rectangle;
00569 }
00570 
00571 
00572 
00573 void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
00574 {
00575     delete (GHOST_Rect*) rectanglehandle;
00576 }
00577 
00578 
00579 
00580 GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
00581                                     GHOST_TUns32 width)
00582 {
00583     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00584 
00585     return window->setClientWidth(width);
00586 }
00587 
00588 
00589 
00590 GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
00591                                      GHOST_TUns32 height)
00592 {
00593     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00594 
00595     return window->setClientHeight(height);
00596 }
00597 
00598 
00599 
00600 GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
00601                                    GHOST_TUns32 width,
00602                                    GHOST_TUns32 height)
00603 {
00604     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00605 
00606     return window->setClientSize(width, height);
00607 }
00608 
00609 
00610 
00611 void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
00612                           GHOST_TInt32 inX,
00613                           GHOST_TInt32 inY,
00614                           GHOST_TInt32* outX,
00615                           GHOST_TInt32* outY) 
00616 {
00617     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00618 
00619     window->screenToClient(inX, inY, *outX, *outY);
00620 }
00621 
00622 
00623 
00624 void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
00625                           GHOST_TInt32 inX,
00626                           GHOST_TInt32 inY,
00627                           GHOST_TInt32* outX,
00628                           GHOST_TInt32* outY)
00629 {
00630     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00631 
00632     window->clientToScreen(inX, inY, *outX, *outY);
00633 }
00634 
00635 
00636 
00637 GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
00638 {
00639     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00640 
00641     return window->getState();
00642 }
00643 
00644 
00645 
00646 GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
00647                                     GHOST_TWindowState state)
00648 {
00649     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00650 
00651     return window->setState(state);
00652 }
00653 
00654 
00655 GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, GHOST_TUns8 isUnsavedChanges)
00656 {
00657     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00658     
00659     return window->setModifiedState(isUnsavedChanges);
00660 }   
00661 
00662 
00663 GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
00664                                     GHOST_TWindowOrder order)
00665 {
00666     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00667     
00668     return window->setOrder(order);
00669 }
00670 
00671 
00672 
00673 GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle)
00674 {
00675     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00676 
00677     return window->swapBuffers();
00678 }
00679 
00680 
00681 
00682 GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
00683 {
00684     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00685     
00686     return window->activateDrawingContext();
00687 }
00688 
00689 
00690 
00691 GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
00692 {
00693     GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
00694 
00695     return window->invalidate();
00696 }
00697 
00698 
00699 extern const GHOST_TabletData* GHOST_GetTabletData(GHOST_WindowHandle windowhandle)
00700 {
00701     return ((GHOST_IWindow*)windowhandle)->GetTabletData();
00702 }
00703 
00704 
00705 GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
00706 {
00707     return ((GHOST_Rect*)rectanglehandle)->getWidth();
00708 }
00709 
00710 
00711 
00712 GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
00713 {
00714     return ((GHOST_Rect*)rectanglehandle)->getHeight();
00715 }
00716 
00717 
00718 
00719 void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
00720                                GHOST_TInt32* l,
00721                                GHOST_TInt32* t,
00722                                GHOST_TInt32* r,
00723                                GHOST_TInt32* b)
00724 {
00725     GHOST_Rect *rect= (GHOST_Rect*) rectanglehandle;
00726     
00727     *l= rect->m_l;
00728     *t= rect->m_t;
00729     *r= rect->m_r;
00730     *b= rect->m_b;
00731 }
00732 
00733 
00734 void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
00735                         GHOST_TInt32 l,
00736                         GHOST_TInt32 t,
00737                         GHOST_TInt32 r,
00738                         GHOST_TInt32 b)
00739 {
00740     ((GHOST_Rect*)rectanglehandle)->set(l, t, r, b);
00741 }
00742 
00743 
00744 
00745 GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle)
00746 {
00747     GHOST_TSuccess result = GHOST_kFailure;
00748 
00749     if (((GHOST_Rect*)rectanglehandle)->isEmpty())
00750         result = GHOST_kSuccess;
00751 
00752     return result;
00753 }
00754 
00755 
00756 
00757 GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
00758 {
00759     GHOST_TSuccess result = GHOST_kFailure;
00760 
00761     if(((GHOST_Rect*)rectanglehandle)->isValid())
00762         result = GHOST_kSuccess;
00763 
00764     return result;
00765 }
00766 
00767 
00768 
00769 void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
00770                           GHOST_TInt32 i)
00771 {
00772     ((GHOST_Rect*)rectanglehandle)->inset(i);
00773 }
00774 
00775 
00776 
00777 void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
00778                           GHOST_RectangleHandle anotherrectanglehandle)
00779 {
00780     ((GHOST_Rect*)rectanglehandle)->unionRect(*(GHOST_Rect*)anotherrectanglehandle);
00781 }
00782 
00783 
00784 
00785 void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
00786                                GHOST_TInt32 x,
00787                                GHOST_TInt32 y)
00788 {
00789     ((GHOST_Rect*)rectanglehandle)->unionPoint(x, y);
00790 }
00791 
00792 
00793 
00794 GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
00795                                        GHOST_TInt32 x,
00796                                        GHOST_TInt32 y)
00797 {
00798     GHOST_TSuccess result = GHOST_kFailure;
00799 
00800     if (((GHOST_Rect*)rectanglehandle)->isInside(x, y))
00801         result = GHOST_kSuccess;
00802 
00803     return result;
00804 }
00805 
00806 
00807 
00808 GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle,
00809                                                GHOST_RectangleHandle anotherrectanglehandle)
00810 {
00811     GHOST_TVisibility visible = GHOST_kNotVisible;
00812 
00813     visible = ((GHOST_Rect*)rectanglehandle)->getVisibility(*(GHOST_Rect*)anotherrectanglehandle);
00814 
00815     return visible;
00816 }
00817 
00818 
00819 
00820 void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
00821                               GHOST_TInt32 cx,
00822                               GHOST_TInt32 cy)
00823 {
00824     ((GHOST_Rect*)rectanglehandle)->setCenter(cx, cy);
00825 }
00826 
00827 
00828 
00829 void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
00830                               GHOST_TInt32 cx,
00831                               GHOST_TInt32 cy,
00832                               GHOST_TInt32 w,
00833                               GHOST_TInt32 h)
00834 {
00835     ((GHOST_Rect*)rectanglehandle)->setCenter(cx, cy, w, h);
00836 }
00837 
00838 
00839 
00840 GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
00841                                    GHOST_RectangleHandle anotherrectanglehandle)
00842 {
00843     GHOST_TSuccess result = GHOST_kFailure;
00844 
00845     if (((GHOST_Rect*)rectanglehandle)->clip(*(GHOST_Rect*)anotherrectanglehandle))
00846         result = GHOST_kSuccess;
00847 
00848     return result;
00849 }
00850 
00851 GHOST_TUns8* GHOST_getClipboard(int selection)
00852 {
00853     GHOST_ISystem* system = GHOST_ISystem::getSystem();
00854     return system->getClipboard(selection);
00855 }
00856 
00857 void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
00858 {
00859     GHOST_ISystem* system = GHOST_ISystem::getSystem();
00860     system->putClipboard(buffer, selection);
00861 }
00862 
00863 int GHOST_toggleConsole(int action)
00864 {
00865     GHOST_ISystem* system = GHOST_ISystem::getSystem();
00866     return system->toggleConsole(action);
00867 }