]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/textctrl.h
Automatically adjust toolbar's tool size if the provided bitmaps
[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 WXDLLIMPEXP_CORE 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
51 virtual int GetLineLength(long nLineNo) const;
52 virtual wxString GetLineText(long nLineNo) const;
53 virtual int GetNumberOfLines(void) const;
54
55 virtual bool IsModified(void) const;
56 virtual bool IsEditable(void) const;
57
58 virtual void GetSelection( long* pFrom
59 ,long* pTo
60 ) const;
61 //
62 // Operations
63 // ----------
64 //
65 virtual void Clear(void);
66 virtual void Replace( long lFrom
67 ,long lTo
68 ,const wxString& rsValue
69 );
70 virtual void Remove( long lFrom
71 ,long lTo
72 );
73
74 virtual bool DoLoadFile(const wxString& rsFile, int fileType);
75
76 virtual void MarkDirty();
77 virtual void DiscardEdits(void);
78
79 virtual void WriteText(const wxString& rsText);
80 virtual void AppendText(const wxString& rsText);
81 virtual bool EmulateKeyPress(const wxKeyEvent& rEvent);
82
83 virtual bool SetStyle( long lStart
84 ,long lEnd
85 ,const wxTextAttr& rStyle
86 );
87 virtual long XYToPosition( long lX
88 ,long lY
89 ) const;
90 virtual bool PositionToXY( long lPos
91 ,long* plX
92 ,long* plY
93 ) const;
94
95 virtual void ShowPosition(long lPos);
96
97 virtual void Copy(void);
98 virtual void Cut(void);
99 virtual void Paste(void);
100
101 virtual bool CanCopy(void) const;
102 virtual bool CanCut(void) const;
103 virtual bool CanPaste(void) const;
104
105 virtual void Undo(void);
106 virtual void Redo(void);
107
108 virtual bool CanUndo(void) const;
109 virtual bool CanRedo(void) const;
110
111 virtual void SetInsertionPoint(long lPos);
112 virtual void SetInsertionPointEnd(void);
113 virtual long GetInsertionPoint(void) const;
114 virtual wxTextPos GetLastPosition(void) const;
115
116 virtual void SetSelection( long lFrom
117 ,long lTo
118 );
119 virtual void SetEditable(bool bEditable);
120 virtual void SetWindowStyleFlag(long lStyle);
121
122 //
123 // Implementation from now on
124 // --------------------------
125 //
126 virtual void Command(wxCommandEvent& rEvent);
127 virtual bool OS2Command( WXUINT uParam
128 ,WXWORD wId
129 );
130
131 virtual WXHBRUSH OnCtlColor( WXHDC hDC
132 ,WXHWND pWnd
133 ,WXUINT nCtlColor
134 ,WXUINT message
135 ,WXWPARAM wParam
136 ,WXLPARAM lParam
137 );
138
139 virtual bool SetBackgroundColour(const wxColour& colour);
140 virtual bool SetForegroundColour(const wxColour& colour);
141
142 virtual void AdoptAttributesFromHWND(void);
143 virtual void SetupColours(void);
144
145 virtual bool AcceptsFocus(void) const;
146
147 // callbacks
148 void OnDropFiles(wxDropFilesEvent& rEvent);
149 void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required
150
151 void OnCut(wxCommandEvent& rEvent);
152 void OnCopy(wxCommandEvent& rEvent);
153 void OnPaste(wxCommandEvent& rEvent);
154 void OnUndo(wxCommandEvent& rEvent);
155 void OnRedo(wxCommandEvent& rEvent);
156 void OnDelete(wxCommandEvent& rEvent);
157 void OnSelectAll(wxCommandEvent& rEvent);
158
159 void OnUpdateCut(wxUpdateUIEvent& rEvent);
160 void OnUpdateCopy(wxUpdateUIEvent& rEvent);
161 void OnUpdatePaste(wxUpdateUIEvent& rEvent);
162 void OnUpdateUndo(wxUpdateUIEvent& rEvent);
163 void OnUpdateRedo(wxUpdateUIEvent& rEvent);
164 void OnUpdateDelete(wxUpdateUIEvent& rEvent);
165 void OnUpdateSelectAll(wxUpdateUIEvent& rEvent);
166
167 inline bool IsMLE(void) {return m_bIsMLE;}
168 inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;}
169
170 protected:
171 //
172 // call this to increase the size limit (will do nothing if the current
173 // limit is big enough)
174 //
175 void AdjustSpaceLimit(void);
176 virtual wxSize DoGetBestSize(void) const;
177 virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg);
178
179 virtual WXDWORD OS2GetStyle( long lStyle
180 ,WXDWORD* dwExstyle
181 ) const;
182
183 virtual void DoSetValue(const wxString &value, int flags = 0);
184
185 bool m_bSkipUpdate;
186
187 private:
188 // implement wxTextEntry pure virtual: it implements all the operations for
189 // the simple EDIT controls
190 virtual WXHWND GetEditHWND() const { return m_hWnd; }
191
192 bool m_bIsMLE;
193 DECLARE_EVENT_TABLE()
194 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
195 }; // end of CLASS wxTextCtrl
196
197 #endif
198 // _WX_TEXTCTRL_H_