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