]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/textctrl.cpp
first stab at supporting custom renderers
[wxWidgets.git] / src / palmos / textctrl.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/textctrl.cpp
3 // Purpose: wxTextCtrl
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_TEXTCTRL
28
29 #include "wx/textctrl.h"
30
31 #ifndef WX_PRECOMP
32 #include "wx/settings.h"
33 #include "wx/brush.h"
34 #include "wx/utils.h"
35 #include "wx/intl.h"
36 #include "wx/log.h"
37 #include "wx/app.h"
38 #include "wx/menu.h"
39 #include "wx/module.h"
40 #endif
41
42 #if wxUSE_CLIPBOARD
43 #include "wx/clipbrd.h"
44 #endif
45
46 #include "wx/textfile.h"
47
48 #include <string.h>
49
50 #if wxUSE_RICHEDIT
51
52 #include "wx/palmos/missing.h"
53
54 #endif // wxUSE_RICHEDIT
55
56 // ----------------------------------------------------------------------------
57 // private classes
58 // ----------------------------------------------------------------------------
59
60 #if wxUSE_RICHEDIT
61
62 // this module initializes RichEdit DLL(s) if needed
63 class wxRichEditModule : public wxModule
64 {
65 public:
66 virtual bool OnInit();
67 virtual void OnExit();
68
69 // load the richedit DLL of at least of required version
70 static bool Load(int version = 1);
71
72 private:
73 // the handles to richedit 1.0 and 2.0 (or 3.0) DLLs
74 static HINSTANCE ms_hRichEdit[2];
75
76 DECLARE_DYNAMIC_CLASS(wxRichEditModule)
77 };
78
79 HINSTANCE wxRichEditModule::ms_hRichEdit[2] = { NULL, NULL };
80
81 IMPLEMENT_DYNAMIC_CLASS(wxRichEditModule, wxModule)
82
83 #endif // wxUSE_RICHEDIT
84
85 // ----------------------------------------------------------------------------
86 // event tables and other macros
87 // ----------------------------------------------------------------------------
88
89 BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
90 EVT_CHAR(wxTextCtrl::OnChar)
91 EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
92
93 #if wxUSE_RICHEDIT
94 EVT_RIGHT_UP(wxTextCtrl::OnRightClick)
95 #endif
96
97 EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
98 EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
99 EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste)
100 EVT_MENU(wxID_UNDO, wxTextCtrl::OnUndo)
101 EVT_MENU(wxID_REDO, wxTextCtrl::OnRedo)
102 EVT_MENU(wxID_CLEAR, wxTextCtrl::OnDelete)
103 EVT_MENU(wxID_SELECTALL, wxTextCtrl::OnSelectAll)
104
105 EVT_UPDATE_UI(wxID_CUT, wxTextCtrl::OnUpdateCut)
106 EVT_UPDATE_UI(wxID_COPY, wxTextCtrl::OnUpdateCopy)
107 EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste)
108 EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo)
109 EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
110 EVT_UPDATE_UI(wxID_CLEAR, wxTextCtrl::OnUpdateDelete)
111 EVT_UPDATE_UI(wxID_SELECTALL, wxTextCtrl::OnUpdateSelectAll)
112
113 EVT_SET_FOCUS(wxTextCtrl::OnSetFocus)
114 END_EVENT_TABLE()
115
116 // ============================================================================
117 // implementation
118 // ============================================================================
119
120 // ----------------------------------------------------------------------------
121 // creation
122 // ----------------------------------------------------------------------------
123
124 void wxTextCtrl::Init()
125 {
126 }
127
128 wxTextCtrl::~wxTextCtrl()
129 {
130 }
131
132 bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
133 const wxString& value,
134 const wxPoint& pos,
135 const wxSize& size,
136 long style,
137 const wxValidator& validator,
138 const wxString& name)
139 {
140 return false;
141 }
142
143 // ----------------------------------------------------------------------------
144 // set/get the controls text
145 // ----------------------------------------------------------------------------
146
147 wxString wxTextCtrl::GetValue() const
148 {
149 wxString res;
150 return res;
151 }
152
153 wxString wxTextCtrl::GetRange(long from, long to) const
154 {
155 wxString res;
156 return res;
157 }
158
159 void wxTextCtrl::DoSetValue(const wxString& value, int flags)
160 {
161 }
162
163 void wxTextCtrl::WriteText(const wxString& value)
164 {
165 }
166
167 void wxTextCtrl::DoWriteText(const wxString& text, int flags)
168 {
169 }
170
171 void wxTextCtrl::AppendText(const wxString& text)
172 {
173 }
174
175 void wxTextCtrl::Clear()
176 {
177 }
178
179 // ----------------------------------------------------------------------------
180 // Clipboard operations
181 // ----------------------------------------------------------------------------
182
183 void wxTextCtrl::Copy()
184 {
185 }
186
187 void wxTextCtrl::Cut()
188 {
189 }
190
191 void wxTextCtrl::Paste()
192 {
193 }
194
195 bool wxTextCtrl::CanCopy() const
196 {
197 return false;
198 }
199
200 bool wxTextCtrl::CanCut() const
201 {
202 return false;
203 }
204
205 bool wxTextCtrl::CanPaste() const
206 {
207 return false;
208 }
209
210 // ----------------------------------------------------------------------------
211 // Accessors
212 // ----------------------------------------------------------------------------
213
214 void wxTextCtrl::SetEditable(bool editable)
215 {
216 }
217
218 void wxTextCtrl::SetInsertionPoint(long pos)
219 {
220 }
221
222 void wxTextCtrl::SetInsertionPointEnd()
223 {
224 }
225
226 long wxTextCtrl::GetInsertionPoint() const
227 {
228 return 0;
229 }
230
231 wxTextPos wxTextCtrl::GetLastPosition() const
232 {
233 return 0;
234 }
235
236 // If the return values from and to are the same, there is no
237 // selection.
238 void wxTextCtrl::GetSelection(long* from, long* to) const
239 {
240 }
241
242 bool wxTextCtrl::IsEditable() const
243 {
244 return false;
245 }
246
247 // ----------------------------------------------------------------------------
248 // selection
249 // ----------------------------------------------------------------------------
250
251 void wxTextCtrl::SetSelection(long from, long to)
252 {
253 }
254
255 void wxTextCtrl::DoSetSelection(long from, long to, int flags)
256 {
257 }
258
259 // ----------------------------------------------------------------------------
260 // Working with files
261 // ----------------------------------------------------------------------------
262
263 bool wxTextCtrl::DoLoadFile(const wxString& file, int fileType)
264 {
265 return false;
266 }
267
268 // ----------------------------------------------------------------------------
269 // Editing
270 // ----------------------------------------------------------------------------
271
272 void wxTextCtrl::Replace(long from, long to, const wxString& value)
273 {
274 }
275
276 void wxTextCtrl::Remove(long from, long to)
277 {
278 }
279
280 bool wxTextCtrl::IsModified() const
281 {
282 return false;
283 }
284
285 void wxTextCtrl::MarkDirty()
286 {
287 }
288
289 void wxTextCtrl::DiscardEdits()
290 {
291 }
292
293 int wxTextCtrl::GetNumberOfLines() const
294 {
295 return 0;
296 }
297
298 // ----------------------------------------------------------------------------
299 // Positions <-> coords
300 // ----------------------------------------------------------------------------
301
302 long wxTextCtrl::XYToPosition(long x, long y) const
303 {
304 return 0;
305 }
306
307 bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
308 {
309 return false;
310 }
311
312 wxTextCtrlHitTestResult
313 wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const
314 {
315 return wxTE_HT_UNKNOWN;
316 }
317
318 // ----------------------------------------------------------------------------
319 //
320 // ----------------------------------------------------------------------------
321
322 void wxTextCtrl::ShowPosition(long pos)
323 {
324 }
325
326 long wxTextCtrl::GetLengthOfLineContainingPos(long pos) const
327 {
328 return 0;
329 }
330
331 int wxTextCtrl::GetLineLength(long lineNo) const
332 {
333 return 0;
334 }
335
336 wxString wxTextCtrl::GetLineText(long lineNo) const
337 {
338 wxString str;
339
340 return str;
341 }
342
343 void wxTextCtrl::SetMaxLength(unsigned long len)
344 {
345 }
346
347 // ----------------------------------------------------------------------------
348 // Undo/redo
349 // ----------------------------------------------------------------------------
350
351 void wxTextCtrl::Undo()
352 {
353 }
354
355 void wxTextCtrl::Redo()
356 {
357 }
358
359 bool wxTextCtrl::CanUndo() const
360 {
361 return false;
362 }
363
364 bool wxTextCtrl::CanRedo() const
365 {
366 return false;
367 }
368
369 // ----------------------------------------------------------------------------
370 // caret handling (Windows only)
371 // ----------------------------------------------------------------------------
372
373 bool wxTextCtrl::ShowNativeCaret(bool show)
374 {
375 return false;
376 }
377
378 // ----------------------------------------------------------------------------
379 // implemenation details
380 // ----------------------------------------------------------------------------
381
382 void wxTextCtrl::Command(wxCommandEvent & event)
383 {
384 }
385
386 void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
387 {
388 }
389
390 // ----------------------------------------------------------------------------
391 // kbd input processing
392 // ----------------------------------------------------------------------------
393
394 void wxTextCtrl::OnChar(wxKeyEvent& event)
395 {
396 }
397
398 // ----------------------------------------------------------------------------
399 // text control event processing
400 // ----------------------------------------------------------------------------
401
402 bool wxTextCtrl::SendUpdateEvent()
403 {
404 return false;
405 }
406
407 bool wxTextCtrl::AdjustSpaceLimit()
408 {
409 return false;
410 }
411
412 wxSize wxTextCtrl::DoGetBestSize() const
413 {
414 return wxSize(0,0);
415 }
416
417 // ----------------------------------------------------------------------------
418 // standard handlers for standard edit menu events
419 // ----------------------------------------------------------------------------
420
421 void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event))
422 {
423 }
424
425 void wxTextCtrl::OnCopy(wxCommandEvent& WXUNUSED(event))
426 {
427 }
428
429 void wxTextCtrl::OnPaste(wxCommandEvent& WXUNUSED(event))
430 {
431 }
432
433 void wxTextCtrl::OnUndo(wxCommandEvent& WXUNUSED(event))
434 {
435 }
436
437 void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event))
438 {
439 }
440
441 void wxTextCtrl::OnDelete(wxCommandEvent& WXUNUSED(event))
442 {
443 }
444
445 void wxTextCtrl::OnSelectAll(wxCommandEvent& WXUNUSED(event))
446 {
447 }
448
449 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event)
450 {
451 }
452
453 void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event)
454 {
455 }
456
457 void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event)
458 {
459 }
460
461 void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event)
462 {
463 }
464
465 void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
466 {
467 }
468
469 void wxTextCtrl::OnUpdateDelete(wxUpdateUIEvent& event)
470 {
471 }
472
473 void wxTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
474 {
475 }
476
477 void wxTextCtrl::OnSetFocus(wxFocusEvent& WXUNUSED(event))
478 {
479 }
480
481 wxVisualAttributes wxTextCtrl::GetDefaultAttributes() const
482 {
483 wxVisualAttributes attrs;
484 attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
485 attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
486 attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); //white
487 return attrs;
488 }
489
490 bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& rEvent)
491 {
492 return false;
493 }
494 bool wxTextCtrl::CanApplyThemeBorder() const
495 {
496 return false;
497 }
498 bool wxTextCtrl::IsEmpty() const
499 {
500 return false;
501 }
502 bool wxTextCtrl::AcceptsFocusFromKeyboard() const
503 {
504 return false;
505 }
506 void wxTextCtrl::AdoptAttributesFromHWND()
507 {
508 }
509 void wxTextCtrl::SetWindowStyleFlag(long lStyle)
510 {
511 }
512
513 // the rest of the file only deals with the rich edit controls
514 #if wxUSE_RICHEDIT
515
516 // ----------------------------------------------------------------------------
517 // EN_LINK processing
518 // ----------------------------------------------------------------------------
519
520 bool wxTextCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
521 {
522 return false;
523 }
524
525 // ----------------------------------------------------------------------------
526 // colour setting for the rich edit controls
527 // ----------------------------------------------------------------------------
528
529 bool wxTextCtrl::SetBackgroundColour(const wxColour& colour)
530 {
531 return false;
532 }
533
534 bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
535 {
536 return false;
537 }
538
539 // ----------------------------------------------------------------------------
540 // wxRichEditModule
541 // ----------------------------------------------------------------------------
542
543 bool wxRichEditModule::OnInit()
544 {
545 return false;
546 }
547
548 void wxRichEditModule::OnExit()
549 {
550 }
551
552 /* static */
553 bool wxRichEditModule::Load(int version)
554 {
555 return false;
556 }
557
558 #endif // wxUSE_RICHEDIT
559
560 // ----------------------------------------------------------------------------
561 // styling support for rich edit controls
562 // ----------------------------------------------------------------------------
563
564 #if wxUSE_RICHEDIT
565
566 bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
567 {
568 return false;
569 }
570
571 bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
572 {
573 return false;
574 }
575
576 bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
577 {
578 return false;
579 }
580
581 #endif // wxUSE_RICHEDIT
582
583 #endif // wxUSE_TEXTCTRL