Blender V2.61 - r43446
|
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 */ 00033 #ifndef GHOST_C_API_H 00034 #define GHOST_C_API_H 00035 00036 #include "GHOST_Types.h" 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00049 GHOST_DECLARE_HANDLE(GHOST_SystemHandle); 00050 GHOST_DECLARE_HANDLE(GHOST_TimerTaskHandle); 00051 GHOST_DECLARE_HANDLE(GHOST_WindowHandle); 00052 GHOST_DECLARE_HANDLE(GHOST_EventHandle); 00053 GHOST_DECLARE_HANDLE(GHOST_RectangleHandle); 00054 GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle); 00055 00056 00062 typedef int (*GHOST_EventCallbackProcPtr)(GHOST_EventHandle event, GHOST_TUserDataPtr userdata); 00063 00064 00069 extern GHOST_SystemHandle GHOST_CreateSystem(void); 00070 00076 extern GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle); 00077 00078 00084 extern GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback, 00085 GHOST_TUserDataPtr userdata); 00086 00092 extern GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle); 00093 00094 00102 extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle); 00103 00115 extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle, 00116 GHOST_TUns64 delay, 00117 GHOST_TUns64 interval, 00118 GHOST_TimerProcPtr timerProc, 00119 GHOST_TUserDataPtr userData); 00120 00127 extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle, 00128 GHOST_TimerTaskHandle timertaskhandle); 00129 00130 /*************************************************************************************** 00131 ** Display/window management functionality 00132 ***************************************************************************************/ 00133 00139 extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle); 00140 00148 extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle, 00149 GHOST_TUns32* width, 00150 GHOST_TUns32* height); 00151 00168 extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle, 00169 const char* title, 00170 GHOST_TInt32 left, 00171 GHOST_TInt32 top, 00172 GHOST_TUns32 width, 00173 GHOST_TUns32 height, 00174 GHOST_TWindowState state, 00175 GHOST_TDrawingContextType type, 00176 const int stereoVisual, 00177 const GHOST_TUns16 numOfAASamples); 00178 00184 extern GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle); 00185 00191 extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, 00192 GHOST_TUserDataPtr userdata); 00193 00200 extern GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle, 00201 GHOST_WindowHandle windowhandle); 00202 00209 extern int GHOST_ValidWindow(GHOST_SystemHandle systemhandle, 00210 GHOST_WindowHandle windowhandle); 00211 00219 extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle, 00220 GHOST_DisplaySetting* setting, 00221 const int stereoVisual); 00222 00228 extern GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle); 00229 00235 extern int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle); 00236 00237 /*************************************************************************************** 00238 ** Event management functionality 00239 ***************************************************************************************/ 00240 00248 extern int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent); 00249 00255 extern int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle); 00256 00263 extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, 00264 GHOST_EventConsumerHandle consumerhandle); 00265 00272 extern GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle, 00273 GHOST_EventConsumerHandle consumerhandle); 00274 00275 /*************************************************************************************** 00276 ** Progress bar functionality 00277 ***************************************************************************************/ 00278 00284 extern GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress); 00285 00290 extern GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle); 00291 00292 /*************************************************************************************** 00293 ** Cursor management functionality 00294 ***************************************************************************************/ 00295 00301 extern GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle); 00302 00309 extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle, 00310 GHOST_TStandardCursor cursorshape); 00311 00321 extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle, 00322 GHOST_TUns8 bitmap[16][2], 00323 GHOST_TUns8 mask[16][2], 00324 int hotX, 00325 int hotY); 00337 extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle, 00338 GHOST_TUns8 *bitmap, 00339 GHOST_TUns8 *mask, 00340 int sizex, int sizey, 00341 int hotX, int hotY, 00342 int fg_color, int bg_color ); 00343 00349 extern int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle); 00350 00357 extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, 00358 int visible); 00359 00367 extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle, 00368 GHOST_TInt32* x, 00369 GHOST_TInt32* y); 00370 00379 extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, 00380 GHOST_TInt32 x, 00381 GHOST_TInt32 y); 00382 00392 extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, 00393 GHOST_TGrabCursorMode mode, 00394 int* bounds); 00395 00396 /*************************************************************************************** 00397 ** Access to mouse button and keyboard states. 00398 ***************************************************************************************/ 00399 00407 extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle, 00408 GHOST_TModifierKeyMask mask, 00409 int* isDown); 00410 00418 extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle, 00419 GHOST_TButtonMask mask, 00420 int* isDown); 00421 00422 00423 /*************************************************************************************** 00424 ** Drag'n'drop operations 00425 ***************************************************************************************/ 00426 00430 extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept); 00431 00432 00438 extern GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle); 00439 00445 extern GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle); 00446 00453 extern GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle); 00454 00460 extern GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle); 00461 00467 extern GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle); 00468 00474 extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle, 00475 GHOST_TimerProcPtr timerProc); 00476 00482 extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle); 00483 00489 extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle, 00490 GHOST_TUserDataPtr userData); 00491 00497 extern int GHOST_GetValid(GHOST_WindowHandle windowhandle) ; 00498 00504 extern GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle); 00505 00512 extern GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle, 00513 GHOST_TDrawingContextType type); 00514 00520 extern void GHOST_SetTitle(GHOST_WindowHandle windowhandle, 00521 const char* title); 00522 00530 extern char* GHOST_GetTitle(GHOST_WindowHandle windowhandle); 00531 00538 extern GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle); 00539 00546 extern GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle); 00547 00552 void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle); 00553 00560 extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, 00561 GHOST_TUns32 width); 00562 00569 extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, 00570 GHOST_TUns32 height); 00571 00579 extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle, 00580 GHOST_TUns32 width, 00581 GHOST_TUns32 height); 00582 00591 extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle, 00592 GHOST_TInt32 inX, 00593 GHOST_TInt32 inY, 00594 GHOST_TInt32* outX, 00595 GHOST_TInt32* outY) ; 00596 00605 extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle, 00606 GHOST_TInt32 inX, 00607 GHOST_TInt32 inY, 00608 GHOST_TInt32* outX, 00609 GHOST_TInt32* outY); 00610 00616 extern GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle); 00617 00624 extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, 00625 GHOST_TWindowState state); 00626 00627 00634 extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, 00635 GHOST_TUns8 isUnsavedChanges); 00636 00643 extern GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle, 00644 GHOST_TWindowOrder order); 00645 00651 extern GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle); 00652 00658 extern GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle); 00659 00665 extern GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle); 00666 00672 extern const GHOST_TabletData *GHOST_GetTabletData(GHOST_WindowHandle windowhandle); 00673 00679 extern GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle); 00680 00686 extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle); 00687 00696 extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle, 00697 GHOST_TInt32* l, 00698 GHOST_TInt32* t, 00699 GHOST_TInt32* r, 00700 GHOST_TInt32* b); 00701 00710 extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle, 00711 GHOST_TInt32 l, 00712 GHOST_TInt32 t, 00713 GHOST_TInt32 r, 00714 GHOST_TInt32 b); 00715 00722 extern GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle); 00723 00730 extern GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle); 00731 00738 extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, 00739 GHOST_TInt32 i); 00740 00747 extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle, 00748 GHOST_RectangleHandle anotherrectanglehandle); 00749 00756 extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, 00757 GHOST_TInt32 x, 00758 GHOST_TInt32 y); 00759 00768 extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle, 00769 GHOST_TInt32 x, 00770 GHOST_TInt32 y); 00771 00778 extern GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle, 00779 GHOST_RectangleHandle anotherrectanglehandle); 00780 00788 extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle, 00789 GHOST_TInt32 cx, 00790 GHOST_TInt32 cy); 00791 00802 extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle, 00803 GHOST_TInt32 cx, 00804 GHOST_TInt32 cy, 00805 GHOST_TInt32 w, 00806 GHOST_TInt32 h); 00807 00816 extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle, 00817 GHOST_RectangleHandle anotherrectanglehandle); 00818 00824 extern GHOST_TUns8* GHOST_getClipboard(int selection); 00825 00830 extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection); 00831 00832 00833 00843 extern int GHOST_toggleConsole(int action); 00844 00845 #ifdef __cplusplus 00846 } 00847 #endif 00848 00849 #endif