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