]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/textctrl.h
Use wxWindowMSW instead of wxWindow to fix wxUniv/MSW compilation.
[wxWidgets.git] / include / wx / os2 / textctrl.h
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/os2/textctrl.h
0e320a79 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
15typedef int (wxCALLBACK *wxTreeCtrlCompare)(long lItem1, long lItem2, long lSortData);
16
53a2db12 17class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase
d90895ac
DW
18{
19public:
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 49 virtual wxString GetValue(void) const;
d90895ac 50
ca8f0290
DW
51 virtual int GetLineLength(long nLineNo) const;
52 virtual wxString GetLineText(long nLineNo) const;
53 virtual int GetNumberOfLines(void) const;
d90895ac 54
ca8f0290
DW
55 virtual bool IsModified(void) const;
56 virtual bool IsEditable(void) const;
d90895ac 57
ca8f0290
DW
58 virtual void GetSelection( long* pFrom
59 ,long* pTo
60 ) const;
1ec46a5b
DW
61 //
62 // Operations
d90895ac 63 // ----------
1ec46a5b 64 //
ca8f0290
DW
65 virtual void Clear(void);
66 virtual void Replace( long lFrom
67 ,long lTo
68 ,const wxString& rsValue
69 );
70 virtual void Remove( long lFrom
71 ,long lTo
72 );
d90895ac 73
3306aec1 74 virtual bool DoLoadFile(const wxString& rsFile, int fileType);
d90895ac 75
3a9fa0d6 76 virtual void MarkDirty();
ca8f0290 77 virtual void DiscardEdits(void);
d90895ac 78
ca8f0290
DW
79 virtual void WriteText(const wxString& rsText);
80 virtual void AppendText(const wxString& rsText);
a086de98 81 virtual bool EmulateKeyPress(const wxKeyEvent& rEvent);
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;
7d8268a1 114 virtual wxTextPos 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);
2b5f62a0
VZ
156 void OnDelete(wxCommandEvent& rEvent);
157 void OnSelectAll(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);
2b5f62a0
VZ
164 void OnUpdateDelete(wxUpdateUIEvent& rEvent);
165 void OnUpdateSelectAll(wxUpdateUIEvent& rEvent);
ca8f0290
DW
166
167 inline bool IsMLE(void) {return m_bIsMLE;}
168 inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;}
0e320a79 169
d90895ac 170protected:
ca8f0290 171 //
d90895ac
DW
172 // call this to increase the size limit (will do nothing if the current
173 // limit is big enough)
ca8f0290
DW
174 //
175 void AdjustSpaceLimit(void);
176 virtual wxSize DoGetBestSize(void) const;
f140b352 177 virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg);
0e320a79 178
b9b1d6c8
DW
179 virtual WXDWORD OS2GetStyle( long lStyle
180 ,WXDWORD* dwExstyle
181 ) const;
f6519b40 182
ee2ec18e 183 virtual void DoSetValue(const wxString &value, int flags = 0);
f6519b40
VZ
184
185 bool m_bSkipUpdate;
186
d90895ac 187private:
72cb72bf
SN
188 // implement wxTextEntry pure virtual: it implements all the operations for
189 // the simple EDIT controls
190 virtual WXHWND GetEditHWND() const { return m_hWnd; }
191
ca8f0290 192 bool m_bIsMLE;
d90895ac
DW
193 DECLARE_EVENT_TABLE()
194 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
ca8f0290 195}; // end of CLASS wxTextCtrl
0e320a79
DW
196
197#endif
198 // _WX_TEXTCTRL_H_