]>
Commit | Line | Data |
---|---|---|
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 | class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase | |
16 | { | |
17 | public: | |
18 | wxTextCtrl(); | |
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 | |
25 | #if wxUSE_VALIDATORS | |
26 | ,const wxValidator& rValidator = wxDefaultValidator | |
27 | #endif | |
28 | ,const wxString& rsName = wxTextCtrlNameStr | |
29 | ) | |
30 | { | |
31 | Create(pParent, vId, rsValue, rPos, rSize, lStyle, rValidator, rsName); | |
32 | } | |
33 | ~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 | #if wxUSE_VALIDATORS | |
42 | ,const wxValidator& rValidator = wxDefaultValidator | |
43 | #endif | |
44 | ,const wxString& rsName = wxTextCtrlNameStr | |
45 | ); | |
46 | ||
47 | // | |
48 | // Implement base class pure virtuals | |
49 | // ---------------------------------- | |
50 | // | |
51 | virtual wxString GetValue(void) const; | |
52 | virtual void SetValue(const wxString& rsValue); | |
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 LoadFile(const wxString& rsFile); | |
78 | ||
79 | virtual void DiscardEdits(void); | |
80 | ||
81 | virtual void WriteText(const wxString& rsText); | |
82 | virtual void AppendText(const wxString& rsText); | |
83 | virtual bool EmulateKeyPress(const wxKeyEvent& rEvent); | |
84 | ||
85 | virtual bool SetStyle( long lStart | |
86 | ,long lEnd | |
87 | ,const wxTextAttr& rStyle | |
88 | ); | |
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; | |
96 | ||
97 | virtual void ShowPosition(long lPos); | |
98 | ||
99 | virtual void Copy(void); | |
100 | virtual void Cut(void); | |
101 | virtual void Paste(void); | |
102 | ||
103 | virtual bool CanCopy(void) const; | |
104 | virtual bool CanCut(void) const; | |
105 | virtual bool CanPaste(void) const; | |
106 | ||
107 | virtual void Undo(void); | |
108 | virtual void Redo(void); | |
109 | ||
110 | virtual bool CanUndo(void) const; | |
111 | virtual bool CanRedo(void) const; | |
112 | ||
113 | virtual void SetInsertionPoint(long lPos); | |
114 | virtual void SetInsertionPointEnd(void); | |
115 | virtual long GetInsertionPoint(void) const; | |
116 | virtual long GetLastPosition(void) const; | |
117 | ||
118 | virtual void SetSelection( long lFrom | |
119 | ,long lTo | |
120 | ); | |
121 | virtual void SetEditable(bool bEditable); | |
122 | virtual void SetWindowStyleFlag(long lStyle); | |
123 | ||
124 | // | |
125 | // Implementation from now on | |
126 | // -------------------------- | |
127 | // | |
128 | virtual void Command(wxCommandEvent& rEvent); | |
129 | virtual bool OS2Command( WXUINT uParam | |
130 | ,WXWORD wId | |
131 | ); | |
132 | ||
133 | virtual WXHBRUSH OnCtlColor( WXHDC hDC | |
134 | ,WXHWND pWnd | |
135 | ,WXUINT nCtlColor | |
136 | ,WXUINT message | |
137 | ,WXWPARAM wParam | |
138 | ,WXLPARAM lParam | |
139 | ); | |
140 | ||
141 | virtual bool SetBackgroundColour(const wxColour& colour); | |
142 | virtual bool SetForegroundColour(const wxColour& colour); | |
143 | ||
144 | virtual void AdoptAttributesFromHWND(void); | |
145 | virtual void SetupColours(void); | |
146 | ||
147 | virtual bool AcceptsFocus(void) const; | |
148 | ||
149 | // callbacks | |
150 | void OnDropFiles(wxDropFilesEvent& rEvent); | |
151 | void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required | |
152 | ||
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); | |
158 | void OnDelete(wxCommandEvent& rEvent); | |
159 | void OnSelectAll(wxCommandEvent& rEvent); | |
160 | ||
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); | |
166 | void OnUpdateDelete(wxUpdateUIEvent& rEvent); | |
167 | void OnUpdateSelectAll(wxUpdateUIEvent& rEvent); | |
168 | ||
169 | inline bool IsMLE(void) {return m_bIsMLE;} | |
170 | inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;} | |
171 | ||
172 | protected: | |
173 | // | |
174 | // call this to increase the size limit (will do nothing if the current | |
175 | // limit is big enough) | |
176 | // | |
177 | void AdjustSpaceLimit(void); | |
178 | virtual wxSize DoGetBestSize(void) const; | |
179 | virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg); | |
180 | ||
181 | virtual WXDWORD OS2GetStyle( long lStyle | |
182 | ,WXDWORD* dwExstyle | |
183 | ) const; | |
184 | private: | |
185 | bool m_bIsMLE; | |
186 | DECLARE_EVENT_TABLE() | |
187 | DECLARE_DYNAMIC_CLASS(wxTextCtrl) | |
188 | }; // end of CLASS wxTextCtrl | |
189 | ||
190 | #endif | |
191 | // _WX_TEXTCTRL_H_ |