Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / SingleChoiceDialog.xs
1 #############################################################################
2 ## Name:        XS/SingleChoiceDialog.xs
3 ## Purpose:     XS for Wx::SingleChoiceDialog
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     03/02/2001
7 ## RCS-ID:      $Id: SingleChoiceDialog.xs 2057 2007-06-18 23:03:00Z mbarbon $
8 ## Copyright:   (c) 2001-2002, 2005 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/choicdlg.h>
14 #include "cpp/singlechoicedialog.h"
15
16 MODULE=Wx PACKAGE=Wx::SingleChoiceDialog
17
18 wxSingleChoiceDialog*
19 wxSingleChoiceDialog::new( parent, message, caption, chs, dt = &PL_sv_undef, style = wxCHOICEDLG_STYLE, pos = wxDefaultPosition )
20     wxWindow* parent
21     wxString message
22     wxString caption
23     SV* chs
24     SV* dt
25     long style
26     wxPoint pos
27   PREINIT:
28     wxString* choices;
29     SV** data;
30     int n, n2;
31   CODE:
32     n = wxPli_av_2_stringarray( aTHX_ chs, &choices );
33     if( !SvOK( dt ) )
34     {
35       RETVAL = new wxPliSingleChoiceDialog( parent, message, caption, n,
36             choices, 0, style, pos );
37     }
38     else
39     {
40       n2 = wxPli_av_2_svarray( aTHX_ dt, &data );
41       if( n != n2 )
42       {
43         delete[] choices;
44         delete[] data;
45         choices = 0; data = 0; n = 0;
46         croak( "supplied arrays of different size" );
47       }
48       RETVAL = new wxPliSingleChoiceDialog( parent, message, caption, n,
49             choices, data, style, pos );
50       delete[] data;
51     }
52     delete[] choices;
53   OUTPUT:
54     RETVAL
55
56 int
57 wxSingleChoiceDialog::GetSelection()
58
59 SV*
60 wxSingleChoiceDialog::GetSelectionClientData()
61   PREINIT:
62     char* t;
63   CODE:
64     t = THIS->GetSelectionClientData();
65     RETVAL = &PL_sv_undef;
66     if( t )
67     {
68         RETVAL = (SV*)t;
69     }
70     SvREFCNT_inc( RETVAL );
71   OUTPUT:
72     RETVAL
73
74 wxString
75 wxSingleChoiceDialog::GetStringSelection()
76
77 void
78 wxSingleChoiceDialog::SetSelection( selection )
79     int selection
80
81 MODULE=Wx PACKAGE=Wx PREFIX=wx
82
83 #
84 # Function interface
85 #
86
87 wxString
88 wxGetSingleChoice( message, caption, chs, parent = 0, x = -1, y = -1, centre = true, width = wxCHOICE_WIDTH, height = wxCHOICE_HEIGHT )
89     wxString message
90     wxString caption
91     SV* chs
92     wxWindow* parent
93     int x
94     int y
95     bool centre
96     int width
97     int height
98   PREINIT:
99     wxString* choices;
100     int n;
101   CODE:
102     n = wxPli_av_2_stringarray( aTHX_ chs, &choices );
103     RETVAL = wxGetSingleChoice( message, caption, n, choices, parent, x, y,
104         centre, width, height );
105     delete[] choices;
106   OUTPUT:
107     RETVAL
108
109 int
110 wxGetSingleChoiceIndex( message, caption, chs, parent = 0, x = -1, y = -1, centre = true, width = wxCHOICE_WIDTH, height = wxCHOICE_HEIGHT )
111     wxString message
112     wxString caption
113     SV* chs
114     wxWindow* parent
115     int x
116     int y
117     bool centre
118     int width
119     int height
120   PREINIT:
121     wxString* choices;
122     int n;
123   CODE:
124     n = wxPli_av_2_stringarray( aTHX_ chs, &choices );
125     RETVAL = wxGetSingleChoiceIndex( message, caption, n, choices,
126         parent, x, y, centre, width, height );
127     delete[] choices;
128   OUTPUT:
129     RETVAL
130
131 SV*
132 wxGetSingleChoiceData( message, caption, chs, dt, parent = 0, x = -1, y = -1, centre = true, width = wxCHOICE_WIDTH, height = wxCHOICE_HEIGHT )
133     wxString message
134     wxString caption
135     SV* chs
136     SV* dt
137     wxWindow* parent
138     int x
139     int y
140     bool centre
141     int width
142     int height
143   PREINIT:
144     wxString* choices;
145     SV** data;
146     int n, n2;
147     void* rt;
148   CODE:
149     n = wxPli_av_2_stringarray( aTHX_ chs, &choices );
150     n2 = wxPli_av_2_svarray( aTHX_ dt, &data );
151     if( n != n2 )
152     {
153       delete[] choices;
154       delete[] data;
155       choices = 0; data = 0; n = 0;
156       croak( "supplied arrays of different sizes" );
157     }
158     rt = wxGetSingleChoiceData( message, caption, n, choices, (void**)data,
159         parent, x, y, centre, width, height );
160     RETVAL = rt ? (SV*)rt : &PL_sv_undef;
161     SvREFCNT_inc( RETVAL );
162     delete[] choices;
163     delete[] data;
164   OUTPUT:
165     RETVAL