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