]> git.saurik.com Git - wxWidgets.git/blob - src/qt/textctrl.cpp
fixed mysterious mistakes
[wxWidgets.git] / src / qt / textctrl.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textctrl.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id:
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifdef __GNUG__
12 #pragma implementation "textctrl.h"
13 #endif
14
15 #include "wx/textctrl.h"
16 #include "wx/utils.h"
17
18 //-----------------------------------------------------------------------------
19 // wxTextCtrl
20 //-----------------------------------------------------------------------------
21
22 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
23
24
25 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
26 // EVT_CHAR(wxTextCtrl::OnChar)
27 END_EVENT_TABLE()
28
29 wxTextCtrl::wxTextCtrl(void) : streambuf()
30 {
31 if( allocate() )
32 setp(base(),ebuf());
33
34 m_modified = FALSE;
35 };
36
37 wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
38 const wxPoint &pos, const wxSize &size,
39 int style, const wxString &name ) : streambuf()
40 {
41 if( allocate() )
42 setp(base(),ebuf());
43
44 m_modified = FALSE;
45 Create( parent, id, value, pos, size, style, name );
46 };
47
48 bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
49 const wxPoint &pos, const wxSize &size,
50 int style, const wxString &name )
51 {
52 return TRUE;
53 };
54
55 wxString wxTextCtrl::GetValue(void) const
56 {
57 return tmp;
58 };
59
60 void wxTextCtrl::SetValue( const wxString &value )
61 {
62 };
63
64 void wxTextCtrl::WriteText( const wxString &text )
65 {
66 };
67
68 bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) )
69 {
70 return FALSE;
71 };
72
73 bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) )
74 {
75 return FALSE;
76 };
77
78 /*
79 wxString wxTextCtrl::GetLineText( long lineNo ) const
80 {
81 };
82
83
84 void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
85 {
86 };
87
88 long wxTextCtrl::PositionToXY( long pos, long *x, long *y ) const
89 {
90 };
91
92 long wxTextCtrl::XYToPosition( long x, long y )
93 {
94 };
95
96 int wxTextCtrl::GetNumberOfLines(void)
97 {
98 };
99
100 */
101 void wxTextCtrl::SetInsertionPoint( long pos )
102 {
103 };
104
105 void wxTextCtrl::SetInsertionPointEnd(void)
106 {
107 };
108
109 void wxTextCtrl::SetEditable( bool editable )
110 {
111 };
112
113 void wxTextCtrl::SetSelection( long from, long to )
114 {
115 };
116
117 void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
118 {
119 };
120
121 long wxTextCtrl::GetInsertionPoint(void) const
122 {
123 };
124
125 long wxTextCtrl::GetLastPosition(void) const
126 {
127 };
128
129 void wxTextCtrl::Remove( long from, long to )
130 {
131 };
132
133 void wxTextCtrl::Replace( long from, long to, const wxString &value )
134 {
135 };
136
137 void wxTextCtrl::Cut(void)
138 {
139 };
140
141 void wxTextCtrl::Copy(void)
142 {
143 };
144
145 void wxTextCtrl::Paste(void)
146 {
147 };
148
149 void wxTextCtrl::Delete(void)
150 {
151 };
152
153 void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) )
154 {
155 };
156
157 int wxTextCtrl::overflow( int WXUNUSED(c) )
158 {
159 int len = pptr() - pbase();
160 char *txt = new char[len+1];
161 strncpy(txt, pbase(), len);
162 txt[len] = '\0';
163 (*this) << txt;
164 setp(pbase(), epptr());
165 delete[] txt;
166 return EOF;
167 };
168
169 int wxTextCtrl::sync(void)
170 {
171 int len = pptr() - pbase();
172 char *txt = new char[len+1];
173 strncpy(txt, pbase(), len);
174 txt[len] = '\0';
175 (*this) << txt;
176 setp(pbase(), epptr());
177 delete[] txt;
178 return 0;
179 };
180
181 int wxTextCtrl::underflow(void)
182 {
183 return EOF;
184 };
185
186 wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
187 {
188 WriteText(s);
189 return *this;
190 }
191
192 wxTextCtrl& wxTextCtrl::operator<<(float f)
193 {
194 static char buf[100];
195 sprintf(buf, "%.2f", f);
196 WriteText(buf);
197 return *this;
198 }
199
200 wxTextCtrl& wxTextCtrl::operator<<(double d)
201 {
202 static char buf[100];
203 sprintf(buf, "%.2f", d);
204 WriteText(buf);
205 return *this;
206 }
207
208 wxTextCtrl& wxTextCtrl::operator<<(int i)
209 {
210 static char buf[100];
211 sprintf(buf, "%i", i);
212 WriteText(buf);
213 return *this;
214 }
215
216 wxTextCtrl& wxTextCtrl::operator<<(long i)
217 {
218 static char buf[100];
219 sprintf(buf, "%ld", i);
220 WriteText(buf);
221 return *this;
222 }
223
224 wxTextCtrl& wxTextCtrl::operator<<(const char c)
225 {
226 char buf[2];
227
228 buf[0] = c;
229 buf[1] = 0;
230 WriteText(buf);
231 return *this;
232 }
233
234
235