]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/textctrl.h
e6197dd8fd74afe182829cdb0c3f2e80334d9544
[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 typedef int (wxCALLBACK *wxTreeCtrlCompare)(long lItem1, long lItem2, long lSortData);
16
17 class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
18 {
19 public:
20 wxTextCtrl();
21 wxTextCtrl( wxWindow* pParent
22 ,wxWindowID vId
23 ,const wxString& rsValue = wxEmptyString
24 ,const wxPoint& rPos = wxDefaultPosition
25 ,const wxSize& rSize = wxDefaultSize
26 ,long lStyle = 0
27 ,const wxValidator& rValidator = wxDefaultValidator
28 ,const wxString& rsName = wxTextCtrlNameStr
29 )
30 {
31 Create(pParent, vId, rsValue, rPos, rSize, lStyle, rValidator, rsName);
32 }
33 virtual ~wxTextCtrl();
34
35 bool Create( wxWindow* pParent
36 ,wxWindowID vId
37 ,const wxString& rsValue = wxEmptyString
38 ,const wxPoint& rPos = wxDefaultPosition
39 ,const wxSize& rSize = wxDefaultSize
40 ,long lStyle = 0
41 ,const wxValidator& rValidator = wxDefaultValidator
42 ,const wxString& rsName = wxTextCtrlNameStr
43 );
44
45 //
46 // Implement base class pure virtuals
47 // ----------------------------------
48 //
49 virtual wxString GetValue(void) const;
50 virtual void SetValue(const wxString& value) { DoSetValue(value, SetValue_SendEvent); }
51
52 virtual void ChangeValue(const wxString &value) { DoSetValue(value); }
53
54 virtual int GetLineLength(long nLineNo) const;
55 virtual wxString GetLineText(long nLineNo) const;
56 virtual int GetNumberOfLines(void) const;
57
58 virtual bool IsModified(void) const;
59 virtual bool IsEditable(void) const;
60
61 virtual void GetSelection( long* pFrom
62 ,long* pTo
63 ) const;
64 //
65 // Operations
66 // ----------
67 //
68 virtual void Clear(void);
69 virtual void Replace( long lFrom
70 ,long lTo
71 ,const wxString& rsValue
72 );
73 virtual void Remove( long lFrom
74 ,long lTo
75 );
76
77 virtual bool DoLoadFile(const wxString& rsFile, int fileType);
78
79 virtual void MarkDirty();
80 virtual void DiscardEdits(void);
81
82 virtual void WriteText(const wxString& rsText);
83 virtual void AppendText(const wxString& rsText);
84 virtual bool EmulateKeyPress(const wxKeyEvent& rEvent);
85
86 virtual bool SetStyle( long lStart
87 ,long lEnd
88 ,const wxTextAttr& rStyle
89 );
90 virtual long XYToPosition( long lX
91 ,long lY
92 ) const;
93 virtual bool PositionToXY( long lPos
94 ,long* plX
95 ,long* plY
96 ) const;
97
98 virtual void ShowPosition(long lPos);
99
100 virtual void Copy(void);
101 virtual void Cut(void);
102 virtual void Paste(void);
103
104 virtual bool CanCopy(void) const;
105 virtual bool CanCut(void) const;
106 virtual bool CanPaste(void) const;
107
108 virtual void Undo(void);
109 virtual void Redo(void);
110
111 virtual bool CanUndo(void) const;
112 virtual bool CanRedo(void) const;
113
114 virtual void SetInsertionPoint(long lPos);
115 virtual void SetInsertionPointEnd(void);
116 virtual long GetInsertionPoint(void) const;
117 virtual wxTextPos GetLastPosition(void) const;
118
119 virtual void SetSelection( long lFrom
120 ,long lTo
121 );
122 virtual void SetEditable(bool bEditable);
123 virtual void SetWindowStyleFlag(long lStyle);
124
125 //
126 // Implementation from now on
127 // --------------------------
128 //
129 virtual void Command(wxCommandEvent& rEvent);
130 virtual bool OS2Command( WXUINT uParam
131 ,WXWORD wId
132 );
133
134 virtual WXHBRUSH OnCtlColor( WXHDC hDC
135 ,WXHWND pWnd
136 ,WXUINT nCtlColor
137 ,WXUINT message
138 ,WXWPARAM wParam
139 ,WXLPARAM lParam
140 );
141
142 virtual bool SetBackgroundColour(const wxColour& colour);
143 virtual bool SetForegroundColour(const wxColour& colour);
144
145 virtual void AdoptAttributesFromHWND(void);
146 virtual void SetupColours(void);
147
148 virtual bool AcceptsFocus(void) const;
149
150 // callbacks
151 void OnDropFiles(wxDropFilesEvent& rEvent);
152 void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required
153
154 void OnCut(wxCommandEvent& rEvent);
155 void OnCopy(wxCommandEvent& rEvent);
156 void OnPaste(wxCommandEvent& rEvent);
157 void OnUndo(wxCommandEvent& rEvent);
158 void OnRedo(wxCommandEvent& rEvent);
159 void OnDelete(wxCommandEvent& rEvent);
160 void OnSelectAll(wxCommandEvent& rEvent);
161
162 void OnUpdateCut(wxUpdateUIEvent& rEvent);
163 void OnUpdateCopy(wxUpdateUIEvent& rEvent);
164 void OnUpdatePaste(wxUpdateUIEvent& rEvent);
165 void OnUpdateUndo(wxUpdateUIEvent& rEvent);
166 void OnUpdateRedo(wxUpdateUIEvent& rEvent);
167 void OnUpdateDelete(wxUpdateUIEvent& rEvent);
168 void OnUpdateSelectAll(wxUpdateUIEvent& rEvent);
169
170 inline bool IsMLE(void) {return m_bIsMLE;}
171 inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;}
172
173 protected:
174 //
175 // call this to increase the size limit (will do nothing if the current
176 // limit is big enough)
177 //
178 void AdjustSpaceLimit(void);
179 virtual wxSize DoGetBestSize(void) const;
180 virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg);
181
182 virtual WXDWORD OS2GetStyle( long lStyle
183 ,WXDWORD* dwExstyle
184 ) const;
185
186 void DoSetValue(const wxString &value, int flags = 0);
187
188 bool m_bSkipUpdate;
189
190 private:
191 bool m_bIsMLE;
192 DECLARE_EVENT_TABLE()
193 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
194 }; // end of CLASS wxTextCtrl
195
196 #endif
197 // _WX_TEXTCTRL_H_