]>
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 DW |
32 | } |
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 | |
57c4d796 | 40 | #if wxUSE_VALIDATORS |
ca8f0290 | 41 | ,const wxValidator& rValidator = wxDefaultValidator |
57c4d796 | 42 | #endif |
ca8f0290 DW |
43 | ,const wxString& rsName = wxTextCtrlNameStr |
44 | ); | |
d90895ac | 45 | |
1ec46a5b DW |
46 | // |
47 | // Implement base class pure virtuals | |
d90895ac | 48 | // ---------------------------------- |
1ec46a5b | 49 | // |
ca8f0290 DW |
50 | virtual wxString GetValue(void) const; |
51 | virtual void SetValue(const wxString& rsValue); | |
d90895ac | 52 | |
ca8f0290 DW |
53 | virtual int GetLineLength(long nLineNo) const; |
54 | virtual wxString GetLineText(long nLineNo) const; | |
55 | virtual int GetNumberOfLines(void) const; | |
d90895ac | 56 | |
ca8f0290 DW |
57 | virtual bool IsModified(void) const; |
58 | virtual bool IsEditable(void) const; | |
d90895ac | 59 | |
ca8f0290 DW |
60 | virtual void GetSelection( long* pFrom |
61 | ,long* pTo | |
62 | ) const; | |
1ec46a5b DW |
63 | // |
64 | // Operations | |
d90895ac | 65 | // ---------- |
1ec46a5b | 66 | // |
ca8f0290 DW |
67 | virtual void Clear(void); |
68 | virtual void Replace( long lFrom | |
69 | ,long lTo | |
70 | ,const wxString& rsValue | |
71 | ); | |
72 | virtual void Remove( long lFrom | |
73 | ,long lTo | |
74 | ); | |
d90895ac | 75 | |
ca8f0290 | 76 | virtual bool LoadFile(const wxString& rsFile); |
d90895ac | 77 | |
ca8f0290 | 78 | virtual void DiscardEdits(void); |
d90895ac | 79 | |
ca8f0290 DW |
80 | virtual void WriteText(const wxString& rsText); |
81 | virtual void AppendText(const wxString& rsText); | |
d90895ac | 82 | |
1ec46a5b DW |
83 | virtual bool SetStyle( long lStart |
84 | ,long lEnd | |
85 | ,const wxTextAttr& rStyle | |
86 | ); | |
ca8f0290 DW |
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; | |
d90895ac | 94 | |
ca8f0290 | 95 | virtual void ShowPosition(long lPos); |
d90895ac | 96 | |
ca8f0290 DW |
97 | virtual void Copy(void); |
98 | virtual void Cut(void); | |
99 | virtual void Paste(void); | |
d90895ac | 100 | |
ca8f0290 DW |
101 | virtual bool CanCopy(void) const; |
102 | virtual bool CanCut(void) const; | |
103 | virtual bool CanPaste(void) const; | |
d90895ac | 104 | |
ca8f0290 DW |
105 | virtual void Undo(void); |
106 | virtual void Redo(void); | |
d90895ac | 107 | |
ca8f0290 DW |
108 | virtual bool CanUndo(void) const; |
109 | virtual bool CanRedo(void) const; | |
d90895ac | 110 | |
ca8f0290 DW |
111 | virtual void SetInsertionPoint(long lPos); |
112 | virtual void SetInsertionPointEnd(void); | |
113 | virtual long GetInsertionPoint(void) const; | |
114 | virtual long GetLastPosition(void) const; | |
d90895ac | 115 | |
ca8f0290 DW |
116 | virtual void SetSelection( long lFrom |
117 | ,long lTo | |
118 | ); | |
119 | virtual void SetEditable(bool bEditable); | |
b9b1d6c8 | 120 | virtual void SetWindowStyleFlag(long lStyle); |
d90895ac | 121 | |
ca8f0290 | 122 | // |
d90895ac DW |
123 | // Implementation from now on |
124 | // -------------------------- | |
ca8f0290 DW |
125 | // |
126 | virtual void Command(wxCommandEvent& rEvent); | |
127 | virtual bool OS2Command( WXUINT uParam | |
128 | ,WXWORD wId | |
129 | ); | |
d90895ac | 130 | |
ca8f0290 DW |
131 | virtual WXHBRUSH OnCtlColor( WXHDC hDC |
132 | ,WXHWND pWnd | |
133 | ,WXUINT nCtlColor | |
134 | ,WXUINT message | |
135 | ,WXWPARAM wParam | |
136 | ,WXLPARAM lParam | |
137 | ); | |
d90895ac | 138 | |
ca8f0290 DW |
139 | virtual bool SetBackgroundColour(const wxColour& colour); |
140 | virtual bool SetForegroundColour(const wxColour& colour); | |
d90895ac | 141 | |
ca8f0290 DW |
142 | virtual void AdoptAttributesFromHWND(void); |
143 | virtual void SetupColours(void); | |
d90895ac | 144 | |
ca8f0290 | 145 | virtual bool AcceptsFocus(void) const; |
d90895ac DW |
146 | |
147 | // callbacks | |
ca8f0290 DW |
148 | void OnDropFiles(wxDropFilesEvent& rEvent); |
149 | void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required | |
0e320a79 | 150 | |
ca8f0290 DW |
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); | |
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); | |
162 | ||
163 | inline bool IsMLE(void) {return m_bIsMLE;} | |
164 | inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;} | |
0e320a79 | 165 | |
d90895ac | 166 | protected: |
ca8f0290 | 167 | // |
d90895ac DW |
168 | // call this to increase the size limit (will do nothing if the current |
169 | // limit is big enough) | |
ca8f0290 DW |
170 | // |
171 | void AdjustSpaceLimit(void); | |
172 | virtual wxSize DoGetBestSize(void) const; | |
f140b352 | 173 | virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg); |
0e320a79 | 174 | |
b9b1d6c8 DW |
175 | virtual WXDWORD OS2GetStyle( long lStyle |
176 | ,WXDWORD* dwExstyle | |
177 | ) const; | |
d90895ac | 178 | private: |
ca8f0290 | 179 | bool m_bIsMLE; |
d90895ac DW |
180 | DECLARE_EVENT_TABLE() |
181 | DECLARE_DYNAMIC_CLASS(wxTextCtrl) | |
ca8f0290 | 182 | }; // end of CLASS wxTextCtrl |
0e320a79 DW |
183 | |
184 | #endif | |
185 | // _WX_TEXTCTRL_H_ |