]>
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
,
27 const wxValidator
& validator
= wxDefaultValidator
,
28 const wxString
& name
= wxTextCtrlNameStr
)
30 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
33 bool Create(wxWindow
*parent
, wxWindowID id
,
34 const wxString
& value
= wxEmptyString
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
,
38 const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
& name
= wxTextCtrlNameStr
);
41 // implement base class pure virtuals
42 // ----------------------------------
44 virtual wxString
GetValue() const;
45 virtual void SetValue(const wxString
& value
);
47 virtual int GetLineLength(long lineNo
) const;
48 virtual wxString
GetLineText(long lineNo
) const;
49 virtual int GetNumberOfLines() const;
51 virtual bool IsModified() const;
52 virtual bool IsEditable() const;
54 // If the return values from and to are the same, there is no selection.
55 virtual void GetSelection(long* from
, long* to
) const;
62 virtual void Replace(long from
, long to
, const wxString
& value
);
63 virtual void Remove(long from
, long to
);
65 // load the controls contents from the file
66 virtual bool LoadFile(const wxString
& file
);
68 // clears the dirty flag
69 virtual void DiscardEdits();
71 // writing text inserts it at the current position, appending always
72 // inserts it at the end
73 virtual void WriteText(const wxString
& text
);
74 virtual void AppendText(const wxString
& text
);
76 // translate between the position (which is just an index in the text ctrl
77 // considering all its contents as a single strings) and (x, y) coordinates
78 // which represent column and line.
79 virtual long XYToPosition(long x
, long y
) const;
80 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
82 virtual void ShowPosition(long pos
);
84 // Clipboard operations
89 virtual bool CanCopy() const;
90 virtual bool CanCut() const;
91 virtual bool CanPaste() const;
97 virtual bool CanUndo() const;
98 virtual bool CanRedo() const;
101 virtual void SetInsertionPoint(long pos
);
102 virtual void SetInsertionPointEnd();
103 virtual long GetInsertionPoint() const;
104 virtual long GetLastPosition() const;
106 virtual void SetSelection(long from
, long to
);
107 virtual void SetEditable(bool editable
);
109 // Implementation from now on
110 // --------------------------
112 virtual void Command(wxCommandEvent
& event
);
113 virtual bool OS2Command(WXUINT param
, WXWORD id
);
115 virtual WXHBRUSH
OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
116 WXUINT message
, WXWPARAM wParam
,
119 virtual void AdoptAttributesFromHWND();
120 virtual void SetupColours();
122 virtual bool AcceptsFocus() const;
125 void OnDropFiles(wxDropFilesEvent
& event
);
126 void OnChar(wxKeyEvent
& event
); // Process 'enter' if required
128 void OnCut(wxCommandEvent
& event
);
129 void OnCopy(wxCommandEvent
& event
);
130 void OnPaste(wxCommandEvent
& event
);
131 void OnUndo(wxCommandEvent
& event
);
132 void OnRedo(wxCommandEvent
& event
);
134 void OnUpdateCut(wxUpdateUIEvent
& event
);
135 void OnUpdateCopy(wxUpdateUIEvent
& event
);
136 void OnUpdatePaste(wxUpdateUIEvent
& event
);
137 void OnUpdateUndo(wxUpdateUIEvent
& event
);
138 void OnUpdateRedo(wxUpdateUIEvent
& event
);
141 // call this to increase the size limit (will do nothing if the current
142 // limit is big enough)
143 void AdjustSpaceLimit();
145 virtual wxSize
DoGetBestSize();
148 DECLARE_EVENT_TABLE()
149 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)