Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / ext / calendar / XS / CalendarCtrl.xsp
1 #############################################################################
2 ## Name:        ext/calendar/XS/CalendarCtrl.xsp
3 ## Purpose:     XS++ for Wx::CalenderCtrl
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     05/10/2002
7 ## RCS-ID:      $Id: CalendarCtrl.xsp 2440 2008-08-12 21:51:22Z mbarbon $
8 ## Copyright:   (c) 2002-2006, 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/event.h>
14 #include <wx/calctrl.h>
15 #include "cpp/calendar.h"
16
17 %module{Wx};
18 %file{cpp/calendar.h};
19 %{
20
21 double calendar_constant( const char* name, int arg )
22 {
23     // !package: Wx
24     // !parser: sub { $_[0] =~ m<^\s*r\w*\(\s*(\w+)\s*\);\s*(?://(.*))?$> }
25     // !tag: calendar
26 #define r( n ) \
27     if( strEQ( name, #n ) ) \
28         return n;
29
30     WX_PL_CONSTANT_INIT();
31
32     switch( fl )
33     {
34     case 'C':
35         r( wxCAL_SUNDAY_FIRST );
36         r( wxCAL_MONDAY_FIRST );
37         r( wxCAL_SHOW_HOLIDAYS );
38         r( wxCAL_NO_YEAR_CHANGE );
39         r( wxCAL_NO_MONTH_CHANGE );
40         r( wxCAL_SHOW_SURROUNDING_WEEKS );
41 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
42         r( wxCAL_SHOW_WEEK_NUMBERS );
43 #endif
44         r( wxCAL_SEQUENTIAL_MONTH_SELECTION );
45
46         r( wxCAL_HITTEST_NOWHERE );
47         r( wxCAL_HITTEST_HEADER );
48         r( wxCAL_HITTEST_DAY );
49         r( wxCAL_HITTEST_DECMONTH );
50         r( wxCAL_HITTEST_INCMONTH );
51         r( wxCAL_HITTEST_SURROUNDING_WEEK );
52
53         r( wxCAL_BORDER_NONE );
54         r( wxCAL_BORDER_SQUARE );
55         r( wxCAL_BORDER_ROUND );
56         break;
57     case 'E':
58         r( wxEVT_CALENDAR_SEL_CHANGED );
59         r( wxEVT_CALENDAR_DAY_CHANGED );
60         r( wxEVT_CALENDAR_MONTH_CHANGED );
61         r( wxEVT_CALENDAR_YEAR_CHANGED );
62         r( wxEVT_CALENDAR_DOUBLECLICKED );
63         r( wxEVT_CALENDAR_WEEKDAY_CLICKED );
64
65 #if WXPERL_W_VERSION_GE( 2, 5, 4 )
66         r( wxEVT_DATE_CHANGED );
67 #endif
68         break;
69     }
70 #undef r
71
72     WX_PL_CONSTANT_CLEANUP();
73 }
74
75 wxPlConstants calendar_module( &calendar_constant );
76
77 %}
78 %file{-};
79
80 %typemap{wxDateEvent*}{simple};
81 %typemap{wxCalendarEvent*}{simple};
82 %typemap{wxCalendarCtrl*}{simple};
83 %typemap{wxCalendarDateAttr*}{simple};
84 %typemap{wxDateTime__WeekDay}{simple};
85
86 #if WXPERL_W_VERSION_GE( 2, 5, 4 )
87
88 %name{Wx::DateEvent} class wxDateEvent
89 {
90     const wxDateTime& GetDate();
91     void SetDate(const wxDateTime& date);
92 };
93
94 #endif
95
96 %name{Wx::CalendarEvent} class wxCalendarEvent
97 {
98 #if WXPERL_W_VERSION_LE( 2, 5, 3 ) && WXPERL_W_VERSION_GE( 2, 5, 2 )
99     void SetDate(const wxDateTime& date);
100     void SetWeekDay(wxDateTime__WeekDay weekDay);
101 #endif
102 #if WXPERL_W_VERSION_LE( 2, 5, 3 )
103     const wxDateTime& GetDate();
104 #endif
105     wxDateTime__WeekDay GetWeekDay();
106 };
107
108 %name{Wx::CalendarCtrl} class wxCalendarCtrl
109 {
110     %name{newDefault} wxCalendarCtrl()
111         %code{% RETVAL = new wxCalendarCtrl();
112                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
113              %};
114     %name{newFull} wxCalendarCtrl( wxWindow* parent,
115                                    wxWindowID id = wxID_ANY,
116                                    const wxDateTime& date =
117                                        wxDefaultDateTimePtr,
118                                    const wxPoint& pos = wxDefaultPosition,
119                                    const wxSize& size = wxDefaultSize,
120                                    long style = wxCAL_SHOW_HOLIDAYS,
121                                    const wxString& name = wxCalendarNameStr )
122         %code{% RETVAL = new wxCalendarCtrl( parent, id, *date,
123                                              pos, size, style, name );
124                 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
125              %};
126
127     bool Create( wxWindow* parent, wxWindowID id = wxID_ANY,
128                  const wxDateTime& date = wxDefaultDateTimePtr,
129                  const wxPoint& pos = wxDefaultPosition,
130                  const wxSize& size = wxDefaultSize,
131                  long style = wxCAL_SHOW_HOLIDAYS,
132                  const wxString& name = wxCalendarNameStr );
133
134     void SetDate( const wxDateTime& date );
135     const wxDateTime& GetDate();
136
137 #if !defined(wxHAS_NATIVE_CALENDARCTRL)
138     void EnableYearChange( bool enable = true );
139 #endif
140     void EnableMonthChange( bool enable = true );
141     void EnableHolidayDisplay( bool display = true );
142     void SetHoliday( size_t day );
143
144 #if !defined(wxHAS_NATIVE_CALENDARCTRL)
145     bool SetLowerDateLimit( const wxDateTime& date = wxDefaultDateTimePtr );
146     const wxDateTime& GetLowerDateLimit();
147     bool SetUpperDateLimit( const wxDateTime& date = wxDefaultDateTimePtr );
148     const wxDateTime& GetUpperDateLimit();
149 #endif
150
151     bool SetDateRange ( const wxDateTime& lowerdate = wxDefaultDateTimePtr,
152                         const wxDateTime& upperdate = wxDefaultDateTimePtr );
153
154     void SetHeaderColours( const wxColour& colFg, const wxColour& colBg );
155     void SetHighlightColours( const wxColour& colFg, const wxColour& colBg );
156     void SetHolidayColours( const wxColour& colFg, const wxColour& colBg );
157     const wxColour& GetHeaderColourFg();
158     const wxColour& GetHeaderColourBg();
159     const wxColour& GetHighlightColourFg();
160     const wxColour& GetHighlightColourBg();
161     const wxColour& GetHolidayColourFg();
162     const wxColour& GetHolidayColourBg();
163
164     wxCalendarDateAttr* GetAttr( size_t day )
165         %code{%
166             RETVAL = THIS->GetAttr(day);
167             RETVAL = RETVAL ? new wxCalendarDateAttr( *RETVAL ) : NULL;
168         %};
169
170     void SetAttr( size_t day, wxCalendarDateAttr* attr )
171         %code{%
172             THIS->SetAttr( day,
173                            attr ? new wxCalendarDateAttr( *attr ) : NULL );
174         %};
175
176     void ResetAttr( size_t day );
177 };
178
179 %{
180
181 void
182 new( ... )
183   PPCODE:
184     BEGIN_OVERLOAD()
185         MATCH_VOIDM_REDISP( newDefault )
186         MATCH_ANY_REDISP( newFull )
187     END_OVERLOAD( "Wx::CalendarCtrl::new" )
188
189 %}