]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTextCtrl class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TEXTCTRL_H_
13 #define _WX_TEXTCTRL_H_
16 #pragma interface "textctrl.h"
19 #include "wx/control.h"
21 WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr
;
22 WXDLLEXPORT_DATA(extern const char*) wxEmptyString
;
24 // Single-line text item
25 class WXDLLEXPORT wxTextCtrl
: public wxTextCtrlBase
27 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
33 inline wxTextCtrl(wxWindow
*parent
, wxWindowID id
,
34 const wxString
& value
= wxEmptyString
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
, long style
= 0,
37 const wxValidator
& validator
= wxDefaultValidator
,
38 const wxString
& name
= wxTextCtrlNameStr
)
40 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
43 bool Create(wxWindow
*parent
, wxWindowID id
,
44 const wxString
& value
= wxEmptyString
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& size
= wxDefaultSize
, long style
= 0,
47 const wxValidator
& validator
= wxDefaultValidator
,
48 const wxString
& name
= wxTextCtrlNameStr
);
52 virtual wxString
GetValue() const ;
53 virtual void SetValue(const wxString
& value
);
55 virtual int GetLineLength(long lineNo
) const;
56 virtual wxString
GetLineText(long lineNo
) const;
57 virtual int GetNumberOfLines() const;
59 virtual bool IsModified() const;
60 virtual bool IsEditable() const;
62 // If the return values from and to are the same, there is no selection.
63 virtual void GetSelection(long* from
, long* to
) const;
71 virtual void Replace(long from
, long to
, const wxString
& value
);
72 virtual void Remove(long from
, long to
);
74 // load the controls contents from the file
75 virtual bool LoadFile(const wxString
& file
);
77 // clears the dirty flag
78 virtual void DiscardEdits();
80 // writing text inserts it at the current position, appending always
81 // inserts it at the end
82 virtual void WriteText(const wxString
& text
);
83 virtual void AppendText(const wxString
& text
);
85 // translate between the position (which is just an index in the text ctrl
86 // considering all its contents as a single strings) and (x, y) coordinates
87 // which represent column and line.
88 virtual long XYToPosition(long x
, long y
) const;
89 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
91 virtual void ShowPosition(long pos
);
93 // Clipboard operations
98 virtual bool CanCopy() const;
99 virtual bool CanCut() const;
100 virtual bool CanPaste() const;
106 virtual bool CanUndo() const;
107 virtual bool CanRedo() const;
110 virtual void SetInsertionPoint(long pos
);
111 virtual void SetInsertionPointEnd();
112 virtual long GetInsertionPoint() const;
113 virtual long GetLastPosition() const;
115 virtual void SetSelection(long from
, long to
);
116 virtual void SetEditable(bool editable
);
118 // Implementation from now on
119 // --------------------------
123 virtual void Command(wxCommandEvent
& event
);
125 virtual bool AcceptsFocus() const;
128 void OnDropFiles(wxDropFilesEvent
& event
);
129 void OnChar(wxKeyEvent
& event
); // Process 'enter' if required
131 void OnCut(wxCommandEvent
& event
);
132 void OnCopy(wxCommandEvent
& event
);
133 void OnPaste(wxCommandEvent
& event
);
134 void OnUndo(wxCommandEvent
& event
);
135 void OnRedo(wxCommandEvent
& event
);
137 void OnUpdateCut(wxUpdateUIEvent
& event
);
138 void OnUpdateCopy(wxUpdateUIEvent
& event
);
139 void OnUpdatePaste(wxUpdateUIEvent
& event
);
140 void OnUpdateUndo(wxUpdateUIEvent
& event
);
141 void OnUpdateRedo(wxUpdateUIEvent
& event
);
143 virtual bool MacCanFocus() const { return true ; }
146 virtual wxSize
DoGetBestSize() const;
148 DECLARE_EVENT_TABLE()