fixed typo in wxString::swap() which was completely broken
[wxWidgets.git] / include / wx / os2 / textctrl.h
CommitLineData
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
15class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
16{
17public:
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);
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;
115 virtual long GetLastPosition(void) const;
d90895ac 116
ca8f0290
DW
117 virtual void SetSelection( long lFrom
118 ,long lTo
119 );
120 virtual void SetEditable(bool bEditable);
1d0edc0f 121 virtual void SetFocus(void);
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);
0e320a79 158
ca8f0290
DW
159 void OnUpdateCut(wxUpdateUIEvent& rEvent);
160 void OnUpdateCopy(wxUpdateUIEvent& rEvent);
161 void OnUpdatePaste(wxUpdateUIEvent& rEvent);
162 void OnUpdateUndo(wxUpdateUIEvent& rEvent);
163 void OnUpdateRedo(wxUpdateUIEvent& rEvent);
164
165 inline bool IsMLE(void) {return m_bIsMLE;}
166 inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;}
0e320a79 167
d90895ac 168protected:
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 180private:
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_