]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/textctrl.h
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
*parent
, wxWindowID id
,
23 const wxString
& value
= wxEmptyString
,
24 const wxPoint
& pos
= wxDefaultPosition
,
25 const wxSize
& size
= wxDefaultSize
,
28 # if defined(__VISAGECPP__)
29 const wxValidator
* validator
= wxDefaultValidator
,
31 const wxValidator
& validator
= wxDefaultValidator
,
34 const wxString
& name
= wxTextCtrlNameStr
)
36 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
39 bool Create(wxWindow
*parent
, wxWindowID id
,
40 const wxString
& value
= wxEmptyString
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
,
45 # if defined(__VISAGECPP__)
46 const wxValidator
* validator
= wxDefaultValidator
,
48 const wxValidator
& validator
= wxDefaultValidator
,
51 const wxString
& name
= wxTextCtrlNameStr
);
53 // implement base class pure virtuals
54 // ----------------------------------
56 virtual wxString
GetValue() const;
57 virtual void SetValue(const wxString
& value
);
59 virtual int GetLineLength(long lineNo
) const;
60 virtual wxString
GetLineText(long lineNo
) const;
61 virtual int GetNumberOfLines() const;
63 virtual bool IsModified() const;
64 virtual bool IsEditable() const;
66 // If the return values from and to are the same, there is no selection.
67 virtual void GetSelection(long* from
, long* to
) const;
74 virtual void Replace(long from
, long to
, const wxString
& value
);
75 virtual void Remove(long from
, long to
);
77 // load the controls contents from the file
78 virtual bool LoadFile(const wxString
& file
);
80 // clears the dirty flag
81 virtual void DiscardEdits();
83 // writing text inserts it at the current position, appending always
84 // inserts it at the end
85 virtual void WriteText(const wxString
& text
);
86 virtual void AppendText(const wxString
& text
);
88 // translate between the position (which is just an index in the text ctrl
89 // considering all its contents as a single strings) and (x, y) coordinates
90 // which represent column and line.
91 virtual long XYToPosition(long x
, long y
) const;
92 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
94 virtual void ShowPosition(long pos
);
96 // Clipboard operations
101 virtual bool CanCopy() const;
102 virtual bool CanCut() const;
103 virtual bool CanPaste() const;
109 virtual bool CanUndo() const;
110 virtual bool CanRedo() const;
113 virtual void SetInsertionPoint(long pos
);
114 virtual void SetInsertionPointEnd();
115 virtual long GetInsertionPoint() const;
116 virtual long GetLastPosition() const;
118 virtual void SetSelection(long from
, long to
);
119 virtual void SetEditable(bool editable
);
121 // Implementation from now on
122 // --------------------------
124 virtual void Command(wxCommandEvent
& event
);
125 virtual bool OS2Command(WXUINT param
, WXWORD id
);
127 virtual WXHBRUSH
OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
128 WXUINT message
, WXWPARAM wParam
,
131 virtual void AdoptAttributesFromHWND();
132 virtual void SetupColours();
134 virtual bool AcceptsFocus() const;
137 void OnDropFiles(wxDropFilesEvent
& event
);
138 void OnChar(wxKeyEvent
& event
); // Process 'enter' if required
140 void OnCut(wxCommandEvent
& event
);
141 void OnCopy(wxCommandEvent
& event
);
142 void OnPaste(wxCommandEvent
& event
);
143 void OnUndo(wxCommandEvent
& event
);
144 void OnRedo(wxCommandEvent
& event
);
146 void OnUpdateCut(wxUpdateUIEvent
& event
);
147 void OnUpdateCopy(wxUpdateUIEvent
& event
);
148 void OnUpdatePaste(wxUpdateUIEvent
& event
);
149 void OnUpdateUndo(wxUpdateUIEvent
& event
);
150 void OnUpdateRedo(wxUpdateUIEvent
& event
);
153 // call this to increase the size limit (will do nothing if the current
154 // limit is big enough)
155 void AdjustSpaceLimit();
157 virtual wxSize
DoGetBestSize();
160 DECLARE_EVENT_TABLE()
161 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)