1
#############################################################################
2
## Name: XS/TextCtrl.xs
3
## Purpose: XS for Wx::TextCtrl
4
## Author: Mattia Barbon
7
## RCS-ID: $Id: TextCtrl.xs 2911 2010-04-26 19:51:34Z 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}{
23
%cpp_type{%wxTextPos%};
26
%name{Wx::TextUrlEvent} class wxTextUrlEvent
28
wxMouseEvent& GetMouseEvent();
33
%name{Wx::TextCtrlBase} class wxTextCtrlBase
35
wxString GetValue() const;
36
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
39
void SetValue( const wxString& value );
40
#if WXPERL_W_VERSION_GE( 2, 7, 1 )
41
void ChangeValue( const wxString& value );
43
wxString GetRange( long from, long to ) const;
44
int GetLineLength( long lineNo ) const;
45
wxString GetLineText( long lineNo ) const;
46
int GetNumberOfLines() const;
47
bool IsModified() const;
48
bool IsEditable() const;
49
bool IsSingleLine() const;
50
bool IsMultiLine() const;
51
wxString GetStringSelection() const;
53
void Replace( long from, long to, const wxString& value );
54
void Remove( long from, long to );
55
#if WXPERL_W_VERSION_GE( 2, 7, 1 )
56
bool LoadFile( const wxString& file, int fileType = wxTEXT_TYPE_ANY );
57
bool SaveFile( const wxString& file = wxEmptyString,
58
int fileType = wxTEXT_TYPE_ANY );
60
bool LoadFile( const wxString& file );
61
bool SaveFile( const wxString& file = wxEmptyString );
65
#if WXPERL_W_VERSION_GE( 2, 7, 0 )
66
void SetModified( bool modified );
68
void SetMaxLength( unsigned long len );
69
void WriteText( const wxString& text );
70
void AppendText( const wxString& text );
71
bool EmulateKeyPress( const wxKeyEvent& event );
72
bool SetStyle( long start, long end, const wxTextAttr& style );
73
## bool GetStyle( long position, wxTextAttr& style );
74
bool SetDefaultStyle( const wxTextAttr& style );
75
const wxTextAttr& GetDefaultStyle() const;
76
long XYToPosition( long x, long y ) const;
77
void ShowPosition(long pos);
83
bool CanPaste() const;
88
void SetInsertionPoint( long pos );
89
void SetInsertionPointEnd();
90
long GetInsertionPoint() const;
91
wxTextPos GetLastPosition() const;
92
void SetSelection( long from, long to );
94
void SetEditable( bool editable );
95
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
96
bool AutoComplete( const wxArrayString& choices );
97
bool AutoCompleteFileNames();
104
wxTextCtrlBase::GetSelection()
109
THIS->GetSelection( &from, &to );
111
PUSHs( sv_2mortal( newSViv( from ) ) );
112
PUSHs( sv_2mortal( newSViv( to ) ) );
115
wxTextCtrlBase::PositionToXY( pos )
121
THIS->PositionToXY( pos, &x, &y );
123
PUSHs( sv_2mortal( newSViv( x ) ) );
124
PUSHs( sv_2mortal( newSViv( y ) ) );
127
wxTextCtrlBase::HitTest( pt )
131
wxTextCtrlHitTestResult res = THIS->HitTest( pt, &col, &row );
134
PUSHs( sv_2mortal( newSViv( res ) ) );
135
PUSHs( sv_2mortal( newSViv( col ) ) );
136
PUSHs( sv_2mortal( newSViv( row ) ) );
140
%name{Wx::TextCtrl} class wxTextCtrl
142
#if defined( __WXMAC__ ) && WXPERL_W_VERSION_GE( 2, 8, 0 )
143
void MacCheckSpelling( bool check );
152
MATCH_VOIDM_REDISP( newDefault )
153
MATCH_ANY_REDISP( newFull )
154
END_OVERLOAD( "Wx::TextCtrl::new" )
160
RETVAL = new wxTextCtrl();
161
wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
165
newFull( CLASS, parent, id, value, pos = wxDefaultPosition, size = wxDefaultSize, style = 0 , validator = (wxValidator*)&wxDefaultValidator, name = wxTextCtrlNameStr )
173
wxValidator* validator
176
RETVAL = new wxTextCtrl( parent, id, value, pos, size,
177
style, *validator, name );
178
wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
183
wxTextCtrl::Create( parent, id, value, pos = wxDefaultPosition, size = wxDefaultSize, style = 0 , validator = (wxValidator*)&wxDefaultValidator, name = wxTextCtrlNameStr )
190
wxValidator* validator
192
C_ARGS: parent, id, value, pos, size, style, *validator, name
195
wxTextCtrl::GetStyle( position )
199
bool retval = THIS->GetStyle( position, attr );
201
PUSHs( newSViv( retval ) );
202
PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
203
new wxTextAttr( attr ),
207
## to be consistent with RichTextCtrl
210
wxTextCtrl::GetTextAttrStyle( position )
214
bool retval = THIS->GetStyle( position, attr );
216
PUSHs( newSViv( retval ) );
217
PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
218
new wxTextAttr( attr ),
b'\\ No newline at end of file'