~ubuntu-branches/ubuntu/trusty/libwx-perl/trusty

« back to all changes in this revision

Viewing changes to XS/TextCtrl.xs

  • Committer: Bazaar Package Importer
  • Author(s): Roberto C. Sanchez
  • Date: 2011-01-18 17:17:01 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110118171701-z5rfg143qndfrau2
Tags: 1:0.98-1
* New upstream release
  - add epoch, to compensate for upstream going from 0.9702 -> 0.98
* Standards-Version: 3.9.1 (no changes required)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#############################################################################
2
 
## Name:        XS/TextCtrl.xs
3
 
## Purpose:     XS for Wx::TextCtrl
4
 
## Author:      Mattia Barbon
5
 
## Modified by:
6
 
## Created:     29/10/2000
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
 
#############################################################################
12
 
 
13
 
%module{Wx};
14
 
 
15
 
#include <wx/textctrl.h>
16
 
 
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%};
24
 
};
25
 
 
26
 
%name{Wx::TextUrlEvent} class wxTextUrlEvent
27
 
{
28
 
    wxMouseEvent& GetMouseEvent();
29
 
    long GetURLStart();
30
 
    long GetURLEnd();
31
 
};
32
 
 
33
 
%name{Wx::TextCtrlBase} class wxTextCtrlBase
34
 
{
35
 
    wxString GetValue() const;
36
 
#if WXPERL_W_VERSION_GE( 2, 7, 2 )
37
 
    bool IsEmpty();
38
 
#endif
39
 
    void SetValue( const wxString& value );
40
 
#if WXPERL_W_VERSION_GE( 2, 7, 1 )
41
 
    void ChangeValue( const wxString& value );
42
 
#endif
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;
52
 
    void Clear();
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 );
59
 
#else
60
 
    bool LoadFile( const wxString& file );
61
 
    bool SaveFile( const wxString& file = wxEmptyString );
62
 
#endif
63
 
    void MarkDirty();
64
 
    void DiscardEdits();
65
 
#if WXPERL_W_VERSION_GE( 2, 7, 0 )
66
 
    void SetModified( bool modified );
67
 
#endif
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);
78
 
    void Copy();
79
 
    void Cut();
80
 
    void Paste();
81
 
    bool CanCopy() const;
82
 
    bool CanCut() const;
83
 
    bool CanPaste() const;
84
 
    void Undo();
85
 
    void Redo();
86
 
    bool CanUndo() const;
87
 
    bool CanRedo() const;
88
 
    void SetInsertionPoint( long pos );
89
 
    void SetInsertionPointEnd();
90
 
    long GetInsertionPoint() const;
91
 
    wxTextPos GetLastPosition() const;
92
 
    void SetSelection( long from, long to );
93
 
    void SelectAll();
94
 
    void SetEditable( bool editable );
95
 
#if WXPERL_W_VERSION_GE( 2, 9, 0 )
96
 
    bool AutoComplete( const wxArrayString& choices );
97
 
    bool AutoCompleteFileNames();
98
 
#endif
99
 
};
100
 
 
101
 
%{
102
 
 
103
 
void
104
 
wxTextCtrlBase::GetSelection()
105
 
  PREINIT:
106
 
    long from;
107
 
    long to;
108
 
  PPCODE:
109
 
    THIS->GetSelection( &from, &to );
110
 
    EXTEND( SP, 2 );
111
 
    PUSHs( sv_2mortal( newSViv( from ) ) );
112
 
    PUSHs( sv_2mortal( newSViv( to ) ) );
113
 
 
114
 
void
115
 
wxTextCtrlBase::PositionToXY( pos )
116
 
    long pos
117
 
  PREINIT:
118
 
    long x;
119
 
    long y;
120
 
  PPCODE:
121
 
    THIS->PositionToXY( pos, &x, &y );
122
 
    EXTEND( SP, 2 );
123
 
    PUSHs( sv_2mortal( newSViv( x ) ) );
124
 
    PUSHs( sv_2mortal( newSViv( y ) ) );
125
 
 
126
 
void
127
 
wxTextCtrlBase::HitTest( pt )
128
 
    wxPoint pt
129
 
  PPCODE:
130
 
    long col, row;
131
 
    wxTextCtrlHitTestResult res = THIS->HitTest( pt, &col, &row );
132
 
 
133
 
    EXTEND( SP, 3 );
134
 
    PUSHs( sv_2mortal( newSViv( res ) ) );
135
 
    PUSHs( sv_2mortal( newSViv( col ) ) );
136
 
    PUSHs( sv_2mortal( newSViv( row ) ) );
137
 
 
138
 
%}
139
 
 
140
 
%name{Wx::TextCtrl} class wxTextCtrl
141
 
{
142
 
#if defined( __WXMAC__ ) && WXPERL_W_VERSION_GE( 2, 8, 0 )
143
 
    void MacCheckSpelling( bool check );
144
 
#endif
145
 
};
146
 
 
147
 
%{
148
 
void
149
 
new( ... )
150
 
  PPCODE:
151
 
    BEGIN_OVERLOAD()
152
 
        MATCH_VOIDM_REDISP( newDefault )
153
 
        MATCH_ANY_REDISP( newFull )
154
 
    END_OVERLOAD( "Wx::TextCtrl::new" )
155
 
 
156
 
wxTextCtrl*
157
 
newDefault( CLASS )
158
 
    PlClassName CLASS
159
 
  CODE:
160
 
    RETVAL = new wxTextCtrl();
161
 
    wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
162
 
  OUTPUT: RETVAL
163
 
 
164
 
wxTextCtrl*
165
 
newFull( CLASS, parent, id, value, pos = wxDefaultPosition, size = wxDefaultSize, style = 0 , validator = (wxValidator*)&wxDefaultValidator, name = wxTextCtrlNameStr )
166
 
    PlClassName CLASS
167
 
    wxWindow* parent
168
 
    wxWindowID id
169
 
    wxString value
170
 
    wxPoint pos
171
 
    wxSize size
172
 
    long style
173
 
    wxValidator* validator
174
 
    wxString name
175
 
  CODE:
176
 
    RETVAL = new wxTextCtrl( parent, id, value, pos, size,
177
 
                             style, *validator, name );
178
 
    wxPli_create_evthandler( aTHX_ RETVAL, CLASS );
179
 
  OUTPUT:
180
 
    RETVAL
181
 
 
182
 
bool
183
 
wxTextCtrl::Create( parent, id, value, pos = wxDefaultPosition, size = wxDefaultSize, style = 0 , validator = (wxValidator*)&wxDefaultValidator, name = wxTextCtrlNameStr )
184
 
    wxWindow* parent
185
 
    wxWindowID id
186
 
    wxString value
187
 
    wxPoint pos
188
 
    wxSize size
189
 
    long style
190
 
    wxValidator* validator
191
 
    wxString name
192
 
  C_ARGS: parent, id, value, pos, size, style, *validator, name
193
 
 
194
 
void
195
 
wxTextCtrl::GetStyle( position )
196
 
    long position
197
 
  PPCODE:
198
 
    wxTextAttr attr;
199
 
    bool retval = THIS->GetStyle( position, attr );
200
 
    EXTEND( SP, 2 );
201
 
    PUSHs( newSViv( retval ) );
202
 
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
203
 
                                           new wxTextAttr( attr ),
204
 
                                           "Wx::TextAttr" ) :
205
 
                    &PL_sv_undef );
206
 
 
207
 
## to be consistent with RichTextCtrl
208
 
 
209
 
void
210
 
wxTextCtrl::GetTextAttrStyle( position )
211
 
    long position
212
 
  PPCODE:
213
 
    wxTextAttr attr;
214
 
    bool retval = THIS->GetStyle( position, attr );
215
 
    EXTEND( SP, 2 );
216
 
    PUSHs( newSViv( retval ) );
217
 
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
218
 
                                           new wxTextAttr( attr ),
219
 
                                           "Wx::TextAttr" ) :
220
 
                    &PL_sv_undef );
221
 
 
222
 
%}
 
 
b'\\ No newline at end of file'