]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/textctrl.h
Added DECLARE_LOCAL_EVENT_TYPE which doesn't use WXDLLEXPORT. This is
[wxWidgets.git] / include / wx / os2 / textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/17/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TEXTCTRL_H_
13 #define _WX_TEXTCTRL_H_
14
15 class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
16 {
17 public:
18 // creation
19 // --------
20
21 wxTextCtrl();
22 wxTextCtrl(wxWindow *parent, wxWindowID id,
23 const wxString& value = wxEmptyString,
24 const wxPoint& pos = wxDefaultPosition,
25 const wxSize& size = wxDefaultSize,
26 long style = 0,
27 #if wxUSE_VALIDATORS
28 const wxValidator& validator = wxDefaultValidator,
29 #endif
30 const wxString& name = wxTextCtrlNameStr)
31 {
32 Create(parent, id, value, pos, size, style, validator, name);
33 }
34
35 bool Create(wxWindow *parent, wxWindowID id,
36 const wxString& value = wxEmptyString,
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 long style = 0,
40 #if wxUSE_VALIDATORS
41 const wxValidator& validator = wxDefaultValidator,
42 #endif
43 const wxString& name = wxTextCtrlNameStr);
44
45 // implement base class pure virtuals
46 // ----------------------------------
47
48 virtual wxString GetValue() const;
49 virtual void SetValue(const wxString& value);
50
51 virtual int GetLineLength(long lineNo) const;
52 virtual wxString GetLineText(long lineNo) const;
53 virtual int GetNumberOfLines() const;
54
55 virtual bool IsModified() const;
56 virtual bool IsEditable() const;
57
58 // If the return values from and to are the same, there is no selection.
59 virtual void GetSelection(long* from, long* to) const;
60
61 // operations
62 // ----------
63
64 // editing
65 virtual void Clear();
66 virtual void Replace(long from, long to, const wxString& value);
67 virtual void Remove(long from, long to);
68
69 // load the controls contents from the file
70 virtual bool LoadFile(const wxString& file);
71
72 // clears the dirty flag
73 virtual void DiscardEdits();
74
75 // writing text inserts it at the current position, appending always
76 // inserts it at the end
77 virtual void WriteText(const wxString& text);
78 virtual void AppendText(const wxString& text);
79
80 // translate between the position (which is just an index in the text ctrl
81 // considering all its contents as a single strings) and (x, y) coordinates
82 // which represent column and line.
83 virtual long XYToPosition(long x, long y) const;
84 virtual bool PositionToXY(long pos, long *x, long *y) const;
85
86 virtual void ShowPosition(long pos);
87
88 // Clipboard operations
89 virtual void Copy();
90 virtual void Cut();
91 virtual void Paste();
92
93 virtual bool CanCopy() const;
94 virtual bool CanCut() const;
95 virtual bool CanPaste() const;
96
97 // Undo/redo
98 virtual void Undo();
99 virtual void Redo();
100
101 virtual bool CanUndo() const;
102 virtual bool CanRedo() const;
103
104 // Insertion point
105 virtual void SetInsertionPoint(long pos);
106 virtual void SetInsertionPointEnd();
107 virtual long GetInsertionPoint() const;
108 virtual long GetLastPosition() const;
109
110 virtual void SetSelection(long from, long to);
111 virtual void SetEditable(bool editable);
112
113 // Implementation from now on
114 // --------------------------
115
116 virtual void Command(wxCommandEvent& event);
117 virtual bool OS2Command(WXUINT param, WXWORD id);
118
119 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
120 WXUINT message, WXWPARAM wParam,
121 WXLPARAM lParam);
122
123 virtual void AdoptAttributesFromHWND();
124 virtual void SetupColours();
125
126 virtual bool AcceptsFocus() const;
127
128 // callbacks
129 void OnDropFiles(wxDropFilesEvent& event);
130 void OnChar(wxKeyEvent& event); // Process 'enter' if required
131
132 void OnCut(wxCommandEvent& event);
133 void OnCopy(wxCommandEvent& event);
134 void OnPaste(wxCommandEvent& event);
135 void OnUndo(wxCommandEvent& event);
136 void OnRedo(wxCommandEvent& event);
137
138 void OnUpdateCut(wxUpdateUIEvent& event);
139 void OnUpdateCopy(wxUpdateUIEvent& event);
140 void OnUpdatePaste(wxUpdateUIEvent& event);
141 void OnUpdateUndo(wxUpdateUIEvent& event);
142 void OnUpdateRedo(wxUpdateUIEvent& event);
143
144 protected:
145 // call this to increase the size limit (will do nothing if the current
146 // limit is big enough)
147 void AdjustSpaceLimit();
148
149 virtual wxSize DoGetBestSize() const;
150
151 private:
152 DECLARE_EVENT_TABLE()
153 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
154 };
155
156 #endif
157 // _WX_TEXTCTRL_H_