]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/textctrl.h
VC compilation fix after last commit
[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 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
d90895ac
DW
17class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
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;
f6519b40
VZ
50 virtual void SetValue(const wxString& value) { DoSetValue(value, SetValue_SendEvent); }
51
52 virtual void ChangeValue(const wxString &value) { DoSetValue(value); }
d90895ac 53
ca8f0290
DW
54 virtual int GetLineLength(long nLineNo) const;
55 virtual wxString GetLineText(long nLineNo) const;
56 virtual int GetNumberOfLines(void) const;
d90895ac 57
ca8f0290
DW
58 virtual bool IsModified(void) const;
59 virtual bool IsEditable(void) const;
d90895ac 60
ca8f0290
DW
61 virtual void GetSelection( long* pFrom
62 ,long* pTo
63 ) const;
1ec46a5b
DW
64 //
65 // Operations
d90895ac 66 // ----------
1ec46a5b 67 //
ca8f0290
DW
68 virtual void Clear(void);
69 virtual void Replace( long lFrom
70 ,long lTo
71 ,const wxString& rsValue
72 );
73 virtual void Remove( long lFrom
74 ,long lTo
75 );
d90895ac 76
3306aec1 77 virtual bool DoLoadFile(const wxString& rsFile, int fileType);
d90895ac 78
3a9fa0d6 79 virtual void MarkDirty();
ca8f0290 80 virtual void DiscardEdits(void);
d90895ac 81
ca8f0290
DW
82 virtual void WriteText(const wxString& rsText);
83 virtual void AppendText(const wxString& rsText);
a086de98 84 virtual bool EmulateKeyPress(const wxKeyEvent& rEvent);
d90895ac 85
1ec46a5b
DW
86 virtual bool SetStyle( long lStart
87 ,long lEnd
88 ,const wxTextAttr& rStyle
89 );
ca8f0290
DW
90 virtual long XYToPosition( long lX
91 ,long lY
92 ) const;
93 virtual bool PositionToXY( long lPos
94 ,long* plX
95 ,long* plY
96 ) const;
d90895ac 97
ca8f0290 98 virtual void ShowPosition(long lPos);
d90895ac 99
ca8f0290
DW
100 virtual void Copy(void);
101 virtual void Cut(void);
102 virtual void Paste(void);
d90895ac 103
ca8f0290
DW
104 virtual bool CanCopy(void) const;
105 virtual bool CanCut(void) const;
106 virtual bool CanPaste(void) const;
d90895ac 107
ca8f0290
DW
108 virtual void Undo(void);
109 virtual void Redo(void);
d90895ac 110
ca8f0290
DW
111 virtual bool CanUndo(void) const;
112 virtual bool CanRedo(void) const;
d90895ac 113
ca8f0290
DW
114 virtual void SetInsertionPoint(long lPos);
115 virtual void SetInsertionPointEnd(void);
116 virtual long GetInsertionPoint(void) const;
7d8268a1 117 virtual wxTextPos GetLastPosition(void) const;
d90895ac 118
ca8f0290
DW
119 virtual void SetSelection( long lFrom
120 ,long lTo
121 );
122 virtual void SetEditable(bool bEditable);
b9b1d6c8 123 virtual void SetWindowStyleFlag(long lStyle);
d90895ac 124
ca8f0290 125 //
d90895ac
DW
126 // Implementation from now on
127 // --------------------------
ca8f0290
DW
128 //
129 virtual void Command(wxCommandEvent& rEvent);
130 virtual bool OS2Command( WXUINT uParam
131 ,WXWORD wId
132 );
d90895ac 133
ca8f0290
DW
134 virtual WXHBRUSH OnCtlColor( WXHDC hDC
135 ,WXHWND pWnd
136 ,WXUINT nCtlColor
137 ,WXUINT message
138 ,WXWPARAM wParam
139 ,WXLPARAM lParam
140 );
d90895ac 141
ca8f0290
DW
142 virtual bool SetBackgroundColour(const wxColour& colour);
143 virtual bool SetForegroundColour(const wxColour& colour);
d90895ac 144
ca8f0290
DW
145 virtual void AdoptAttributesFromHWND(void);
146 virtual void SetupColours(void);
d90895ac 147
ca8f0290 148 virtual bool AcceptsFocus(void) const;
d90895ac
DW
149
150 // callbacks
ca8f0290
DW
151 void OnDropFiles(wxDropFilesEvent& rEvent);
152 void OnChar(wxKeyEvent& rEvent); // Process 'enter' if required
0e320a79 153
ca8f0290
DW
154 void OnCut(wxCommandEvent& rEvent);
155 void OnCopy(wxCommandEvent& rEvent);
156 void OnPaste(wxCommandEvent& rEvent);
157 void OnUndo(wxCommandEvent& rEvent);
158 void OnRedo(wxCommandEvent& rEvent);
2b5f62a0
VZ
159 void OnDelete(wxCommandEvent& rEvent);
160 void OnSelectAll(wxCommandEvent& rEvent);
0e320a79 161
ca8f0290
DW
162 void OnUpdateCut(wxUpdateUIEvent& rEvent);
163 void OnUpdateCopy(wxUpdateUIEvent& rEvent);
164 void OnUpdatePaste(wxUpdateUIEvent& rEvent);
165 void OnUpdateUndo(wxUpdateUIEvent& rEvent);
166 void OnUpdateRedo(wxUpdateUIEvent& rEvent);
2b5f62a0
VZ
167 void OnUpdateDelete(wxUpdateUIEvent& rEvent);
168 void OnUpdateSelectAll(wxUpdateUIEvent& rEvent);
ca8f0290
DW
169
170 inline bool IsMLE(void) {return m_bIsMLE;}
171 inline void SetMLE(bool bIsMLE) {m_bIsMLE = bIsMLE;}
0e320a79 172
d90895ac 173protected:
ca8f0290 174 //
d90895ac
DW
175 // call this to increase the size limit (will do nothing if the current
176 // limit is big enough)
ca8f0290
DW
177 //
178 void AdjustSpaceLimit(void);
179 virtual wxSize DoGetBestSize(void) const;
f140b352 180 virtual bool OS2ShouldPreProcessMessage(WXMSG* pMsg);
0e320a79 181
b9b1d6c8
DW
182 virtual WXDWORD OS2GetStyle( long lStyle
183 ,WXDWORD* dwExstyle
184 ) const;
f6519b40
VZ
185
186 void DoSetValue(const wxString &value, int flags = 0);
187
188 bool m_bSkipUpdate;
189
d90895ac 190private:
ca8f0290 191 bool m_bIsMLE;
d90895ac
DW
192 DECLARE_EVENT_TABLE()
193 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
ca8f0290 194}; // end of CLASS wxTextCtrl
0e320a79
DW
195
196#endif
197 // _WX_TEXTCTRL_H_