]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/textctrl.cpp
Updating with Vadim's API changes.
[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
48#include "wx/palmos/private.h"
49#include "wx/palmos/winundef.h"
50
51#include <string.h>
52
53#if wxUSE_RICHEDIT
54
55#include "wx/palmos/missing.h"
56
57#endif // wxUSE_RICHEDIT
58
59// ----------------------------------------------------------------------------
60// private classes
61// ----------------------------------------------------------------------------
62
63#if wxUSE_RICHEDIT
64
65// this module initializes RichEdit DLL(s) if needed
66class wxRichEditModule : public wxModule
67{
68public:
69 virtual bool OnInit();
70 virtual void OnExit();
71
72 // load the richedit DLL of at least of required version
73 static bool Load(int version = 1);
74
75private:
76 // the handles to richedit 1.0 and 2.0 (or 3.0) DLLs
77 static HINSTANCE ms_hRichEdit[2];
78
79 DECLARE_DYNAMIC_CLASS(wxRichEditModule)
80};
81
82HINSTANCE wxRichEditModule::ms_hRichEdit[2] = { NULL, NULL };
83
84IMPLEMENT_DYNAMIC_CLASS(wxRichEditModule, wxModule)
85
86#endif // wxUSE_RICHEDIT
87
88// ----------------------------------------------------------------------------
89// event tables and other macros
90// ----------------------------------------------------------------------------
91
92#if wxUSE_EXTENDED_RTTI
93WX_DEFINE_FLAGS( wxTextCtrlStyle )
94
95wxBEGIN_FLAGS( wxTextCtrlStyle )
96 // new style border flags, we put them first to
97 // use them for streaming out
98 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
99 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
100 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
101 wxFLAGS_MEMBER(wxBORDER_RAISED)
102 wxFLAGS_MEMBER(wxBORDER_STATIC)
103 wxFLAGS_MEMBER(wxBORDER_NONE)
4055ed82 104
ffecfa5a
JS
105 // old style border flags
106 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
107 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
108 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
109 wxFLAGS_MEMBER(wxRAISED_BORDER)
110 wxFLAGS_MEMBER(wxSTATIC_BORDER)
111 wxFLAGS_MEMBER(wxBORDER)
112
113 // standard window styles
114 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
115 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
116 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
117 wxFLAGS_MEMBER(wxWANTS_CHARS)
118 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
119 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
120 wxFLAGS_MEMBER(wxVSCROLL)
121 wxFLAGS_MEMBER(wxHSCROLL)
122
123 wxFLAGS_MEMBER(wxTE_PROCESS_ENTER)
124 wxFLAGS_MEMBER(wxTE_PROCESS_TAB)
125 wxFLAGS_MEMBER(wxTE_MULTILINE)
126 wxFLAGS_MEMBER(wxTE_PASSWORD)
127 wxFLAGS_MEMBER(wxTE_READONLY)
128 wxFLAGS_MEMBER(wxHSCROLL)
129 wxFLAGS_MEMBER(wxTE_RICH)
130 wxFLAGS_MEMBER(wxTE_RICH2)
131 wxFLAGS_MEMBER(wxTE_AUTO_URL)
132 wxFLAGS_MEMBER(wxTE_NOHIDESEL)
133 wxFLAGS_MEMBER(wxTE_LEFT)
134 wxFLAGS_MEMBER(wxTE_CENTRE)
135 wxFLAGS_MEMBER(wxTE_RIGHT)
136 wxFLAGS_MEMBER(wxTE_DONTWRAP)
40ff126a 137 wxFLAGS_MEMBER(wxTE_CHARWRAP)
ffecfa5a
JS
138 wxFLAGS_MEMBER(wxTE_WORDWRAP)
139
140wxEND_FLAGS( wxTextCtrlStyle )
141
142IMPLEMENT_DYNAMIC_CLASS_XTI(wxTextCtrl, wxControl,"wx/textctrl.h")
143
144wxBEGIN_PROPERTIES_TABLE(wxTextCtrl)
4055ed82 145 wxEVENT_PROPERTY( TextUpdated , wxEVT_COMMAND_TEXT_UPDATED , wxCommandEvent )
ffecfa5a
JS
146 wxEVENT_PROPERTY( TextEnter , wxEVT_COMMAND_TEXT_ENTER , wxCommandEvent )
147
148 wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
149 wxPROPERTY( Value , wxString , SetValue, GetValue, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
150 wxPROPERTY_FLAGS( WindowStyle , wxTextCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
151wxEND_PROPERTIES_TABLE()
152
153wxBEGIN_HANDLERS_TABLE(wxTextCtrl)
154wxEND_HANDLERS_TABLE()
155
156wxCONSTRUCTOR_6( wxTextCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , Value , wxPoint , Position , wxSize , Size , long , WindowStyle)
157#else
9d112688 158IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxTextCtrlBase)
ffecfa5a
JS
159#endif
160
161
9d112688 162BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
ffecfa5a
JS
163 EVT_CHAR(wxTextCtrl::OnChar)
164 EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
165
166#if wxUSE_RICHEDIT
167 EVT_RIGHT_UP(wxTextCtrl::OnRightClick)
168#endif
169
170 EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
171 EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
172 EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste)
173 EVT_MENU(wxID_UNDO, wxTextCtrl::OnUndo)
174 EVT_MENU(wxID_REDO, wxTextCtrl::OnRedo)
175 EVT_MENU(wxID_CLEAR, wxTextCtrl::OnDelete)
176 EVT_MENU(wxID_SELECTALL, wxTextCtrl::OnSelectAll)
177
178 EVT_UPDATE_UI(wxID_CUT, wxTextCtrl::OnUpdateCut)
179 EVT_UPDATE_UI(wxID_COPY, wxTextCtrl::OnUpdateCopy)
180 EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste)
181 EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo)
182 EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
183 EVT_UPDATE_UI(wxID_CLEAR, wxTextCtrl::OnUpdateDelete)
184 EVT_UPDATE_UI(wxID_SELECTALL, wxTextCtrl::OnUpdateSelectAll)
185
186 EVT_SET_FOCUS(wxTextCtrl::OnSetFocus)
187END_EVENT_TABLE()
188
189// ============================================================================
190// implementation
191// ============================================================================
192
193// ----------------------------------------------------------------------------
194// creation
195// ----------------------------------------------------------------------------
196
197void wxTextCtrl::Init()
198{
199}
200
201wxTextCtrl::~wxTextCtrl()
202{
203}
204
205bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
206 const wxString& value,
207 const wxPoint& pos,
208 const wxSize& size,
209 long style,
210 const wxValidator& validator,
211 const wxString& name)
212{
213 return false;
214}
215
ffecfa5a
JS
216WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
217{
218 return 0;
219}
220
ffecfa5a
JS
221// ----------------------------------------------------------------------------
222// set/get the controls text
223// ----------------------------------------------------------------------------
224
225wxString wxTextCtrl::GetValue() const
226{
227 wxString res;
228
229 return res;
230}
231
ee2ec18e 232void wxTextCtrl::DoSetValue(const wxString& value, int flags)
ffecfa5a
JS
233{
234}
235
ffecfa5a
JS
236void wxTextCtrl::WriteText(const wxString& value)
237{
238}
239
240void wxTextCtrl::DoWriteText(const wxString& value, bool selectionOnly)
241{
242}
243
244void wxTextCtrl::AppendText(const wxString& text)
245{
246}
247
248void wxTextCtrl::Clear()
249{
250}
251
ffecfa5a
JS
252// ----------------------------------------------------------------------------
253// Clipboard operations
254// ----------------------------------------------------------------------------
255
256void wxTextCtrl::Copy()
257{
258}
259
260void wxTextCtrl::Cut()
261{
262}
263
264void wxTextCtrl::Paste()
265{
266}
267
268bool wxTextCtrl::HasSelection() const
269{
270 return false;
271}
272
273bool wxTextCtrl::CanCopy() const
274{
275 return false;
276}
277
278bool wxTextCtrl::CanCut() const
279{
280 return false;
281}
282
283bool wxTextCtrl::CanPaste() const
284{
285 return false;
286}
287
288// ----------------------------------------------------------------------------
289// Accessors
290// ----------------------------------------------------------------------------
291
292void wxTextCtrl::SetEditable(bool editable)
293{
294}
295
296void wxTextCtrl::SetInsertionPoint(long pos)
297{
298}
299
300void wxTextCtrl::SetInsertionPointEnd()
301{
302}
303
304long wxTextCtrl::GetInsertionPoint() const
305{
306 return 0;
307}
308
7d8268a1 309wxTextPos wxTextCtrl::GetLastPosition() const
ffecfa5a
JS
310{
311 return 0;
312}
313
314// If the return values from and to are the same, there is no
315// selection.
316void wxTextCtrl::GetSelection(long* from, long* to) const
317{
318}
319
320bool wxTextCtrl::IsEditable() const
321{
322 return false;
323}
324
325// ----------------------------------------------------------------------------
326// selection
327// ----------------------------------------------------------------------------
328
329void wxTextCtrl::SetSelection(long from, long to)
330{
331}
332
333void wxTextCtrl::DoSetSelection(long from, long to, bool scrollCaret)
334{
335}
336
337// ----------------------------------------------------------------------------
338// Working with files
339// ----------------------------------------------------------------------------
340
3306aec1 341bool wxTextCtrl::DoLoadFile(const wxString& file, int fileType)
ffecfa5a
JS
342{
343 return false;
344}
345
346// ----------------------------------------------------------------------------
347// Editing
348// ----------------------------------------------------------------------------
349
350void wxTextCtrl::Replace(long from, long to, const wxString& value)
351{
352}
353
354void wxTextCtrl::Remove(long from, long to)
355{
356}
357
358bool wxTextCtrl::IsModified() const
359{
360 return false;
361}
362
363void wxTextCtrl::MarkDirty()
364{
365}
366
367void wxTextCtrl::DiscardEdits()
368{
369}
370
371int wxTextCtrl::GetNumberOfLines() const
372{
373 return 0;
374}
375
376// ----------------------------------------------------------------------------
377// Positions <-> coords
378// ----------------------------------------------------------------------------
379
380long wxTextCtrl::XYToPosition(long x, long y) const
381{
382 return 0;
383}
384
385bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
386{
387 return false;
388}
389
390wxTextCtrlHitTestResult
391wxTextCtrl::HitTest(const wxPoint& pt, wxTextCoord *col, wxTextCoord *row) const
392{
393 return wxTE_HT_UNKNOWN;
394}
395
396// ----------------------------------------------------------------------------
4055ed82 397//
ffecfa5a
JS
398// ----------------------------------------------------------------------------
399
400void wxTextCtrl::ShowPosition(long pos)
401{
402}
403
404long wxTextCtrl::GetLengthOfLineContainingPos(long pos) const
405{
406 return 0;
407}
408
409int wxTextCtrl::GetLineLength(long lineNo) const
410{
411 return 0;
412}
413
414wxString wxTextCtrl::GetLineText(long lineNo) const
415{
416 wxString str;
417
418 return str;
419}
420
421void wxTextCtrl::SetMaxLength(unsigned long len)
422{
423}
424
425// ----------------------------------------------------------------------------
426// Undo/redo
427// ----------------------------------------------------------------------------
428
429void wxTextCtrl::Undo()
430{
431}
432
433void wxTextCtrl::Redo()
434{
435}
436
437bool wxTextCtrl::CanUndo() const
438{
439}
440
441bool wxTextCtrl::CanRedo() const
442{
443}
444
445// ----------------------------------------------------------------------------
446// caret handling (Windows only)
447// ----------------------------------------------------------------------------
448
449bool wxTextCtrl::ShowNativeCaret(bool show)
450{
451 return false;
452}
453
454// ----------------------------------------------------------------------------
455// implemenation details
456// ----------------------------------------------------------------------------
457
458void wxTextCtrl::Command(wxCommandEvent & event)
459{
460}
461
462void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
463{
464}
465
466// ----------------------------------------------------------------------------
467// kbd input processing
468// ----------------------------------------------------------------------------
469
470bool wxTextCtrl::MSWShouldPreProcessMessage(WXMSG* pMsg)
471{
472 return false;
473}
474
475void wxTextCtrl::OnChar(wxKeyEvent& event)
476{
477}
478
479WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
480{
481 return 0;
482}
483
484// ----------------------------------------------------------------------------
485// text control event processing
486// ----------------------------------------------------------------------------
487
488bool wxTextCtrl::SendUpdateEvent()
489{
490 return false;
491}
492
493bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
494{
495 return false;
496}
497
ffecfa5a
JS
498bool wxTextCtrl::AdjustSpaceLimit()
499{
500 return false;
501}
502
503bool wxTextCtrl::AcceptsFocus() const
504{
505 return false;
506}
507
508wxSize wxTextCtrl::DoGetBestSize() const
509{
510 return wxSize(0,0);
511}
512
513// ----------------------------------------------------------------------------
514// standard handlers for standard edit menu events
515// ----------------------------------------------------------------------------
516
517void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event))
518{
519}
520
521void wxTextCtrl::OnCopy(wxCommandEvent& WXUNUSED(event))
522{
523}
524
525void wxTextCtrl::OnPaste(wxCommandEvent& WXUNUSED(event))
526{
527}
528
529void wxTextCtrl::OnUndo(wxCommandEvent& WXUNUSED(event))
530{
531}
532
533void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event))
534{
535}
536
537void wxTextCtrl::OnDelete(wxCommandEvent& WXUNUSED(event))
538{
539}
540
541void wxTextCtrl::OnSelectAll(wxCommandEvent& WXUNUSED(event))
542{
543}
544
545void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event)
546{
547}
548
549void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event)
550{
551}
552
553void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event)
554{
555}
556
557void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event)
558{
559}
560
561void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
562{
563}
564
565void wxTextCtrl::OnUpdateDelete(wxUpdateUIEvent& event)
566{
567}
568
569void wxTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
570{
571}
572
573void wxTextCtrl::OnRightClick(wxMouseEvent& event)
574{
575}
576
577void wxTextCtrl::OnSetFocus(wxFocusEvent& WXUNUSED(event))
578{
579}
580
581// the rest of the file only deals with the rich edit controls
582#if wxUSE_RICHEDIT
583
584// ----------------------------------------------------------------------------
585// EN_LINK processing
586// ----------------------------------------------------------------------------
587
588bool wxTextCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
589{
590 return false;
591}
592
593// ----------------------------------------------------------------------------
594// colour setting for the rich edit controls
595// ----------------------------------------------------------------------------
596
597bool wxTextCtrl::SetBackgroundColour(const wxColour& colour)
598{
599 return false;
600}
601
602bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
603{
604 return false;
605}
606
607// ----------------------------------------------------------------------------
608// styling support for rich edit controls
609// ----------------------------------------------------------------------------
610
611#if wxUSE_RICHEDIT
612
613bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
614{
615 return false;
616}
617
618bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
619{
620 return false;
621}
622
623bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
624{
625 return false;
626}
627
628#endif
629
630// ----------------------------------------------------------------------------
631// wxRichEditModule
632// ----------------------------------------------------------------------------
633
634bool wxRichEditModule::OnInit()
635{
636 return false;
637}
638
639void wxRichEditModule::OnExit()
640{
641}
642
643/* static */
644bool wxRichEditModule::Load(int version)
645{
646 return false;
647}
648
649#endif // wxUSE_RICHEDIT
650
651#endif // wxUSE_TEXTCTRL