Changed getClipbaord and putClipboard functions to be more ghost like
[blender.git] / intern / ghost / intern / GHOST_C-api.cpp
1 /**
2  * $Id$
3  * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version. The Blender
9  * Foundation also sells licenses for use in proprietary software under
10  * the Blender License.  See http://www.blender.org/BL/ for information
11  * about this.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  *
22  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23  * All rights reserved.
24  *
25  * The Original Code is: all of this file.
26  *
27  * Contributor(s): none yet.
28  *
29  * ***** END GPL/BL DUAL LICENSE BLOCK *****
30  */
31
32 /*
33
34  * GHOST_C-Api.cpp
35  *
36  * C Api for GHOST
37  *
38  * Version: $Id$
39  */
40
41 #include <stdlib.h>
42
43 #ifdef HAVE_CONFIG_H
44 #include <config.h>
45 #endif
46
47 #include "intern/GHOST_Debug.h"
48 #include "GHOST_C-api.h"
49 #include "GHOST_ISystem.h"
50 #include "GHOST_IEvent.h"
51 #include "GHOST_IEventConsumer.h"
52 #include "intern/GHOST_CallbackEventConsumer.h"
53
54 #ifdef WIN32
55 #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
56 #endif //WIN32
57
58
59 GHOST_SystemHandle GHOST_CreateSystem(void)
60 {
61         GHOST_ISystem::createSystem();
62         GHOST_ISystem* system = GHOST_ISystem::getSystem();
63
64         return (GHOST_SystemHandle)system;
65 }
66
67
68
69 GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
70 {
71         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
72
73         return system->disposeSystem();
74 }
75
76
77 GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback, GHOST_TUserDataPtr userdata)
78 {
79         return (GHOST_EventConsumerHandle) new GHOST_CallbackEventConsumer (eventCallback, userdata);
80 }
81
82
83 GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle)
84 {
85         delete ((GHOST_CallbackEventConsumer*)consumerhandle);
86         return GHOST_kSuccess;
87 }
88
89
90 GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
91 {
92         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
93
94         return system->getMilliSeconds();
95 }
96
97
98
99 GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
100                                                                                  GHOST_TUns64 delay,
101                                                                                  GHOST_TUns64 interval,
102                                                                                  GHOST_TimerProcPtr timerproc,
103                                                                                  GHOST_TUserDataPtr userdata)
104 {
105         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
106
107         return (GHOST_TimerTaskHandle) system->installTimer(delay, interval, timerproc, userdata);
108 }
109
110
111
112 GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
113                                                                  GHOST_TimerTaskHandle timertaskhandle)
114 {
115         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
116         GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
117
118         return system->removeTimer(timertask);
119 }
120
121
122
123 GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
124 {
125         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
126
127         return system->getNumDisplays();
128 }
129
130
131
132 void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
133                                                                         GHOST_TUns32* width,
134                                                                         GHOST_TUns32* height)
135 {
136         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
137         
138         system->getMainDisplayDimensions(*width, *height);
139 }
140
141
142
143 GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
144                                                                           char* title,
145                                                                           GHOST_TInt32 left,
146                                                                           GHOST_TInt32 top,
147                                                                           GHOST_TUns32 width,
148                                                                           GHOST_TUns32 height,
149                                                                           GHOST_TWindowState state,
150                                                                           GHOST_TDrawingContextType type,
151                                                                           const int stereoVisual)
152 {
153         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
154         bool bstereoVisual;
155
156         if(stereoVisual)
157                 bstereoVisual = true;
158         else
159                 bstereoVisual = false;
160
161         return (GHOST_WindowHandle) system->createWindow(title, left, top, width, height,
162                 state, type, bstereoVisual);
163 }
164
165 GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
166 {
167         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
168
169         return window->getUserData();
170 }
171 void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr userdata)
172 {
173         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
174
175         window->setUserData(userdata);
176 }
177
178 GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
179                                                                    GHOST_WindowHandle windowhandle)
180 {
181         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
182         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
183         
184         return system->disposeWindow(window);
185 }
186
187
188
189 int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
190                                                                  GHOST_WindowHandle windowhandle)
191 {
192         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
193         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
194         
195         return (int) system->validWindow(window);
196 }
197
198
199
200 GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
201                                                                                  GHOST_DisplaySetting* setting,
202                                                                                  const int stereoVisual)
203 {
204         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
205         GHOST_IWindow* window = NULL;
206         bool bstereoVisual;
207
208         if(stereoVisual)
209                 bstereoVisual = true;
210         else
211                 bstereoVisual = false;
212         
213         system->beginFullScreen(*setting, &window, bstereoVisual);
214
215         return (GHOST_WindowHandle)window;
216 }
217
218
219
220 GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle)
221 {
222         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
223
224         return system->endFullScreen();
225 }
226
227
228
229 int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
230 {
231         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
232
233         return (int) system->getFullScreen();
234 }
235
236
237
238 int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent)
239 {
240         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
241         
242         return (int) system->processEvents(waitForEvent?true:false);
243 }
244
245
246
247 int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
248 {
249         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
250         
251         return (int) system->dispatchEvents();
252 }
253
254
255 GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
256 {
257         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
258         
259         return system->addEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle);
260 }
261
262
263
264 GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle)
265 {
266         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
267
268         return window->getCursorShape();
269 }
270
271
272
273 GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
274                                                                         GHOST_TStandardCursor cursorshape)
275 {
276         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
277
278         return window->setCursorShape(cursorshape);
279 }
280
281 GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
282                                                                                   GHOST_TUns8 bitmap[16][2], 
283                                                                                   GHOST_TUns8 mask[16][2], 
284                                                                                   int hotX, 
285                                                                                   int hotY)
286 {
287         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
288
289         return window->setCustomCursorShape(bitmap, mask, hotX, hotY);
290 }
291
292 GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
293                                                                                   GHOST_TUns8 *bitmap, 
294                                                                                   GHOST_TUns8 *mask, 
295                                                                                   int sizex, 
296                                                                                   int sizey,
297                                                                                   int hotX, 
298                                                                                   int hotY, 
299                                                                                   int fg_color, 
300                                                                                   int bg_color)
301 {
302         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
303
304         return window->setCustomCursorShape(bitmap, mask, sizex, sizey, 
305                                                                                                 hotX, hotY, fg_color, bg_color);
306 }
307
308
309
310 int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
311 {
312         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
313
314         return (int) window->getCursorVisibility();
315 }
316
317
318
319 GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
320                                                                                  int visible)
321 {
322         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
323
324         return window->setCursorVisibility(visible?true:false);
325 }
326
327
328
329 GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
330                                                                            GHOST_TInt32* x,
331                                                                            GHOST_TInt32* y)
332 {
333         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
334         
335         return system->getCursorPosition(*x, *y);
336 }
337
338
339
340 GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
341                                                                            GHOST_TInt32 x,
342                                                                            GHOST_TInt32 y)
343 {
344         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
345         
346         return system->setCursorPosition(x, y);
347 }
348
349
350
351 GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
352                                                                                  GHOST_TModifierKeyMask mask,
353                                                                                  int* isDown)
354 {
355         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
356         GHOST_TSuccess result;
357         bool isdown;
358         
359         result = system->getModifierKeyState(mask, isdown);
360         *isDown = (int) isdown;
361
362         return result;
363 }
364
365
366
367 GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
368                                                                         GHOST_TButtonMask mask,
369                                                                         int* isDown)
370 {
371         GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
372         GHOST_TSuccess result;
373         bool isdown;
374         
375         result = system->getButtonState(mask, isdown);
376         *isDown = (int) isdown;
377
378         return result;
379 }
380
381
382
383 GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
384 {
385         GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
386         
387         return event->getType();
388 }
389
390
391
392 GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle)
393 {
394         GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
395
396         return event->getTime();
397 }
398
399
400 GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
401 {
402         GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
403
404         return (GHOST_WindowHandle) event->getWindow();
405 }
406
407
408 GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
409 {
410         GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
411         
412         return event->getData();
413 }
414
415
416
417 GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
418 {
419         GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
420         
421         return timertask->getTimerProc();
422 }
423
424
425
426 void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
427                                                 GHOST_TimerProcPtr timerproc)
428 {
429         GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
430         
431         timertask->setTimerProc(timerproc);
432 }
433
434
435
436 GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle)
437 {
438         GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
439
440         return timertask->getUserData();
441 }
442
443         
444
445 void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
446                                                                 GHOST_TUserDataPtr userdata)
447 {
448         GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
449         
450         timertask->setUserData(userdata);
451 }
452
453
454
455 int GHOST_GetValid(GHOST_WindowHandle windowhandle) 
456 {
457         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
458
459         return (int) window->getValid();
460 }
461
462
463
464 GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle)
465 {
466         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
467
468         return window->getDrawingContextType();
469 }
470
471
472
473 GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
474                                                                                    GHOST_TDrawingContextType type)
475 {
476         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
477
478         return window->setDrawingContextType(type);
479 }
480
481
482
483 void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
484                                         char* title)
485 {
486         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
487         
488         window->setTitle(title);
489 }
490
491
492 char* GHOST_GetTitle(GHOST_WindowHandle windowhandle)
493 {
494         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
495         STR_String title;
496
497         window->getTitle(title);
498
499         char *ctitle = (char*) malloc(title.Length() + 1);
500
501         if (ctitle == NULL) return NULL;
502         strcpy(ctitle, title.Ptr());
503                 
504         return ctitle;
505 }
506
507
508
509 GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle) 
510 {
511         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
512         GHOST_Rect* rectangle = NULL;
513
514         rectangle = new GHOST_Rect();
515         window->getWindowBounds(*rectangle);
516
517         return (GHOST_RectangleHandle)rectangle;
518 }
519
520
521
522 GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle) 
523 {
524         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
525         GHOST_Rect* rectangle = NULL;
526
527         rectangle = new GHOST_Rect();
528         window->getClientBounds(*rectangle);
529
530         return (GHOST_RectangleHandle)rectangle;
531 }
532
533
534
535 void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
536 {
537         delete (GHOST_Rect*) rectanglehandle;
538 }
539
540
541
542 GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
543                                                                         GHOST_TUns32 width)
544 {
545         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
546
547         return window->setClientWidth(width);
548 }
549
550
551
552 GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
553                                                                          GHOST_TUns32 height)
554 {
555         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
556
557         return window->setClientHeight(height);
558 }
559
560
561
562 GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
563                                                                    GHOST_TUns32 width,
564                                                                    GHOST_TUns32 height)
565 {
566         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
567
568         return window->setClientSize(width, height);
569 }
570
571
572
573 void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
574                                                   GHOST_TInt32 inX,
575                                                   GHOST_TInt32 inY,
576                                                   GHOST_TInt32* outX,
577                                                   GHOST_TInt32* outY) 
578 {
579         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
580
581         window->screenToClient(inX, inY, *outX, *outY);
582 }
583
584
585
586 void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
587                                                   GHOST_TInt32 inX,
588                                                   GHOST_TInt32 inY,
589                                                   GHOST_TInt32* outX,
590                                                   GHOST_TInt32* outY)
591 {
592         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
593
594         window->clientToScreen(inX, inY, *outX, *outY);
595 }
596
597
598
599 GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
600 {
601         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
602
603         return window->getState();
604 }
605
606
607
608 GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
609                                                                         GHOST_TWindowState state)
610 {
611         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
612
613         return window->setState(state);
614 }
615
616
617
618 GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
619                                                                         GHOST_TWindowOrder order)
620 {
621         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
622         
623         return window->setOrder(order);
624 }
625
626
627
628 GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle)
629 {
630         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
631
632         return window->swapBuffers();
633 }
634
635
636
637 GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
638 {
639         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
640         
641         return window->activateDrawingContext();
642 }
643
644
645
646 GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
647 {
648         GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
649
650         return window->invalidate();
651 }
652
653
654 extern const GHOST_TabletData* GHOST_GetTabletData(GHOST_WindowHandle windowhandle)
655 {
656         return ((GHOST_IWindow*)windowhandle)->GetTabletData();
657 }
658
659
660 GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
661 {
662         return ((GHOST_Rect*)rectanglehandle)->getWidth();
663 }
664
665
666
667 GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
668 {
669         return ((GHOST_Rect*)rectanglehandle)->getHeight();
670 }
671
672
673
674 void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
675                                                            GHOST_TInt32* l,
676                                                            GHOST_TInt32* t,
677                                                            GHOST_TInt32* r,
678                                                            GHOST_TInt32* b)
679 {
680         GHOST_Rect *rect= (GHOST_Rect*) rectanglehandle;
681         
682         *l= rect->m_l;
683         *t= rect->m_t;
684         *r= rect->m_r;
685         *b= rect->m_b;
686 }
687
688
689 void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
690                                                 GHOST_TInt32 l,
691                                                 GHOST_TInt32 t,
692                                                 GHOST_TInt32 r,
693                                                 GHOST_TInt32 b)
694 {
695         ((GHOST_Rect*)rectanglehandle)->set(l, t, r, b);
696 }
697
698
699
700 GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle)
701 {
702         GHOST_TSuccess result = GHOST_kFailure;
703
704         if (((GHOST_Rect*)rectanglehandle)->isEmpty())
705                 result = GHOST_kSuccess;
706
707         return result;
708 }
709
710
711
712 GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
713 {
714         GHOST_TSuccess result = GHOST_kFailure;
715
716         if(((GHOST_Rect*)rectanglehandle)->isValid())
717                 result = GHOST_kSuccess;
718
719         return result;
720 }
721
722
723
724 void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
725                                                   GHOST_TInt32 i)
726 {
727         ((GHOST_Rect*)rectanglehandle)->inset(i);
728 }
729
730
731
732 void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
733                                                   GHOST_RectangleHandle anotherrectanglehandle)
734 {
735         ((GHOST_Rect*)rectanglehandle)->unionRect(*(GHOST_Rect*)anotherrectanglehandle);
736 }
737
738
739
740 void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
741                                                            GHOST_TInt32 x,
742                                                            GHOST_TInt32 y)
743 {
744         ((GHOST_Rect*)rectanglehandle)->unionPoint(x, y);
745 }
746
747
748
749 GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
750                                                                            GHOST_TInt32 x,
751                                                                            GHOST_TInt32 y)
752 {
753         GHOST_TSuccess result = GHOST_kFailure;
754
755         if (((GHOST_Rect*)rectanglehandle)->isInside(x, y))
756                 result = GHOST_kSuccess;
757
758         return result;
759 }
760
761
762
763 GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle,
764                                                                                            GHOST_RectangleHandle anotherrectanglehandle)
765 {
766         GHOST_TVisibility visible = GHOST_kNotVisible;
767
768         visible = ((GHOST_Rect*)rectanglehandle)->getVisibility(*(GHOST_Rect*)anotherrectanglehandle);
769
770         return visible;
771 }
772
773
774
775 void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
776                                                           GHOST_TInt32 cx,
777                                                           GHOST_TInt32 cy)
778 {
779         ((GHOST_Rect*)rectanglehandle)->setCenter(cx, cy);
780 }
781
782
783
784 void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
785                                                           GHOST_TInt32 cx,
786                                                           GHOST_TInt32 cy,
787                                                           GHOST_TInt32 w,
788                                                           GHOST_TInt32 h)
789 {
790         ((GHOST_Rect*)rectanglehandle)->setCenter(cx, cy, w, h);
791 }
792
793
794
795 GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
796                                                                    GHOST_RectangleHandle anotherrectanglehandle)
797 {
798         GHOST_TSuccess result = GHOST_kFailure;
799
800         if (((GHOST_Rect*)rectanglehandle)->clip(*(GHOST_Rect*)anotherrectanglehandle))
801                 result = GHOST_kSuccess;
802
803         return result;
804 }
805
806 GHOST_TUns8* GHOST_getClipboard(int flag)
807 {
808         GHOST_ISystem* system = GHOST_ISystem::getSystem();
809         return system->getClipboard(flag);
810 }
811
812 void GHOST_putClipboard(GHOST_TInt8 *buffer, int flag)
813 {
814         GHOST_ISystem* system = GHOST_ISystem::getSystem();
815         system->putClipboard(buffer, flag);
816 }
817