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