]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/textctrl.h
5205ed9f6475b74a71cd50642c2d7ab23263cec3
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_COCOA_TEXTCTRL_H__
13 #define __WX_COCOA_TEXTCTRL_H__
15 #include "wx/cocoa/NSTextField.h"
17 // ========================================================================
19 // ========================================================================
20 class WXDLLEXPORT wxTextCtrl
: public wxTextCtrlBase
, protected wxCocoaNSTextField
22 DECLARE_DYNAMIC_CLASS(wxTextCtrl
)
24 WX_DECLARE_COCOA_OWNER(NSTextField
,NSControl
,NSView
)
25 // ------------------------------------------------------------------------
27 // ------------------------------------------------------------------------
30 wxTextCtrl(wxWindow
*parent
, wxWindowID winid
,
31 const wxString
& value
= wxEmptyString
,
32 const wxPoint
& pos
= wxDefaultPosition
,
33 const wxSize
& size
= wxDefaultSize
, long style
= 0,
34 const wxValidator
& validator
= wxDefaultValidator
,
35 const wxString
& name
= wxTextCtrlNameStr
)
37 Create(parent
, winid
, value
, pos
, size
, style
, validator
, name
);
40 bool Create(wxWindow
*parent
, wxWindowID winid
,
41 const wxString
& value
= wxEmptyString
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
, long style
= 0,
44 const wxValidator
& validator
= wxDefaultValidator
,
45 const wxString
& name
= wxTextCtrlNameStr
);
46 virtual ~wxTextCtrl();
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
52 virtual void Cocoa_didChangeText(void);
53 // ------------------------------------------------------------------------
55 // ------------------------------------------------------------------------
57 virtual wxString
GetValue() const;
58 virtual void SetValue(const wxString
& value
);
60 virtual int GetLineLength(long lineNo
) const;
61 virtual wxString
GetLineText(long lineNo
) const;
62 virtual int GetNumberOfLines() const;
64 virtual bool IsModified() const;
65 virtual bool IsEditable() const;
67 // If the return values from and to are the same, there is no selection.
68 virtual void GetSelection(long* from
, long* to
) const;
75 virtual void Replace(long from
, long to
, const wxString
& value
);
76 virtual void Remove(long from
, long to
);
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
103 virtual bool CanUndo() const;
104 virtual bool CanRedo() const;
107 virtual void SetInsertionPoint(long pos
);
108 virtual void SetInsertionPointEnd();
109 virtual long GetInsertionPoint() const;
110 virtual long GetLastPosition() const;
112 virtual void SetSelection(long from
, long to
);
113 // virtual void SelectAll();
114 virtual void SetEditable(bool editable
);
118 #endif // __WX_COCOA_TEXTCTRL_H__