]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/textctrl.cpp
Move wxColourData and wxFontData into separate files.
[wxWidgets.git] / src / palmos / textctrl.cpp
CommitLineData
ffecfa5a 1/////////////////////////////////////////////////////////////////////////////
e2731512 2// Name: src/palmos/textctrl.cpp
ffecfa5a 3// Purpose: wxTextCtrl
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/13/04
e2731512 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
ffecfa5a
JS
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
fec9cc08
WS
29#include "wx/textctrl.h"
30
ffecfa5a 31#ifndef WX_PRECOMP
ffecfa5a
JS
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"
02761f6c 39 #include "wx/module.h"
ffecfa5a
JS
40#endif
41
ffecfa5a
JS
42#if wxUSE_CLIPBOARD
43 #include "wx/clipbrd.h"
44#endif
45
46#include "wx/textfile.h"
47
ffecfa5a
JS
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
63class wxRichEditModule : public wxModule
64{
65public:
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
72private:
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
79HINSTANCE wxRichEditModule::ms_hRichEdit[2] = { NULL, NULL };
80
81IMPLEMENT_DYNAMIC_CLASS(wxRichEditModule, wxModule)
82
83#endif // wxUSE_RICHEDIT
84
85// ----------------------------------------------------------------------------
86// event tables and other macros
87// ----------------------------------------------------------------------------
88
9d112688 89BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
ffecfa5a
JS
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)
114END_EVENT_TABLE()
115
116// ============================================================================
117// implementation
118// ============================================================================
119
120// ----------------------------------------------------------------------------
121// creation
122// ----------------------------------------------------------------------------
123
124void wxTextCtrl::Init()
125{
126}
127
128wxTextCtrl::~wxTextCtrl()
129{
130}
131
132bool 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
ffecfa5a
JS
143// ----------------------------------------------------------------------------
144// set/get the controls text
145// ----------------------------------------------------------------------------
146
147wxString wxTextCtrl::GetValue() const
148{
149 wxString res;
6afc1b46
VZ
150 return res;
151}
ffecfa5a 152
6afc1b46
VZ
153wxString wxTextCtrl::GetRange(long from, long to) const
154{
155 wxString res;
ffecfa5a
JS
156 return res;
157}
158
ee2ec18e 159void wxTextCtrl::DoSetValue(const wxString& value, int flags)
ffecfa5a
JS
160{
161}
162
ffecfa5a
JS
163void wxTextCtrl::WriteText(const wxString& value)
164{
165}
166
6afc1b46 167void wxTextCtrl::DoWriteText(const wxString& text, int flags)
ffecfa5a
JS
168{
169}
170
171void wxTextCtrl::AppendText(const wxString& text)
172{
173}
174
175void wxTextCtrl::Clear()
176{
177}
178
ffecfa5a
JS
179// ----------------------------------------------------------------------------
180// Clipboard operations
181// ----------------------------------------------------------------------------
182
183void wxTextCtrl::Copy()
184{
185}
186
187void wxTextCtrl::Cut()
188{
189}
190
191void wxTextCtrl::Paste()
192{
193}
194
ffecfa5a
JS
195bool wxTextCtrl::CanCopy() const
196{
197 return false;
198}
199
200bool wxTextCtrl::CanCut() const
201{
202 return false;
203}
204
205bool wxTextCtrl::CanPaste() const
206{
207 return false;
208}
209
210// ----------------------------------------------------------------------------
211// Accessors
212// ----------------------------------------------------------------------------
213
214void wxTextCtrl::SetEditable(bool editable)
215{
216}
217
218void wxTextCtrl::SetInsertionPoint(long pos)
219{
220}
221
222void wxTextCtrl::SetInsertionPointEnd()
223{
224}
225
226long wxTextCtrl::GetInsertionPoint() const
227{
228 return 0;
229}
230
7d8268a1 231wxTextPos wxTextCtrl::GetLastPosition() const
ffecfa5a
JS
232{
233 return 0;
234}
235
236// If the return values from and to are the same, there is no
237// selection.
238void wxTextCtrl::GetSelection(long* from, long* to) const
239{
240}
241
242bool wxTextCtrl::IsEditable() const
243{
244 return false;
245}
246
247// ----------------------------------------------------------------------------
248// selection
249// ----------------------------------------------------------------------------
250
251void wxTextCtrl::SetSelection(long from, long to)
252{
253}
254
6afc1b46 255void wxTextCtrl::DoSetSelection(long from, long to, int flags)
ffecfa5a
JS
256{
257}
258
259// ----------------------------------------------------------------------------
260// Working with files
261// ----------------------------------------------------------------------------
262
3306aec1 263bool wxTextCtrl::DoLoadFile(const wxString& file, int fileType)
ffecfa5a
JS
264{
265 return false;
266}
267
268// ----------------------------------------------------------------------------
269// Editing
270// ----------------------------------------------------------------------------
271
272void wxTextCtrl::Replace(long from, long to, const wxString& value)
273{
274}
275
276void wxTextCtrl::Remove(long from, long to)
277{
278}
279
280bool wxTextCtrl::IsModified() const
281{
282 return false;
283}
284
285void wxTextCtrl::MarkDirty()
286{
287}
288
289void wxTextCtrl::DiscardEdits()
290{
291}
292
293int wxTextCtrl::GetNumberOfLines() const
294{
295 return 0;
296}
297
298// ----------------------------------------------------------------------------
299// Positions <-> coords
300// ----------------------------------------------------------------------------
301
302long wxTextCtrl::XYToPosition(long x, long y) const
303{
304 return 0;
305}
306
307bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
308{
309 return false;
310}
311
312wxTextCtrlHitTestResult
6afc1b46 313wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const
ffecfa5a
JS
314{
315 return wxTE_HT_UNKNOWN;
316}
317
318// ----------------------------------------------------------------------------
4055ed82 319//
ffecfa5a
JS
320// ----------------------------------------------------------------------------
321
322void wxTextCtrl::ShowPosition(long pos)
323{
324}
325
326long wxTextCtrl::GetLengthOfLineContainingPos(long pos) const
327{
328 return 0;
329}
330
331int wxTextCtrl::GetLineLength(long lineNo) const
332{
333 return 0;
334}
335
336wxString wxTextCtrl::GetLineText(long lineNo) const
337{
338 wxString str;
339
340 return str;
341}
342
343void wxTextCtrl::SetMaxLength(unsigned long len)
344{
345}
346
347// ----------------------------------------------------------------------------
348// Undo/redo
349// ----------------------------------------------------------------------------
350
351void wxTextCtrl::Undo()
352{
353}
354
355void wxTextCtrl::Redo()
356{
357}
358
359bool wxTextCtrl::CanUndo() const
360{
6afc1b46 361 return false;
ffecfa5a
JS
362}
363
364bool wxTextCtrl::CanRedo() const
365{
6afc1b46 366 return false;
ffecfa5a
JS
367}
368
369// ----------------------------------------------------------------------------
370// caret handling (Windows only)
371// ----------------------------------------------------------------------------
372
373bool wxTextCtrl::ShowNativeCaret(bool show)
374{
375 return false;
376}
377
378// ----------------------------------------------------------------------------
379// implemenation details
380// ----------------------------------------------------------------------------
381
382void wxTextCtrl::Command(wxCommandEvent & event)
383{
384}
385
386void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
387{
388}
389
390// ----------------------------------------------------------------------------
391// kbd input processing
392// ----------------------------------------------------------------------------
393
ffecfa5a
JS
394void wxTextCtrl::OnChar(wxKeyEvent& event)
395{
396}
397
ffecfa5a
JS
398// ----------------------------------------------------------------------------
399// text control event processing
400// ----------------------------------------------------------------------------
401
402bool wxTextCtrl::SendUpdateEvent()
403{
404 return false;
405}
406
ffecfa5a
JS
407bool wxTextCtrl::AdjustSpaceLimit()
408{
409 return false;
410}
411
ffecfa5a
JS
412wxSize wxTextCtrl::DoGetBestSize() const
413{
414 return wxSize(0,0);
415}
416
417// ----------------------------------------------------------------------------
418// standard handlers for standard edit menu events
419// ----------------------------------------------------------------------------
420
421void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event))
422{
423}
424
425void wxTextCtrl::OnCopy(wxCommandEvent& WXUNUSED(event))
426{
427}
428
429void wxTextCtrl::OnPaste(wxCommandEvent& WXUNUSED(event))
430{
431}
432
433void wxTextCtrl::OnUndo(wxCommandEvent& WXUNUSED(event))
434{
435}
436
437void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event))
438{
439}
440
441void wxTextCtrl::OnDelete(wxCommandEvent& WXUNUSED(event))
442{
443}
444
445void wxTextCtrl::OnSelectAll(wxCommandEvent& WXUNUSED(event))
446{
447}
448
449void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event)
450{
451}
452
453void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event)
454{
455}
456
457void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event)
458{
459}
460
461void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event)
462{
463}
464
465void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
466{
467}
468
469void wxTextCtrl::OnUpdateDelete(wxUpdateUIEvent& event)
470{
471}
472
473void wxTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
474{
475}
476
6afc1b46 477void wxTextCtrl::OnSetFocus(wxFocusEvent& WXUNUSED(event))
ffecfa5a
JS
478{
479}
480
6afc1b46
VZ
481wxVisualAttributes 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
490bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& rEvent)
491{
492 return false;
493}
494bool wxTextCtrl::CanApplyThemeBorder() const
495{
496 return false;
497}
498bool wxTextCtrl::IsEmpty() const
499{
500 return false;
501}
502bool wxTextCtrl::AcceptsFocusFromKeyboard() const
503{
504 return false;
505}
506void wxTextCtrl::AdoptAttributesFromHWND()
507{
508}
509void wxTextCtrl::SetWindowStyleFlag(long lStyle)
ffecfa5a
JS
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
520bool 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
529bool wxTextCtrl::SetBackgroundColour(const wxColour& colour)
530{
531 return false;
532}
533
534bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
535{
536 return false;
537}
538
539// ----------------------------------------------------------------------------
6afc1b46 540// wxRichEditModule
ffecfa5a
JS
541// ----------------------------------------------------------------------------
542
6afc1b46 543bool wxRichEditModule::OnInit()
ffecfa5a
JS
544{
545 return false;
546}
547
6afc1b46 548void wxRichEditModule::OnExit()
ffecfa5a 549{
ffecfa5a
JS
550}
551
6afc1b46
VZ
552/* static */
553bool wxRichEditModule::Load(int version)
ffecfa5a
JS
554{
555 return false;
556}
557
6afc1b46 558#endif // wxUSE_RICHEDIT
ffecfa5a
JS
559
560// ----------------------------------------------------------------------------
6afc1b46 561// styling support for rich edit controls
ffecfa5a
JS
562// ----------------------------------------------------------------------------
563
6afc1b46
VZ
564#if wxUSE_RICHEDIT
565
566bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
ffecfa5a
JS
567{
568 return false;
569}
570
6afc1b46 571bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
ffecfa5a 572{
6afc1b46 573 return false;
ffecfa5a
JS
574}
575
6afc1b46 576bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
ffecfa5a
JS
577{
578 return false;
579}
580
581#endif // wxUSE_RICHEDIT
582
583#endif // wxUSE_TEXTCTRL