]>
Commit | Line | Data |
---|---|---|
0e320a79 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/os2/textctrl.h |
0e320a79 | 3 | // Purpose: wxTextCtrl class |
d90895ac | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
d90895ac | 6 | // Created: 10/17/99 |
d90895ac | 7 | // Copyright: (c) David Webster |
65571936 | 8 | // Licence: wxWindows licence |
0e320a79 DW |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_TEXTCTRL_H_ | |
12 | #define _WX_TEXTCTRL_H_ | |
13 | ||
4fd899b6 DW |
14 | typedef int (wxCALLBACK *wxTreeCtrlCompare)(long lItem1, long lItem2, long lSortData); |
15 | ||
53a2db12 | 16 | class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase |
d90895ac DW |
17 | { |
18 | public: | |
d90895ac | 19 | wxTextCtrl(); |
ca8f0290 DW |
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 | |
ca8f0290 | 26 | ,const wxValidator& rValidator = wxDefaultValidator |
ca8f0290 DW |
27 | ,const wxString& rsName = wxTextCtrlNameStr |
28 | ) | |
d90895ac | 29 | { |
ca8f0290 | 30 | Create(pParent, vId, rsValue, rPos, rSize, lStyle, rValidator, rsName); |
d90895ac | 31 | } |
a0e55920 | 32 | virtual ~wxTextCtrl(); |
d90895ac | 33 | |
ca8f0290 DW |
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 | |
ca8f0290 | 40 | ,const wxValidator& rValidator = wxDefaultValidator |
ca8f0290 DW |
41 | ,const wxString& rsName = wxTextCtrlNameStr |
42 | ); | |
d90895ac | 43 | |
1ec46a5b DW |
44 | // |
45 | // Implement base class pure virtuals | |
d90895ac | 46 | // ---------------------------------- |
1ec46a5b | 47 | // |
ca8f0290 | 48 | virtual wxString GetValue(void) const; |
d90895ac | 49 | |
ca8f0290 DW |
50 | virtual int GetLineLength(long nLineNo) const; |
51 | virtual wxString GetLineText(long nLineNo) const; | |
52 | virtual int GetNumberOfLines(void) const; | |
d90895ac | 53 | |
ca8f0290 DW |
54 | virtual bool IsModified(void) const; |
55 | virtual bool IsEditable(void) const; | |
d90895ac | 56 | |
ca8f0290 DW |
57 | virtual void GetSelection( long* pFrom |
58 | ,long* pTo | |
59 | ) const; | |
1ec46a5b DW |
60 | // |
61 | // Operations | |
d90895ac | 62 | // ---------- |
1ec46a5b | 63 | // |
ca8f0290 DW |
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 | ); | |
d90895ac | 72 | |
3306aec1 | 73 | virtual bool DoLoadFile(const wxString& rsFile, int fileType); |
d90895ac | 74 | |
3a9fa0d6 | 75 | virtual void MarkDirty(); |
ca8f0290 | 76 | virtual void DiscardEdits(void); |
d90895ac | 77 | |
ca8f0290 DW |
78 | virtual void WriteText(const wxString& rsText); |
79 | virtual void AppendText(const wxString& rsText); | |
a086de98 | 80 | virtual bool EmulateKeyPress(const wxKeyEvent& rEvent); |
d90895ac | 81 | |
1ec46a5b DW |
82 | virtual bool SetStyle( long lStart |
83 | ,long lEnd | |
84 | ,const wxTextAttr& rStyle | |
85 | ); | |
ca8f0290 DW |
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; | |
d90895ac | 93 | |
ca8f0290 | 94 | virtual void ShowPosition(long lPos); |
d90895ac | 95 | |
ca8f0290 DW |
96 | virtual void Copy(void); |
97 | virtual void Cut(void); | |
98 | virtual void Paste(void); | |
d90895ac | 99 | |
ca8f0290 DW |
100 | virtual bool CanCopy(void) const; |
101 | virtual bool CanCut(void) const; | |
102 | virtual bool CanPaste(void) const; | |
d90895ac | 103 | |
ca8f0290 DW |
104 | virtual void Undo(void); |
105 | virtual void Redo(void); | |
d90895ac | 106 | |
ca8f0290 DW |
107 | virtual bool CanUndo(void) const; |
108 | virtual bool CanRedo(void) const; | |
d90895ac | 109 | |
ca8f0290 DW |
110 | virtual void SetInsertionPoint(long lPos); |
111 | virtual void SetInsertionPointEnd(void); | |
112 | virtual long GetInsertionPoint(void) const; | |
7d8268a1 | 113 | virtual wxTextPos GetLastPosition(void) const; |
d90895ac | 114 | |
ca8f0290 DW |
115 | virtual void SetSelection( long lFrom |
116 | ,long lTo | |
117 | ); | |
118 | virtual void SetEditable(bool bEditable); | |
b9b1d6c8 | 119 | virtual void SetWindowStyleFlag(long lStyle); |
d90895ac | 120 | |
ca8f0290 | 121 | // |
d90895ac DW |
122 | // Implementation from now on |
123 | // -------------------------- | |
ca8f0290 DW |
124 | // |
125 | virtual void Command(wxCommandEvent& rEvent); | |
126 | virtual bool OS2Command( WXUINT uParam | |
127 | ,WXWORD wId | |
128 | ); | |
d90895ac | 129 | |
ca8f0290 DW |
130 | virtual WXHBRUSH OnCtlColor( WXHDC hDC |
131 | ,WXHWND pWnd | |
132 | ,WXUINT nCtlColor | |
133 | ,WXUINT message | |
134 | ,WXWPARAM wParam | |
135 | ,WXLPARAM lParam | |
136 | ); | |
d90895ac | 137 | |
ca8f0290 DW |
138 | virtual bool SetBackgroundColour(const wxColour& colour); |
139 | virtual bool SetForegroundColour(const wxColour& colour); | |
d90895ac | 140 | |
ca8f0290 DW |
141 | virtual void AdoptAttributesFromHWND(void); |
142 | virtual void SetupColours(void); | |
d90895ac | 143 | |
ca8f0290 | 144 | virtual bool AcceptsFocus(void) const; |
d90895ac DW |
145 | |
146 | // callbacks | |
ca8f0290 DW |
147 | void OnDropFiles(wxDropFilesEvent& rEvent); |
148 | void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required | |
0e320a79 | 149 | |
ca8f0290 DW |
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); | |
2b5f62a0 VZ |
155 | void OnDelete(wxCommandEvent& rEvent); |
156 | void OnSelectAll(wxCommandEvent& rEvent); | |
0e320a79 | 157 | |
ca8f0290 DW |
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); | |
2b5f62a0 VZ |
163 | void OnUpdateDelete(wxUpdateUIEvent& rEvent); |
164 | void OnUpdateSelectAll(wxUpdateUIEvent& rEvent); | |
ca8f0290 DW |
165 | |
166 | inline bool IsMLE(void) {return m_bIsMLE;} | |
167 | inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;} | |
0e320a79 | 168 | |
d90895ac | 169 | protected: |
ca8f0290 | 170 | // |
d90895ac DW |
171 | // call this to increase the size limit (will do nothing if the current |
172 | // limit is big enough) | |
ca8f0290 DW |
173 | // |
174 | void AdjustSpaceLimit(void); | |
175 | virtual wxSize DoGetBestSize(void) const; | |
f140b352 | 176 | virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg); |
0e320a79 | 177 | |
b9b1d6c8 DW |
178 | virtual WXDWORD OS2GetStyle( long lStyle |
179 | ,WXDWORD* dwExstyle | |
180 | ) const; | |
f6519b40 | 181 | |
ee2ec18e | 182 | virtual void DoSetValue(const wxString &value, int flags = 0); |
f6519b40 VZ |
183 | |
184 | bool m_bSkipUpdate; | |
185 | ||
d90895ac | 186 | private: |
72cb72bf SN |
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 | ||
ca8f0290 | 191 | bool m_bIsMLE; |
d90895ac DW |
192 | DECLARE_EVENT_TABLE() |
193 | DECLARE_DYNAMIC_CLASS(wxTextCtrl) | |
ca8f0290 | 194 | }; // end of CLASS wxTextCtrl |
0e320a79 DW |
195 | |
196 | #endif | |
197 | // _WX_TEXTCTRL_H_ |