]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/textctrl.h
added wxTextCtrl::ChangeValue() which is the same as SetValue() but doesn't send...
[wxWidgets.git] / include / wx / cocoa / textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2003/03/16
7 // RCS-ID: $Id:
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_COCOA_TEXTCTRL_H__
13 #define __WX_COCOA_TEXTCTRL_H__
14
15 #include "wx/cocoa/NSTextField.h"
16
17 // ========================================================================
18 // wxTextCtrl
19 // ========================================================================
20 class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase, protected wxCocoaNSTextField
21 {
22 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
23 DECLARE_EVENT_TABLE()
24 WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView)
25 // ------------------------------------------------------------------------
26 // initialization
27 // ------------------------------------------------------------------------
28 public:
29 wxTextCtrl() {}
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)
36 {
37 Create(parent, winid, value, pos, size, style, validator, name);
38 }
39
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();
47
48 // ------------------------------------------------------------------------
49 // Cocoa specifics
50 // ------------------------------------------------------------------------
51 protected:
52 virtual void Cocoa_didChangeText(void);
53 // ------------------------------------------------------------------------
54 // Implementation
55 // ------------------------------------------------------------------------
56 public:
57 virtual wxString GetValue() const;
58 virtual void SetValue(const wxString& value);
59
60 virtual void ChangeValue(const wxString &value);
61
62 virtual int GetLineLength(long lineNo) const;
63 virtual wxString GetLineText(long lineNo) const;
64 virtual int GetNumberOfLines() const;
65
66 virtual bool IsModified() const;
67 virtual bool IsEditable() const;
68
69 // If the return values from and to are the same, there is no selection.
70 virtual void GetSelection(long* from, long* to) const;
71
72 // operations
73 // ----------
74
75 // editing
76 virtual void Clear();
77 virtual void Replace(long from, long to, const wxString& value);
78 virtual void Remove(long from, long to);
79
80 // clears the dirty flag
81 virtual void MarkDirty();
82 virtual void DiscardEdits();
83
84 // writing text inserts it at the current position, appending always
85 // inserts it at the end
86 virtual void WriteText(const wxString& text);
87 virtual void AppendText(const wxString& text);
88
89 // translate between the position (which is just an index in the text ctrl
90 // considering all its contents as a single strings) and (x, y) coordinates
91 // which represent column and line.
92 virtual long XYToPosition(long x, long y) const;
93 virtual bool PositionToXY(long pos, long *x, long *y) const;
94
95 virtual void ShowPosition(long pos);
96
97 // Clipboard operations
98 virtual void Copy();
99 virtual void Cut();
100 virtual void Paste();
101
102 // Undo/redo
103 virtual void Undo();
104 virtual void Redo();
105
106 virtual bool CanUndo() const;
107 virtual bool CanRedo() const;
108
109 // Insertion point
110 virtual void SetInsertionPoint(long pos);
111 virtual void SetInsertionPointEnd();
112 virtual long GetInsertionPoint() const;
113 virtual wxTextPos GetLastPosition() const;
114
115 virtual void SetSelection(long from, long to);
116 // virtual void SelectAll();
117 virtual void SetEditable(bool editable);
118
119 protected:
120 virtual wxSize DoGetBestSize() const;
121 };
122
123 #endif // __WX_COCOA_TEXTCTRL_H__