]>
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 | |
ca8f0290 | 25 | ,const wxValidator& rValidator = wxDefaultValidator |
ca8f0290 DW |
26 | ,const wxString& rsName = wxTextCtrlNameStr |
27 | ) | |
d90895ac | 28 | { |
ca8f0290 | 29 | Create(pParent, vId, rsValue, rPos, rSize, lStyle, rValidator, rsName); |
d90895ac | 30 | } |
2b5f62a0 | 31 | ~wxTextCtrl(); |
d90895ac | 32 | |
ca8f0290 DW |
33 | bool Create( wxWindow* pParent |
34 | ,wxWindowID vId | |
35 | ,const wxString& rsValue = wxEmptyString | |
36 | ,const wxPoint& rPos = wxDefaultPosition | |
37 | ,const wxSize& rSize = wxDefaultSize | |
38 | ,long lStyle = 0 | |
ca8f0290 | 39 | ,const wxValidator& rValidator = wxDefaultValidator |
ca8f0290 DW |
40 | ,const wxString& rsName = wxTextCtrlNameStr |
41 | ); | |
d90895ac | 42 | |
1ec46a5b DW |
43 | // |
44 | // Implement base class pure virtuals | |
d90895ac | 45 | // ---------------------------------- |
1ec46a5b | 46 | // |
ca8f0290 DW |
47 | virtual wxString GetValue(void) const; |
48 | virtual void SetValue(const wxString& rsValue); | |
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 | |
ca8f0290 | 73 | virtual bool LoadFile(const wxString& rsFile); |
d90895ac | 74 | |
ca8f0290 | 75 | virtual void DiscardEdits(void); |
d90895ac | 76 | |
ca8f0290 DW |
77 | virtual void WriteText(const wxString& rsText); |
78 | virtual void AppendText(const wxString& rsText); | |
a086de98 | 79 | virtual bool EmulateKeyPress(const wxKeyEvent& rEvent); |
d90895ac | 80 | |
1ec46a5b DW |
81 | virtual bool SetStyle( long lStart |
82 | ,long lEnd | |
83 | ,const wxTextAttr& rStyle | |
84 | ); | |
ca8f0290 DW |
85 | virtual long XYToPosition( long lX |
86 | ,long lY | |
87 | ) const; | |
88 | virtual bool PositionToXY( long lPos | |
89 | ,long* plX | |
90 | ,long* plY | |
91 | ) const; | |
d90895ac | 92 | |
ca8f0290 | 93 | virtual void ShowPosition(long lPos); |
d90895ac | 94 | |
ca8f0290 DW |
95 | virtual void Copy(void); |
96 | virtual void Cut(void); | |
97 | virtual void Paste(void); | |
d90895ac | 98 | |
ca8f0290 DW |
99 | virtual bool CanCopy(void) const; |
100 | virtual bool CanCut(void) const; | |
101 | virtual bool CanPaste(void) const; | |
d90895ac | 102 | |
ca8f0290 DW |
103 | virtual void Undo(void); |
104 | virtual void Redo(void); | |
d90895ac | 105 | |
ca8f0290 DW |
106 | virtual bool CanUndo(void) const; |
107 | virtual bool CanRedo(void) const; | |
d90895ac | 108 | |
ca8f0290 DW |
109 | virtual void SetInsertionPoint(long lPos); |
110 | virtual void SetInsertionPointEnd(void); | |
111 | virtual long GetInsertionPoint(void) const; | |
112 | virtual long GetLastPosition(void) const; | |
d90895ac | 113 | |
ca8f0290 DW |
114 | virtual void SetSelection( long lFrom |
115 | ,long lTo | |
116 | ); | |
117 | virtual void SetEditable(bool bEditable); | |
b9b1d6c8 | 118 | virtual void SetWindowStyleFlag(long lStyle); |
d90895ac | 119 | |
ca8f0290 | 120 | // |
d90895ac DW |
121 | // Implementation from now on |
122 | // -------------------------- | |
ca8f0290 DW |
123 | // |
124 | virtual void Command(wxCommandEvent& rEvent); | |
125 | virtual bool OS2Command( WXUINT uParam | |
126 | ,WXWORD wId | |
127 | ); | |
d90895ac | 128 | |
ca8f0290 DW |
129 | virtual WXHBRUSH OnCtlColor( WXHDC hDC |
130 | ,WXHWND pWnd | |
131 | ,WXUINT nCtlColor | |
132 | ,WXUINT message | |
133 | ,WXWPARAM wParam | |
134 | ,WXLPARAM lParam | |
135 | ); | |
d90895ac | 136 | |
ca8f0290 DW |
137 | virtual bool SetBackgroundColour(const wxColour& colour); |
138 | virtual bool SetForegroundColour(const wxColour& colour); | |
d90895ac | 139 | |
ca8f0290 DW |
140 | virtual void AdoptAttributesFromHWND(void); |
141 | virtual void SetupColours(void); | |
d90895ac | 142 | |
ca8f0290 | 143 | virtual bool AcceptsFocus(void) const; |
d90895ac DW |
144 | |
145 | // callbacks | |
ca8f0290 DW |
146 | void OnDropFiles(wxDropFilesEvent& rEvent); |
147 | void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required | |
0e320a79 | 148 | |
ca8f0290 DW |
149 | void OnCut(wxCommandEvent& rEvent); |
150 | void OnCopy(wxCommandEvent& rEvent); | |
151 | void OnPaste(wxCommandEvent& rEvent); | |
152 | void OnUndo(wxCommandEvent& rEvent); | |
153 | void OnRedo(wxCommandEvent& rEvent); | |
2b5f62a0 VZ |
154 | void OnDelete(wxCommandEvent& rEvent); |
155 | void OnSelectAll(wxCommandEvent& rEvent); | |
0e320a79 | 156 | |
ca8f0290 DW |
157 | void OnUpdateCut(wxUpdateUIEvent& rEvent); |
158 | void OnUpdateCopy(wxUpdateUIEvent& rEvent); | |
159 | void OnUpdatePaste(wxUpdateUIEvent& rEvent); | |
160 | void OnUpdateUndo(wxUpdateUIEvent& rEvent); | |
161 | void OnUpdateRedo(wxUpdateUIEvent& rEvent); | |
2b5f62a0 VZ |
162 | void OnUpdateDelete(wxUpdateUIEvent& rEvent); |
163 | void OnUpdateSelectAll(wxUpdateUIEvent& rEvent); | |
ca8f0290 DW |
164 | |
165 | inline bool IsMLE(void) {return m_bIsMLE;} | |
166 | inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;} | |
0e320a79 | 167 | |
d90895ac | 168 | protected: |
ca8f0290 | 169 | // |
d90895ac DW |
170 | // call this to increase the size limit (will do nothing if the current |
171 | // limit is big enough) | |
ca8f0290 DW |
172 | // |
173 | void AdjustSpaceLimit(void); | |
174 | virtual wxSize DoGetBestSize(void) const; | |
f140b352 | 175 | virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg); |
0e320a79 | 176 | |
b9b1d6c8 DW |
177 | virtual WXDWORD OS2GetStyle( long lStyle |
178 | ,WXDWORD* dwExstyle | |
179 | ) const; | |
d90895ac | 180 | private: |
ca8f0290 | 181 | bool m_bIsMLE; |
d90895ac DW |
182 | DECLARE_EVENT_TABLE() |
183 | DECLARE_DYNAMIC_CLASS(wxTextCtrl) | |
ca8f0290 | 184 | }; // end of CLASS wxTextCtrl |
0e320a79 DW |
185 | |
186 | #endif | |
187 | // _WX_TEXTCTRL_H_ |