Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / Utils.xs
1 #############################################################################
2 ## Name:        XS/Utils.xs
3 ## Purpose:     XS for some utility classes
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     09/02/2001
7 ## RCS-ID:      $Id: Utils.xs 2315 2008-01-18 21:47:17Z mbarbon $
8 ## Copyright:   (c) 2001-2003, 2005-2008 Mattia Barbon
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 #include <wx/busyinfo.h>
14 #include <wx/settings.h>
15 #include <wx/caret.h>
16 #include <wx/snglinst.h>
17 #include <wx/splash.h>
18 #include <wx/utils.h>
19 #include <wx/debug.h>
20 #include <wx/tipdlg.h>
21 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
22 #include <wx/sysopt.h>
23 #endif
24 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
25 #ifdef __WXGTK20__
26 #define __WXGTK20__DEFINED
27 #undef __WXGTK20__
28 #endif
29 #include <wx/stockitem.h>
30 #ifdef __WXGTK20__DEFINED
31 #define __WXGTK20__
32 #endif
33 #endif
34 #include "cpp/tipprovider.h"
35
36 MODULE=Wx PACKAGE=Wx::CaretSuspend
37
38 wxCaretSuspend*
39 wxCaretSuspend::new( window )
40     wxWindow* window
41
42 static void
43 wxCaretSuspend::CLONE()
44   CODE:
45     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
46
47 ## // thread OK
48 void
49 wxCaretSuspend::DESTROY()
50   CODE:
51     wxPli_thread_sv_unregister( aTHX_ "Wx::CaretSuspend", THIS, ST(0) );
52     delete THIS;
53
54 MODULE=Wx PACKAGE=Wx::SplashScreen
55
56 #ifndef wxFRAME_FLOAT_ON_PARENT
57 #define wxFRAME_FLOAT_ON_PARENT 0
58 #endif
59
60 #ifndef wxFRAME_TOOL_WINDOW
61 #define wxFRAME_TOOL_WINDOW 0
62 #endif
63
64 wxSplashScreen*
65 wxSplashScreen::new( bitmap, splashStyle, milliseconds, parent, id = wxID_ANY, pos = wxDefaultPosition, size = wxDefaultSize, style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP )
66     wxBitmap* bitmap
67     long splashStyle
68     int milliseconds
69     wxWindow* parent
70     wxWindowID id
71     wxPoint pos
72     wxSize size
73     long style
74   CODE:
75     RETVAL = new wxSplashScreen( *bitmap, splashStyle, milliseconds, parent,
76         id, pos, size, style );
77   OUTPUT:
78     RETVAL
79
80 long
81 wxSplashScreen::GetSplashStyle()
82
83 wxSplashScreenWindow*
84 wxSplashScreen::GetSplashWindow()
85
86 int
87 wxSplashScreen::GetTimeout()
88
89 MODULE=Wx PACKAGE=Wx::WindowDisabler
90
91 wxWindowDisabler*
92 wxWindowDisabler::new( skip = 0 )
93     wxWindow* skip
94
95 static void
96 wxWindowDisabler::CLONE()
97   CODE:
98     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
99
100 ## // thread OK
101 void
102 wxWindowDisabler::DESTROY()
103   CODE:
104     wxPli_thread_sv_unregister( aTHX_ "Wx::WindowDisabler", THIS, ST(0) );
105     delete THIS;
106
107 MODULE=Wx PACKAGE=Wx::BusyCursor
108
109 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
110
111 wxBusyCursor*
112 wxBusyCursor::new( cursor = wxHOURGLASS_CURSOR )
113     const wxCursor* cursor
114
115 #else
116
117 wxBusyCursor*
118 wxBusyCursor::new( cursor = wxHOURGLASS_CURSOR )
119     wxCursor* cursor
120
121 #endif
122
123 static void
124 wxBusyCursor::CLONE()
125   CODE:
126     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
127
128 ## // thread OK
129 void
130 wxBusyCursor::DESTROY()
131   CODE:
132     wxPli_thread_sv_unregister( aTHX_ "Wx::BusyCursor", THIS, ST(0) );
133     delete THIS;
134
135 MODULE=Wx PACKAGE=Wx::BusyInfo
136
137 wxBusyInfo*
138 wxBusyInfo::new( message )
139     wxString message
140
141 static void
142 wxBusyInfo::CLONE()
143   CODE:
144     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
145
146 ## // thread OK
147 void
148 wxBusyInfo::DESTROY()
149   CODE:
150     wxPli_thread_sv_unregister( aTHX_ "Wx::BusyInfo", THIS, ST(0) );
151     delete THIS;
152
153 MODULE=Wx PACKAGE=Wx::StopWatch
154
155 #ifdef Pause
156 #undef Pause
157 #endif
158
159 wxStopWatch*
160 wxStopWatch::new()
161
162 static void
163 wxStopWatch::CLONE()
164   CODE:
165     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
166
167 ## // thread OK
168 void
169 wxStopWatch::DESTROY()
170   CODE:
171     wxPli_thread_sv_unregister( aTHX_ "Wx::StopWatch", THIS, ST(0) );
172     delete THIS;
173
174 void
175 wxStopWatch::Pause()
176
177 void
178 wxStopWatch::Start( milliseconds = 0 )
179     long milliseconds
180
181 void
182 wxStopWatch::Resume()
183
184 long
185 wxStopWatch::Time()
186
187 MODULE=Wx PACKAGE=Wx::SingleInstanceChecker
188
189 #if wxUSE_SNGLINST_CHECKER
190
191 wxSingleInstanceChecker*
192 wxSingleInstanceChecker::new()
193
194 static void
195 wxSingleInstanceChecker::CLONE()
196   CODE:
197     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
198
199 ## // thread OK
200 void
201 wxSingleInstanceChecker::DESTROY()
202   CODE:
203     wxPli_thread_sv_unregister( aTHX_ "Wx::SingleInstanceChecker", THIS, ST(0) );
204     delete THIS;
205
206 bool
207 wxSingleInstanceChecker::Create( name, path = wxEmptyString )
208     wxString name
209     wxString path
210
211 bool
212 wxSingleInstanceChecker::IsAnotherRunning()
213
214 #endif
215
216 #if WXPERL_W_VERSION_GE( 2, 8, 0 )
217
218 MODULE=Wx PACKAGE=Wx::SystemOptions
219
220 #define wxSystemOptions_SetOption wxSystemOptions::SetOption
221 #define wxSystemOptions_GetOption wxSystemOptions::GetOption
222 #define wxSystemOptions_GetOptionInt wxSystemOptions::GetOptionInt
223 #define wxSystemOptions_HasOption wxSystemOptions::HasOption
224 #define wxSystemOptions_IsFalse wxSystemOptions::IsFalse
225
226 void
227 SetOption( name, value )
228     wxString name
229     wxString value
230   CODE:
231     wxSystemOptions_SetOption( name, value);
232     
233 void
234 SetOptionInt( name, value )
235     wxString name
236     int value
237   CODE:
238     wxSystemOptions_SetOption( name, value);
239     
240 wxString
241 GetOption( name )
242     wxString name
243   CODE:
244     RETVAL = wxSystemOptions_GetOption( name );
245   OUTPUT: RETVAL
246     
247 int
248 GetOptionInt( name )
249     wxString name
250   CODE:
251     RETVAL = wxSystemOptions_GetOptionInt( name );
252   OUTPUT: RETVAL    
253
254 bool
255 HasOption( name )
256     wxString name
257   CODE:
258     RETVAL = wxSystemOptions_HasOption( name );
259   OUTPUT: RETVAL    
260     
261 bool
262 IsFalse( name )
263     wxString name
264   CODE:
265     RETVAL = wxSystemOptions_IsFalse( name );
266   OUTPUT: RETVAL    
267
268 #endif
269
270 MODULE=Wx PACKAGE=Wx::SystemSettings
271
272 #if WXPERL_W_VERSION_GE( 2, 5, 2 )
273 #define wxSystemSettings_GetSystemColour wxSystemSettings::GetColour
274 #define wxSystemSettings_GetSystemFont wxSystemSettings::GetFont
275 #define wxSystemSettings_GetSystemMetric wxSystemSettings::GetMetric
276 #else
277 #define wxSystemSettings_GetSystemColour wxSystemSettings::GetSystemColour
278 #define wxSystemSettings_GetSystemFont wxSystemSettings::GetSystemFont
279 #define wxSystemSettings_GetSystemMetric wxSystemSettings::GetSystemMetric
280 #endif
281
282 wxColour*
283 GetColour( index )
284     wxSystemColour index
285   CODE:
286     RETVAL = new wxColour( wxSystemSettings_GetSystemColour( index ) );
287   OUTPUT: RETVAL
288
289 wxColour*
290 GetSystemColour( index )
291     wxSystemColour index
292   CODE:
293     RETVAL = new wxColour( wxSystemSettings_GetSystemColour( index ) );
294   OUTPUT: RETVAL
295
296 wxFont*
297 GetFont( index )
298     wxSystemFont index
299   CODE:
300     RETVAL = new wxFont( wxSystemSettings_GetSystemFont( index ) );
301   OUTPUT: RETVAL
302
303 wxFont*
304 GetSystemFont( index )
305     wxSystemFont index
306   CODE:
307     RETVAL = new wxFont( wxSystemSettings_GetSystemFont( index ) );
308   OUTPUT: RETVAL
309
310 int
311 GetMetric( index )
312     wxSystemMetric index
313   CODE:
314     RETVAL = wxSystemSettings_GetSystemMetric( index );
315   OUTPUT: RETVAL
316
317 int
318 GetSystemMetric( index )
319     wxSystemMetric index
320   CODE:
321     RETVAL = wxSystemSettings_GetSystemMetric( index );
322   OUTPUT: RETVAL
323
324 wxSystemScreenType
325 GetScreenType()
326   CODE:
327     RETVAL = wxSystemSettings::GetScreenType();
328   OUTPUT: RETVAL
329
330 MODULE=Wx PACKAGE=Wx::TipProvider
331
332 wxTipProvider*
333 wxTipProvider::new( currentTip )
334     size_t currentTip
335   CODE:
336     RETVAL = new wxPliTipProvider( CLASS, currentTip );
337   OUTPUT:
338     RETVAL
339
340 void
341 wxTipProvider::Destroy()
342   CODE:
343     delete THIS;
344
345 size_t
346 wxTipProvider::GetCurrentTip()
347
348 wxString
349 wxTipProvider::GetTip()
350
351 wxString
352 wxTipProvider::PreprocessTip( tip )
353     wxString tip
354
355 void
356 wxTipProvider::SetCurrentTip( number )
357     size_t number
358   CODE:
359     ((wxPliTipProvider*)THIS)->SetCurrentTip( number );
360
361 MODULE=Wx PACKAGE=Wx::Thread
362
363 #if wxUSE_THREADS
364
365 #include <wx/thread.h>
366
367 bool
368 IsMain()
369   CODE:
370     RETVAL = wxThread::IsMain();
371   OUTPUT:
372     RETVAL
373
374 #endif
375
376 MODULE=Wx PACKAGE=Wx PREFIX=wx
377
378 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
379
380 bool
381 wxIsStockID( wxWindowID id )
382
383 bool
384 wxIsStockLabel( wxWindowID id, wxString label )
385
386 #if WXPERL_W_VERSION_GE( 2, 6, 3 )
387
388 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
389
390 wxString
391 wxGetStockLabel( wxWindowID id, long flags = wxSTOCK_WITH_MNEMONIC )
392
393 #else
394
395 wxString
396 wxGetStockLabel( wxWindowID id, bool withCodes = true, wxString accelerator = wxEmptyString )
397
398 #endif
399
400 #else
401
402 wxString
403 wxGetStockLabel( wxWindowID id )
404
405 #endif
406
407 #endif
408
409 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
410
411 wxAcceleratorEntry*
412 wxGetStockAccelerator( wxWindowID id )
413   CODE:
414     RETVAL = new wxAcceleratorEntry( wxGetStockAccelerator( id ) );
415   OUTPUT: RETVAL
416
417 wxString
418 wxGetStockHelpString( wxWindowID id, wxStockHelpStringClient client = wxSTOCK_MENU )
419
420 #endif
421
422 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
423
424 bool
425 wxLaunchDefaultBrowser( url, flags = 0 )
426     wxString url
427     int flags
428
429 #else
430 #if WXPERL_W_VERSION_GE( 2, 6, 1 )
431
432 bool
433 wxLaunchDefaultBrowser( url )
434     wxString url
435
436 #endif
437 #endif
438
439 bool
440 wxShowTip( parent, tipProvider, showAtStartup = true )
441     wxWindow* parent
442     wxTipProvider* tipProvider
443     bool showAtStartup
444
445 wxTipProvider*
446 wxCreateFileTipProvider( filename, currentTip )
447     wxString filename
448     size_t currentTip
449
450 void
451 wxUsleep( ms )
452     unsigned long ms
453   CODE:
454 #if WXPERL_W_VERSION_LE( 2, 5, 2 )
455     wxUsleep( ms );
456 #else
457     wxMilliSleep( ms );
458 #endif
459
460 #if WXPERL_W_VERSION_GE( 2, 5, 3 )
461
462 void
463 wxMicroSleep( ms )
464     unsigned long ms
465
466 #endif
467
468 void
469 wxMilliSleep( ms )
470     unsigned long ms
471   CODE:
472 #if WXPERL_W_VERSION_LE( 2, 5, 2 )
473     wxUsleep( ms );
474 #else
475     wxMilliSleep( ms );
476 #endif
477
478 void
479 wxSleep( sec )
480     int sec
481
482 bool
483 wxYield()
484
485 bool
486 wxSafeYield( window = 0, onlyIfNeeded = false )
487     wxWindow* window
488     bool onlyIfNeeded
489
490 bool
491 wxYieldIfNeeded()
492
493 void
494 wxTrap()
495
496 wxString
497 wxGetOsDescription()
498
499 long
500 wxNewId()
501
502 wxEventType
503 wxNewEventType()
504
505 void
506 wxRegisterId( id )
507     long id
508
509 void
510 wxBell()
511
512 void
513 wxExit()
514
515 bool
516 wxShell( command = wxEmptyString )
517     wxString command
518
519 #if WXPERL_W_VERSION_GE( 2, 6, 0 )
520
521 bool
522 wxGetKeyState( key )
523     wxKeyCode key
524
525 #endif
526
527 MODULE=Wx PACKAGE=Wx
528
529 void
530 _utf8_on( sv )
531     SV* sv
532   CODE:
533     SvUTF8_on( sv );
534
535 void
536 _utf8_off( sv )
537     SV* sv
538   CODE:
539     SvUTF8_off( sv );