Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / Display.xsp
1 #############################################################################
2 ## Name:        XS/Display.xsp
3 ## Purpose:     XS++ for Wx::Display
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     26/09/2007
7 ## RCS-ID:      $Id: Display.xsp 2557 2009-05-11 10:41:11Z mbarbon $
8 ## Copyright:   (c) 2007, 2009 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 %module{Wx};
14
15 #include <wx/vidmode.h>
16 #include <wx/display.h>
17
18 #define wxDefaultVideoModePtr (wxVideoMode*)&wxDefaultVideoMode
19
20 %typemap{wxDisplay*}{simple};
21 %typemap{wxVideoMode*}{simple};
22 %typemap{const wxVideoMode&}{reference};
23
24 %name{Wx::VideoMode} class wxVideoMode
25 {
26     wxVideoMode( int width = 0, int height = 0, int depth = 0, int freq = 0 );
27
28 %{
29 static void
30 wxVideoMode::CLONE()
31   CODE:
32     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
33 %}
34     ## // thread OK
35     ~wxVideoMode()
36         %code%{  wxPli_thread_sv_unregister( aTHX_ "Wx::VideoMode", THIS, ST(0) );
37                  delete THIS;
38                %};
39
40     bool Matches( const wxVideoMode& other ) const;
41     int GetWidth() const;
42     int GetHeight() const;
43     int GetDepth() const;
44     bool IsOk() const;
45 };
46
47 %name{Wx::Display} class wxDisplay
48 {
49     wxDisplay( unsigned n = 0 );
50
51 %{
52 static void
53 wxDisplay::CLONE()
54   CODE:
55     wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
56 %}
57     ## // thread OK
58     ~wxDisplay()
59         %code%{  wxPli_thread_sv_unregister( aTHX_ "Wx::Display", THIS, ST(0) );
60                  delete THIS;
61                %};
62
63 %{
64 int
65 GetCount()
66   CODE:
67     RETVAL = wxDisplay::GetCount();
68   OUTPUT: RETVAL
69
70 int
71 GetFromPoint( point )
72     wxPoint point
73   CODE:
74     RETVAL = wxDisplay::GetFromPoint( point );
75   OUTPUT: RETVAL
76
77 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
78
79 int
80 GetFromWindow( window )
81     wxWindow* window
82   CODE:
83     RETVAL = wxDisplay::GetFromWindow( window );
84   OUTPUT: RETVAL
85
86 #endif
87
88 %}
89
90     bool IsOk() const;
91     const wxRect& GetGeometry() const;
92 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
93     const wxRect& GetClientArea() const;
94 #endif
95     wxString GetName() const;
96     bool IsPrimary() const;
97
98 #if wxUSE_DISPLAY
99 %{
100 void
101 wxDisplay::GetModes( videoMode = wxDefaultVideoModePtr )
102     wxVideoMode* videoMode
103   PPCODE:
104     wxArrayVideoModes modes = THIS->GetModes( *videoMode );
105     size_t mx = modes.GetCount();
106     EXTEND( SP, int(mx) );
107     for( size_t i = 0; i < mx; ++i )
108     {
109         wxVideoMode* mode = new wxVideoMode( modes[i] );
110         PUSHs( wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
111                                       mode, "Wx::VideoMode" ) );
112     }
113 %}
114     const wxVideoMode& GetCurrentMode() const;
115     bool ChangeMode( const wxVideoMode& mode = wxDefaultVideoModePtr );
116     void ResetMode();
117 #endif // wxUSE_DISPLAY
118 };