1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: David Webster
7 // Copyright: (c) David Webster
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_TEXTCTRL_H_
12 #define _WX_TEXTCTRL_H_
14 typedef int (wxCALLBACK
*wxTreeCtrlCompare
)(long lItem1
, long lItem2
, long lSortData
);
16 class WXDLLIMPEXP_CORE wxTextCtrl
: public wxTextCtrlBase
20 wxTextCtrl( wxWindow
* pParent
22 ,const wxString
& rsValue
= wxEmptyString
23 ,const wxPoint
& rPos
= wxDefaultPosition
24 ,const wxSize
& rSize
= wxDefaultSize
26 ,const wxValidator
& rValidator
= wxDefaultValidator
27 ,const wxString
& rsName
= wxTextCtrlNameStr
30 Create(pParent
, vId
, rsValue
, rPos
, rSize
, lStyle
, rValidator
, rsName
);
32 virtual ~wxTextCtrl();
34 bool Create( wxWindow
* pParent
36 ,const wxString
& rsValue
= wxEmptyString
37 ,const wxPoint
& rPos
= wxDefaultPosition
38 ,const wxSize
& rSize
= wxDefaultSize
40 ,const wxValidator
& rValidator
= wxDefaultValidator
41 ,const wxString
& rsName
= wxTextCtrlNameStr
45 // Implement base class pure virtuals
46 // ----------------------------------
48 virtual wxString
GetValue(void) const;
50 virtual int GetLineLength(long nLineNo
) const;
51 virtual wxString
GetLineText(long nLineNo
) const;
52 virtual int GetNumberOfLines(void) const;
54 virtual bool IsModified(void) const;
55 virtual bool IsEditable(void) const;
57 virtual void GetSelection( long* pFrom
64 virtual void Clear(void);
65 virtual void Replace( long lFrom
67 ,const wxString
& rsValue
69 virtual void Remove( long lFrom
73 virtual bool DoLoadFile(const wxString
& rsFile
, int fileType
);
75 virtual void MarkDirty();
76 virtual void DiscardEdits(void);
78 virtual void WriteText(const wxString
& rsText
);
79 virtual void AppendText(const wxString
& rsText
);
80 virtual bool EmulateKeyPress(const wxKeyEvent
& rEvent
);
82 virtual bool SetStyle( long lStart
84 ,const wxTextAttr
& rStyle
86 virtual long XYToPosition( long lX
89 virtual bool PositionToXY( long lPos
94 virtual void ShowPosition(long lPos
);
96 virtual void Copy(void);
97 virtual void Cut(void);
98 virtual void Paste(void);
100 virtual bool CanCopy(void) const;
101 virtual bool CanCut(void) const;
102 virtual bool CanPaste(void) const;
104 virtual void Undo(void);
105 virtual void Redo(void);
107 virtual bool CanUndo(void) const;
108 virtual bool CanRedo(void) const;
110 virtual void SetInsertionPoint(long lPos
);
111 virtual void SetInsertionPointEnd(void);
112 virtual long GetInsertionPoint(void) const;
113 virtual wxTextPos
GetLastPosition(void) const;
115 virtual void SetSelection( long lFrom
118 virtual void SetEditable(bool bEditable
);
119 virtual void SetWindowStyleFlag(long lStyle
);
122 // Implementation from now on
123 // --------------------------
125 virtual void Command(wxCommandEvent
& rEvent
);
126 virtual bool OS2Command( WXUINT uParam
130 virtual WXHBRUSH
OnCtlColor( WXHDC hDC
138 virtual bool SetBackgroundColour(const wxColour
& colour
);
139 virtual bool SetForegroundColour(const wxColour
& colour
);
141 virtual void AdoptAttributesFromHWND(void);
142 virtual void SetupColours(void);
144 virtual bool AcceptsFocus(void) const;
147 void OnDropFiles(wxDropFilesEvent
& rEvent
);
148 void OnChar(wxKeyEvent
& rEvent
); // Process 'enter' if required
150 void OnCut(wxCommandEvent
& rEvent
);
151 void OnCopy(wxCommandEvent
& rEvent
);
152 void OnPaste(wxCommandEvent
& rEvent
);
153 void OnUndo(wxCommandEvent
& rEvent
);
154 void OnRedo(wxCommandEvent
& rEvent
);
155 void OnDelete(wxCommandEvent
& rEvent
);
156 void OnSelectAll(wxCommandEvent
& rEvent
);
158 void OnUpdateCut(wxUpdateUIEvent
& rEvent
);
159 void OnUpdateCopy(wxUpdateUIEvent
& rEvent
);
160 void OnUpdatePaste(wxUpdateUIEvent
& rEvent
);
161 void OnUpdateUndo(wxUpdateUIEvent
& rEvent
);
162 void OnUpdateRedo(wxUpdateUIEvent
& rEvent
);
163 void OnUpdateDelete(wxUpdateUIEvent
& rEvent
);
164 void OnUpdateSelectAll(wxUpdateUIEvent
& rEvent
);
166 inline bool IsMLE(void) {return m_bIsMLE
;}
167 inline void SetMLE(bool bIsMLE
) {m_bIsMLE
= bIsMLE
;}
171 // call this to increase the size limit (will do nothing if the current
172 // limit is big enough)
174 void AdjustSpaceLimit(void);
175 virtual wxSize
DoGetBestSize(void) const;
176 virtual bool OS2ShouldPreProcessMessage(WXMSG
* pMsg
);
178 virtual WXDWORD
OS2GetStyle( long lStyle
182 virtual void DoSetValue(const wxString
&value
, int flags
= 0);
187 // implement wxTextEntry pure virtual: it implements all the operations for
188 // the simple EDIT controls
189 virtual WXHWND
GetEditHWND() const { return m_hWnd
; }
192 DECLARE_EVENT_TABLE()
193 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
194 }; // end of CLASS wxTextCtrl