File: Icon.xs

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 (190 lines) | stat: -rw-r--r-- 3,937 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#############################################################################
## Name:        XS/Icon.xs
## Purpose:     XS for Wx::Icon
## Author:      Mattia Barbon
## Modified by:
## Created:     29/10/2000
## RCS-ID:      $Id: Icon.xs 2517 2008-11-30 20:14:22Z mbarbon $
## Copyright:   (c) 2000-2004, 2006-2008 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

#include <wx/icon.h>

MODULE=Wx PACKAGE=Wx

#if !defined( __WXMSW__ )
#include "wxpl.xpm"
#endif

wxIcon*
GetWxPerlIcon( get_small = false )
    bool get_small
  CODE:
#if defined( __WXMSW__ )
    int sz = get_small ? 16 : 32;
    RETVAL = new wxIcon( wxT("wxplicon"), wxBITMAP_TYPE_ICO_RESOURCE, -1, -1 );
    if( !RETVAL->Ok() )
        croak( "Unable to load icon" );
#else
    char** image = (char**)( get_small ? wxpl16_xpm : wxpl32_xpm );
    RETVAL = new wxIcon( image );
#endif
  OUTPUT:
    RETVAL

MODULE=Wx PACKAGE=Wx::Icon

## DECLARE_OVERLOAD( wilo, Wx::IconLocation )

void
wxIcon::new( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_VOIDM_REDISP( newNull )
        MATCH_REDISP( wxPliOvl_wilo, newLocation )
        MATCH_REDISP_COUNT_ALLOWMORE( wxPliOvl_s_n_n_n, newFile, 2 )
    END_OVERLOAD( Wx::Icon::new )

wxIcon*
newNull( CLASS )
    SV* CLASS
  CODE:
    RETVAL = new wxIcon();
  OUTPUT:
    RETVAL

wxIcon*
newFile( CLASS, name, type, desW = -1, desH = -1 )
    SV* CLASS
    wxString name
    long type
    int desW
    int desH
  CODE:
#if defined( __WXMOTIF__ ) || defined( __WXX11__ ) || defined( __WXGTK__ ) \
    || WXPERL_W_VERSION_GE( 2, 9, 0 )
    RETVAL = new wxIcon( name, wxBitmapType(type), desW, desH );
#else
    RETVAL = new wxIcon( name, type, desW, desH );
#endif
  OUTPUT:
    RETVAL

#if defined( __WXGTK__ ) || defined( __WXPERL_FORCE__ )

##wxIcon*
##newFromBits( bits, width, height, depth = 1 )
##    SV* bits
##    int width
##    int height
##    int depth
##  PREINIT:
##    void* buffer = SvPV_nolen( bits );
##  CODE:
##    RETVAL = new wxIcon( buffer, width, height, depth );
##  OUTPUT:
##    RETVAL

#endif

wxIcon*
newFromXPM( CLASS, data )
    SV* CLASS
    SV* data
  PREINIT:
    char** xpm_data;
    size_t i, n = wxPli_av_2_charparray( aTHX_ data, &xpm_data );
  CODE:
    RETVAL = new wxIcon( xpm_data );
    for( i = 0; i < n; ++i )
        free( xpm_data[i] );
  OUTPUT:
    RETVAL

#if WXPERL_W_VERSION_GE( 2, 5, 2 )

wxIcon*
newLocation( CLASS, location )
    SV* CLASS
    wxIconLocation* location
  CODE:
    RETVAL = new wxIcon( *location );
  OUTPUT: RETVAL

#endif

static void
wxIcon::CLONE()
  CODE:
    wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );

## // thread OK
void
wxIcon::DESTROY()
  CODE:
    wxPli_thread_sv_unregister( aTHX_ "Wx::Icon", THIS, ST(0) );
    delete THIS;

bool
wxIcon::LoadFile( name, type )
    wxString name
    long type
  CODE:
#if defined( __WXMOTIF__ )
#if WXPERL_W_VERSION_GE( 2, 5, 1 )
        RETVAL = THIS->LoadFile( name, wxBitmapType(type), -1, -1 );
#else
        RETVAL = THIS->LoadFile( name, type, -1, -1 );
#endif
#else
#if defined( __WXX11__ ) || defined( __WXMAC__ ) || defined( __WXGTK__ ) \
    || ( defined(__WXMSW__) && WXPERL_W_VERSION_GE( 2, 9, 0 ) )
    RETVAL = THIS->LoadFile( name, wxBitmapType(type) );
#else
    RETVAL = THIS->LoadFile( name, type );
#endif
#endif
  OUTPUT:
    RETVAL

bool
wxIcon::Ok()

#if WXPERL_W_VERSION_GE( 2, 8, 0 )

bool
wxIcon::IsOk()

#endif

void
wxIcon::CopyFromBitmap( bitmap )
    wxBitmap* bitmap
  C_ARGS: *bitmap

#if defined( __WXMSW__ ) || defined( __WXPERL_FORCE__ )

int
wxIcon::GetDepth()

int
wxIcon::GetHeight()

int
wxIcon::GetWidth()

void
wxIcon::SetDepth( depth )
    int depth

void
wxIcon::SetHeight( height )
    int height

void
wxIcon::SetWidth( width )
    int width

#endif