1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TEXTCTRL_H_
13 #define _WX_TEXTCTRL_H_
15 typedef int (wxCALLBACK
*wxTreeCtrlCompare
)(long lItem1
, long lItem2
, long lSortData
);
17 class WXDLLIMPEXP_CORE wxTextCtrl
: public wxTextCtrlBase
21 wxTextCtrl( wxWindow
* pParent
23 ,const wxString
& rsValue
= wxEmptyString
24 ,const wxPoint
& rPos
= wxDefaultPosition
25 ,const wxSize
& rSize
= wxDefaultSize
27 ,const wxValidator
& rValidator
= wxDefaultValidator
28 ,const wxString
& rsName
= wxTextCtrlNameStr
31 Create(pParent
, vId
, rsValue
, rPos
, rSize
, lStyle
, rValidator
, rsName
);
33 virtual ~wxTextCtrl();
35 bool Create( wxWindow
* pParent
37 ,const wxString
& rsValue
= wxEmptyString
38 ,const wxPoint
& rPos
= wxDefaultPosition
39 ,const wxSize
& rSize
= wxDefaultSize
41 ,const wxValidator
& rValidator
= wxDefaultValidator
42 ,const wxString
& rsName
= wxTextCtrlNameStr
46 // Implement base class pure virtuals
47 // ----------------------------------
49 virtual wxString
GetValue(void) const;
51 virtual int GetLineLength(long nLineNo
) const;
52 virtual wxString
GetLineText(long nLineNo
) const;
53 virtual int GetNumberOfLines(void) const;
55 virtual bool IsModified(void) const;
56 virtual bool IsEditable(void) const;
58 virtual void GetSelection( long* pFrom
65 virtual void Clear(void);
66 virtual void Replace( long lFrom
68 ,const wxString
& rsValue
70 virtual void Remove( long lFrom
74 virtual bool DoLoadFile(const wxString
& rsFile
, int fileType
);
76 virtual void MarkDirty();
77 virtual void DiscardEdits(void);
79 virtual void WriteText(const wxString
& rsText
);
80 virtual void AppendText(const wxString
& rsText
);
81 virtual bool EmulateKeyPress(const wxKeyEvent
& rEvent
);
83 virtual bool SetStyle( long lStart
85 ,const wxTextAttr
& rStyle
87 virtual long XYToPosition( long lX
90 virtual bool PositionToXY( long lPos
95 virtual void ShowPosition(long lPos
);
97 virtual void Copy(void);
98 virtual void Cut(void);
99 virtual void Paste(void);
101 virtual bool CanCopy(void) const;
102 virtual bool CanCut(void) const;
103 virtual bool CanPaste(void) const;
105 virtual void Undo(void);
106 virtual void Redo(void);
108 virtual bool CanUndo(void) const;
109 virtual bool CanRedo(void) const;
111 virtual void SetInsertionPoint(long lPos
);
112 virtual void SetInsertionPointEnd(void);
113 virtual long GetInsertionPoint(void) const;
114 virtual wxTextPos
GetLastPosition(void) const;
116 virtual void SetSelection( long lFrom
119 virtual void SetEditable(bool bEditable
);
120 virtual void SetWindowStyleFlag(long lStyle
);
123 // Implementation from now on
124 // --------------------------
126 virtual void Command(wxCommandEvent
& rEvent
);
127 virtual bool OS2Command( WXUINT uParam
131 virtual WXHBRUSH
OnCtlColor( WXHDC hDC
139 virtual bool SetBackgroundColour(const wxColour
& colour
);
140 virtual bool SetForegroundColour(const wxColour
& colour
);
142 virtual void AdoptAttributesFromHWND(void);
143 virtual void SetupColours(void);
145 virtual bool AcceptsFocus(void) const;
148 void OnDropFiles(wxDropFilesEvent
& rEvent
);
149 void OnChar(wxKeyEvent
& rEvent
); // Process 'enter' if required
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
);
156 void OnDelete(wxCommandEvent
& rEvent
);
157 void OnSelectAll(wxCommandEvent
& rEvent
);
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 void OnUpdateDelete(wxUpdateUIEvent
& rEvent
);
165 void OnUpdateSelectAll(wxUpdateUIEvent
& rEvent
);
167 inline bool IsMLE(void) {return m_bIsMLE
;}
168 inline void SetMLE(bool bIsMLE
) {m_bIsMLE
= bIsMLE
;}
172 // call this to increase the size limit (will do nothing if the current
173 // limit is big enough)
175 void AdjustSpaceLimit(void);
176 virtual wxSize
DoGetBestSize(void) const;
177 virtual bool OS2ShouldPreProcessMessage(WXMSG
* pMsg
);
179 virtual WXDWORD
OS2GetStyle( long lStyle
183 virtual void DoSetValue(const wxString
&value
, int flags
= 0);
188 // implement wxTextEntry pure virtual: it implements all the operations for
189 // the simple EDIT controls
190 virtual WXHWND
GetEditHWND() const { return m_hWnd
; }
193 DECLARE_EVENT_TABLE()
194 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
195 }; // end of CLASS wxTextCtrl