File: TextCtrlIface.xsp

package info (click to toggle)
libwx-perl 1%3A0.9909-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,912 kB
  • sloc: cpp: 9,728; perl: 8,182; ansic: 626; makefile: 41
file content (187 lines) | stat: -rw-r--r-- 4,425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#############################################################################
## Name:        viface/TextCtrlIface.xsp
## Purpose:     XS++ for wxTextCtrlIface
## Author:      Mark Dootson
## Modified by:
## Created:     21/11/2011
## RCS-ID:      $Id:$
## Copyright:   (c) 2011 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

%file{xspp/TextCtrlIface.h};

%module{Wx};

#if WXPERL_W_VERSION_GE( 2, 9, 2 )

%typemap{wxTextCtrlIface*}{simple};
%typemap{const wxTextAttr&}{reference};

%name{Wx::TextCtrlIface} class wxTextCtrlIface
{
 
	wxString GetValue() const;
	void SetValue( const wxString& value );
	void ChangeValue( const wxString& value );
	wxString GetRange( long from, long to ) const;
	
	void WriteText( const wxString& text );
	void AppendText( const wxString& text ); 	
	
    bool IsEmpty();
    
    void Clear();
	void Replace( long from, long to, const wxString& value );
	void Remove( long from, long to );
	void RemoveSelection();

	void Copy();
	void Cut();
	void Paste();
	bool CanCopy() const;
	bool CanCut() const;
	bool CanPaste() const;
	void Undo();
	void Redo();
	bool CanUndo() const;
	bool CanRedo() const;

	void SetInsertionPoint( long pos );
	void SetInsertionPointEnd();
	long GetInsertionPoint() const;
	long GetLastPosition() const;
    
    void SetSelection( long from, long to );
	void SelectAll();
	bool HasSelection() const;    
	wxString GetStringSelection() const;
	
##  void GetSelection(long *from, long *to);
        
	bool AutoComplete( const wxArrayString& choices );
	bool AutoCompleteFileNames();
##	bool AutoComplete(wxTextCompleter *completer);
    
	bool IsEditable() const;	
	void SetEditable( bool editable ); 
    
	void SetMaxLength( unsigned long len );

	bool SetHint(const wxString& hint);
	wxString GetHint() const;

	bool SetMargins(const wxPoint& pt);
    wxPoint GetMargins() const;
    
    /* implement wxTextAreaBase */
    
	int GetLineLength( long lineNo ) const;
	wxString GetLineText( long lineNo ) const;
	int GetNumberOfLines() const;

#if defined(WXPERL_IN_RICHTEXTCTRL)
    bool LoadFile( const wxString& file, int fileType = wxTEXT_TYPE_ANY );
    bool SaveFile( const wxString& file = wxEmptyString, int fileType = wxTEXT_TYPE_ANY );
#endif

	bool IsModified() const;
	void MarkDirty();
	void DiscardEdits();
	void SetModified( bool modified );
    
#if defined(WXPERL_IN_SEARCHCTRL)

    bool SetStyle( long start, long end, const wxTextAttr& style );
##  bool GetStyle(long position, wxTextAttr& style) = 0;

#endif

#if !defined(WXPERL_IN_RICHTEXTCTRL)
	bool SetDefaultStyle( const wxTextAttr& style );
#endif
	
	const wxTextAttr& GetDefaultStyle() const;


	long XYToPosition( long x, long y ) const;
##  bool PositionToXY(long pos, long *x, long *y) const;
	void ShowPosition(long pos);
	
##  wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
##  wxTextCtrlHitTestResult HitTest(const wxPoint& pt, wxTextCoord *col, wxTextCoord *row) const;

};

%{

void
wxTextCtrlIface::GetSelection()
  PREINIT:
    long from;
    long to;
  PPCODE:
    THIS->GetSelection( &from, &to );
    EXTEND( SP, 2 );
    PUSHs( sv_2mortal( newSViv( from ) ) );
    PUSHs( sv_2mortal( newSViv( to ) ) );

%}

#if defined(WXPERL_IN_SEARCHCTRL)

%{
void
wxTextCtrlIface::GetStyle( position )
    long position
  PPCODE:
    wxTextAttr attr;
    bool retval = THIS->GetStyle( position, attr );
    EXTEND( SP, 2 );
    PUSHs( newSViv( retval ) );
    PUSHs( retval ? wxPli_non_object_2_sv( aTHX_ sv_newmortal(),
                                           new wxTextAttr( attr ),
                                           "Wx::TextAttr" ) :
                    &PL_sv_undef );
%}

#endif

%{
void
wxTextCtrlIface::PositionToXY( pos )
    long pos
  PREINIT:
    long x;
    long y;
  PPCODE:
    THIS->PositionToXY( pos, &x, &y );
    EXTEND( SP, 2 );
    PUSHs( sv_2mortal( newSViv( x ) ) );
    PUSHs( sv_2mortal( newSViv( y ) ) );

%}


%{

void
wxTextCtrlIface::HitTest( pt )
    wxPoint pt
  PPCODE:
    long col, row;
    wxTextCtrlHitTestResult res = THIS->HitTest( pt, &col, &row );

    EXTEND( SP, 3 );
    PUSHs( sv_2mortal( newSViv( res ) ) );
    PUSHs( sv_2mortal( newSViv( col ) ) );
    PUSHs( sv_2mortal( newSViv( row ) ) );

%}

#endif

%file{-};