]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/textctrl.h
175edc8ebedcee3c97bc578471f9045b8f946cea
1 /////////////////////////////////////////////////////////////////////////////
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 class WXDLLEXPORT wxTextCtrl
: public wxTextCtrlBase
22 wxTextCtrl( wxWindow
* pParent
24 ,const wxString
& rsValue
= wxEmptyString
25 ,const wxPoint
& rPos
= wxDefaultPosition
26 ,const wxSize
& rSize
= wxDefaultSize
29 ,const wxValidator
& rValidator
= wxDefaultValidator
31 ,const wxString
& rsName
= wxTextCtrlNameStr
34 Create(pParent
, vId
, rsValue
, rPos
, rSize
, lStyle
, rValidator
, rsName
);
37 bool Create( wxWindow
* pParent
39 ,const wxString
& rsValue
= wxEmptyString
40 ,const wxPoint
& rPos
= wxDefaultPosition
41 ,const wxSize
& rSize
= wxDefaultSize
44 ,const wxValidator
& rValidator
= wxDefaultValidator
46 ,const wxString
& rsName
= wxTextCtrlNameStr
49 // implement base class pure virtuals
50 // ----------------------------------
52 virtual wxString
GetValue(void) const;
53 virtual void SetValue(const wxString
& rsValue
);
55 virtual int GetLineLength(long nLineNo
) const;
56 virtual wxString
GetLineText(long nLineNo
) const;
57 virtual int GetNumberOfLines(void) const;
59 virtual bool IsModified(void) const;
60 virtual bool IsEditable(void) const;
62 // If the return values from and to are the same, there is no selection.
63 virtual void GetSelection( long* pFrom
71 virtual void Clear(void);
72 virtual void Replace( long lFrom
74 ,const wxString
& rsValue
76 virtual void Remove( long lFrom
80 // load the controls contents from the file
81 virtual bool LoadFile(const wxString
& rsFile
);
83 // clears the dirty flag
84 virtual void DiscardEdits(void);
86 // writing text inserts it at the current position, appending always
87 // inserts it at the end
88 virtual void WriteText(const wxString
& rsText
);
89 virtual void AppendText(const wxString
& rsText
);
91 // translate between the position (which is just an index in the text ctrl
92 // considering all its contents as a single strings) and (x, y) coordinates
93 // which represent column and line.
94 virtual long XYToPosition( long lX
97 virtual bool PositionToXY( long lPos
102 virtual void ShowPosition(long lPos
);
104 // Clipboard operations
105 virtual void Copy(void);
106 virtual void Cut(void);
107 virtual void Paste(void);
109 virtual bool CanCopy(void) const;
110 virtual bool CanCut(void) const;
111 virtual bool CanPaste(void) const;
114 virtual void Undo(void);
115 virtual void Redo(void);
117 virtual bool CanUndo(void) const;
118 virtual bool CanRedo(void) const;
121 virtual void SetInsertionPoint(long lPos
);
122 virtual void SetInsertionPointEnd(void);
123 virtual long GetInsertionPoint(void) const;
124 virtual long GetLastPosition(void) const;
126 virtual void SetSelection( long lFrom
129 virtual void SetEditable(bool bEditable
);
132 // Implementation from now on
133 // --------------------------
135 virtual void Command(wxCommandEvent
& rEvent
);
136 virtual bool OS2Command( WXUINT uParam
140 virtual WXHBRUSH
OnCtlColor( WXHDC hDC
148 virtual bool SetBackgroundColour(const wxColour
& colour
);
149 virtual bool SetForegroundColour(const wxColour
& colour
);
151 virtual void AdoptAttributesFromHWND(void);
152 virtual void SetupColours(void);
154 virtual bool AcceptsFocus(void) const;
157 void OnDropFiles(wxDropFilesEvent
& rEvent
);
158 void OnChar(wxKeyEvent
& rEvent
); // Process 'enter' if required
160 void OnCut(wxCommandEvent
& rEvent
);
161 void OnCopy(wxCommandEvent
& rEvent
);
162 void OnPaste(wxCommandEvent
& rEvent
);
163 void OnUndo(wxCommandEvent
& rEvent
);
164 void OnRedo(wxCommandEvent
& rEvent
);
166 void OnUpdateCut(wxUpdateUIEvent
& rEvent
);
167 void OnUpdateCopy(wxUpdateUIEvent
& rEvent
);
168 void OnUpdatePaste(wxUpdateUIEvent
& rEvent
);
169 void OnUpdateUndo(wxUpdateUIEvent
& rEvent
);
170 void OnUpdateRedo(wxUpdateUIEvent
& rEvent
);
172 inline bool IsMLE(void) {return m_bIsMLE
;}
173 inline void SetMLE(bool bIsMLE
) {m_bIsMLE
= bIsMLE
;}
177 // call this to increase the size limit (will do nothing if the current
178 // limit is big enough)
180 void AdjustSpaceLimit(void);
181 virtual wxSize
DoGetBestSize(void) const;
185 DECLARE_EVENT_TABLE()
186 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
187 }; // end of CLASS wxTextCtrl