1 #############################################################################
2 ## Name: XS/TextCtrl.xs
3 ## Purpose: XS for Wx::TextCtrl
4 ## Author: Mattia Barbon
7 ## RCS-ID: $Id: TextCtrl.xs 2735 2010-01-02 10:39:01Z mbarbon $
8 ## Copyright: (c) 2000-2003, 2005-2007, 2010 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 #############################################################################
15 #include <wx/textctrl.h>
17 %typemap{wxMouseEvent&}{reference};
18 %typemap{wxTextAttr*}{simple};
19 %typemap{const wxTextAttr&}{reference};
20 %typemap{wxTextAttrAlignment}{simple};
21 %typemap{const wxKeyEvent&}{reference};
22 %typemap{wxTextPos}{parsed}{%wxTextPos%};
24 %name{Wx::TextUrlEvent} class wxTextUrlEvent
26 wxMouseEvent& GetMouseEvent();
31 %name{Wx::TextCtrlBase} class wxTextCtrlBase
33 wxString GetValue() const;
34 #if WXPERL_W_VERSION_GE( 2, 7, 2 )
37 void SetValue( const wxString& value );
38 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
39 void ChangeValue( const wxString& value );
41 wxString GetRange( long from, long to ) const;
42 int GetLineLength( long lineNo ) const;
43 wxString GetLineText( long lineNo ) const;
44 int GetNumberOfLines() const;
45 bool IsModified() const;
46 bool IsEditable() const;
47 bool IsSingleLine() const;
48 bool IsMultiLine() const;
49 wxString GetStringSelection() const;
51 void Replace( long from, long to, const wxString& value );
52 void Remove( long from, long to );
53 #if WXPERL_W_VERSION_GE( 2, 7, 1 )
54 bool LoadFile( const wxString& file, int fileType = wxTEXT_TYPE_ANY );
55 bool SaveFile( const wxString& file = wxEmptyString,
56 int fileType = wxTEXT_TYPE_ANY );
58 bool LoadFile( const wxString& file );
59 bool SaveFile( const wxString& file = wxEmptyString );
63 #if WXPERL_W_VERSION_GE( 2, 7, 0 )
64 void SetModified( bool modified );
66 void SetMaxLength( unsigned long len );
67 void WriteText( const wxString& text );
68 void AppendText( const wxString& text );
69 bool EmulateKeyPress( const wxKeyEvent& event );
70 bool SetStyle( long start, long end, const wxTextAttr& style );
71 ## bool GetStyle( long position, wxTextAttr& style );
72 bool SetDefaultStyle( const wxTextAttr& style );
73 const wxTextAttr& GetDefaultStyle() const;
74 long XYToPosition( long x, long y ) const;
75 void ShowPosition(long pos);
81 bool CanPaste() const;
86 void SetInsertionPoint( long pos );
87 void SetInsertionPointEnd();
88 long GetInsertionPoint() const;
89 wxTextPos GetLastPosition() const;
90 void SetSelection( long from, long to );
92 void SetEditable( bool editable );
93 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
94 bool AutoComplete( const wxArrayString& choices );
95 bool AutoCompleteFileNames();
102 wxTextCtrlBase::GetSelection()
107 THIS->GetSelection( &from, &to );
109 PUSHs( sv_2mortal( newSViv( from ) ) );
110 PUSHs( sv_2mortal( newSViv( to ) ) );
113 wxTextCtrlBase::PositionToXY( pos )
119 THIS->PositionToXY( pos, &x, &y );
121 PUSHs( sv_2mortal( newSViv( x ) ) );
122 PUSHs( sv_2mortal( newSViv( y ) ) );
125 wxTextCtrlBase::HitTest( pt )
129 wxTextCtrlHitTestResult res = THIS->HitTest( pt, &col, &row );
132 PUSHs( sv_2mortal( newSViv( res ) ) );
133 PUSHs( sv_2mortal( newSViv( col ) ) );
134 PUSHs( sv_2mortal( newSViv( row ) ) );
138 %name{Wx::TextCtrl} class wxTextCtrl
140 #if defined( __WXMAC__ ) && WXPERL_W_VERSION_GE( 2, 8, 0 )
141 void MacCheckSpelling( bool check );
150 MATCH_VOIDM_REDISP( newDefault )
151 MATCH_ANY_REDISP( newFull )
152 END_OVERLOAD( "Wx::TextCtrl::new" )
158 RETVAL = new wxTextCtrl();
159 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
163 newFull( CLASS, parent, id, value, pos = wxDefaultPosition, size = wxDefaultSize, style = 0 , validator = (wxValidator*)&wxDefaultValidator, name = wxTextCtrlNameStr )
171 wxValidator* validator
174 RETVAL = new wxTextCtrl( parent, id, value, pos, size,
175 style, *validator, name );
176 wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
181 wxTextCtrl::Create( parent, id, value, pos = wxDefaultPosition, size = wxDefaultSize, style = 0 , validator = (wxValidator*)&wxDefaultValidator, name = wxTextCtrlNameStr )
188 wxValidator* validator
190 C_ARGS: parent, id, value, pos, size, style, *validator, name
193 wxTextCtrl::GetStyle( position )
197 bool retval = THIS->GetStyle( position, attr );
199 PUSHs( newSViv( retval ) );
200 PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
201 new wxTextAttr( attr ),
205 ## to be consistent with RichTextCtrl
208 wxTextCtrl::GetTextAttrStyle( position )
212 bool retval = THIS->GetStyle( position, attr );
214 PUSHs( newSViv( retval ) );
215 PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
216 new wxTextAttr( attr ),