]>
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
)
34 inline wxTextCtrl(wxWindow
*parent
, wxWindowID id
,
35 const wxString
& value
= wxEmptyString
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
, long style
= 0,
38 const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
& name
= wxTextCtrlNameStr
)
41 Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
44 bool Create(wxWindow
*parent
, wxWindowID id
,
45 const wxString
& value
= wxEmptyString
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
, long style
= 0,
48 const wxValidator
& validator
= wxDefaultValidator
,
49 const wxString
& name
= wxTextCtrlNameStr
);
53 virtual wxString
GetValue() const ;
54 virtual void SetValue(const wxString
& value
);
56 virtual int GetLineLength(long lineNo
) const;
57 virtual wxString
GetLineText(long lineNo
) const;
58 virtual int GetNumberOfLines() const;
60 virtual bool IsModified() const;
61 virtual bool IsEditable() const;
63 // If the return values from and to are the same, there is no selection.
64 virtual void GetSelection(long* from
, long* to
) const;
72 virtual void Replace(long from
, long to
, const wxString
& value
);
73 virtual void Remove(long from
, long to
);
75 // load the controls contents from the file
76 virtual bool LoadFile(const wxString
& file
);
78 // clears the dirty flag
79 virtual void DiscardEdits();
81 // writing text inserts it at the current position, appending always
82 // inserts it at the end
83 virtual void WriteText(const wxString
& text
);
84 virtual void AppendText(const wxString
& text
);
86 // translate between the position (which is just an index in the text ctrl
87 // considering all its contents as a single strings) and (x, y) coordinates
88 // which represent column and line.
89 virtual long XYToPosition(long x
, long y
) const;
90 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
92 virtual void ShowPosition(long pos
);
94 // Clipboard operations
99 virtual bool CanCopy() const;
100 virtual bool CanCut() const;
101 virtual bool CanPaste() const;
107 virtual bool CanUndo() const;
108 virtual bool CanRedo() const;
111 virtual void SetInsertionPoint(long pos
);
112 virtual void SetInsertionPointEnd();
113 virtual long GetInsertionPoint() const;
114 virtual long GetLastPosition() const;
116 virtual void SetSelection(long from
, long to
);
117 virtual void SetEditable(bool editable
);
119 // Implementation from now on
120 // --------------------------
124 virtual void Command(wxCommandEvent
& event
);
126 virtual bool AcceptsFocus() const;
129 void OnDropFiles(wxDropFilesEvent
& event
);
130 void OnChar(wxKeyEvent
& event
); // Process 'enter' if required
132 void OnCut(wxCommandEvent
& event
);
133 void OnCopy(wxCommandEvent
& event
);
134 void OnPaste(wxCommandEvent
& event
);
135 void OnUndo(wxCommandEvent
& event
);
136 void OnRedo(wxCommandEvent
& event
);
138 void OnUpdateCut(wxUpdateUIEvent
& event
);
139 void OnUpdateCopy(wxUpdateUIEvent
& event
);
140 void OnUpdatePaste(wxUpdateUIEvent
& event
);
141 void OnUpdateUndo(wxUpdateUIEvent
& event
);
142 void OnUpdateRedo(wxUpdateUIEvent
& event
);
144 virtual bool MacCanFocus() const { return true ; }
146 virtual void MacSuperShown( bool show
) ;
147 virtual bool Show(bool show
= TRUE
) ;
150 virtual wxSize
DoGetBestSize() const;
153 // one of the following objects is used for representation, the other one is NULL
159 DECLARE_EVENT_TABLE()