File: Display.xsp

package info (click to toggle)
libwx-perl 1%3A0.9909-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,912 kB
  • sloc: cpp: 9,728; perl: 8,182; ansic: 626; makefile: 41
file content (118 lines) | stat: -rw-r--r-- 2,936 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#############################################################################
## Name:        XS/Display.xsp
## Purpose:     XS++ for Wx::Display
## Author:      Mattia Barbon
## Modified by:
## Created:     26/09/2007
## RCS-ID:      $Id: Display.xsp 2557 2009-05-11 10:41:11Z mbarbon $
## Copyright:   (c) 2007, 2009 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

%module{Wx};

#include <wx/vidmode.h>
#include <wx/display.h>

#define wxDefaultVideoModePtr (wxVideoMode*)&wxDefaultVideoMode

%typemap{wxDisplay*}{simple};
%typemap{wxVideoMode*}{simple};
%typemap{const wxVideoMode&}{reference};

%name{Wx::VideoMode} class wxVideoMode
{
    wxVideoMode( int width = 0, int height = 0, int depth = 0, int freq = 0 );

%{
static void
wxVideoMode::CLONE()
  CODE:
    wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
%}
    ## // thread OK
    ~wxVideoMode()
        %code%{  wxPli_thread_sv_unregister( aTHX_ "Wx::VideoMode", THIS, ST(0) );
                 delete THIS;
               %};

    bool Matches( const wxVideoMode& other ) const;
    int GetWidth() const;
    int GetHeight() const;
    int GetDepth() const;
    bool IsOk() const;
};

%name{Wx::Display} class wxDisplay
{
    wxDisplay( unsigned n = 0 );

%{
static void
wxDisplay::CLONE()
  CODE:
    wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
%}
    ## // thread OK
    ~wxDisplay()
        %code%{  wxPli_thread_sv_unregister( aTHX_ "Wx::Display", THIS, ST(0) );
                 delete THIS;
               %};

%{
int
GetCount()
  CODE:
    RETVAL = wxDisplay::GetCount();
  OUTPUT: RETVAL

int
GetFromPoint( point )
    wxPoint point
  CODE:
    RETVAL = wxDisplay::GetFromPoint( point );
  OUTPUT: RETVAL

#if WXPERL_W_VERSION_GE( 2, 7, 0 )

int
GetFromWindow( window )
    wxWindow* window
  CODE:
    RETVAL = wxDisplay::GetFromWindow( window );
  OUTPUT: RETVAL

#endif

%}

    bool IsOk() const;
    const wxRect& GetGeometry() const;
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
    const wxRect& GetClientArea() const;
#endif
    wxString GetName() const;
    bool IsPrimary() const;

#if wxUSE_DISPLAY
%{
void
wxDisplay::GetModes( videoMode = wxDefaultVideoModePtr )
    wxVideoMode* videoMode
  PPCODE:
    wxArrayVideoModes modes = THIS->GetModes( *videoMode );
    size_t mx = modes.GetCount();
    EXTEND( SP, int(mx) );
    for( size_t i = 0; i < mx; ++i )
    {
        wxVideoMode* mode = new wxVideoMode( modes[i] );
        PUSHs( wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                      mode, "Wx::VideoMode" ) );
    }
%}
    const wxVideoMode& GetCurrentMode() const;
    bool ChangeMode( const wxVideoMode& mode = wxDefaultVideoModePtr );
    void ResetMode();
#endif // wxUSE_DISPLAY
};