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