]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/textctrl.h
not needed anymore
[wxWidgets.git] / include / wx / mac / textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textctrl.h
3 // Purpose: wxTextCtrl class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_TEXTCTRL_H_
13 #define _WX_TEXTCTRL_H_
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "textctrl.h"
17 #endif
18
19 #include "wx/control.h"
20
21 WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr;
22 WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
23
24 // Single-line text item
25 class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase
26 {
27 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
28
29 public:
30 // creation
31 // --------
32 wxTextCtrl();
33 ~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)
40 {
41 Create(parent, id, value, pos, size, style, validator, name);
42 }
43
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);
50
51 // accessors
52 // ---------
53 virtual wxString GetValue() const ;
54 virtual void SetValue(const wxString& value);
55
56 virtual int GetLineLength(long lineNo) const;
57 virtual wxString GetLineText(long lineNo) const;
58 virtual int GetNumberOfLines() const;
59
60 virtual bool IsModified() const;
61 virtual bool IsEditable() const;
62
63 // If the return values from and to are the same, there is no selection.
64 virtual void GetSelection(long* from, long* to) const;
65
66 // operations
67 // ----------
68
69 // editing
70
71 virtual void Clear();
72 virtual void Replace(long from, long to, const wxString& value);
73 virtual void Remove(long from, long to);
74
75 // load the controls contents from the file
76 virtual bool LoadFile(const wxString& file);
77
78 // clears the dirty flag
79 virtual void DiscardEdits();
80
81 // set the max number of characters which may be entered in a single line
82 // text control
83 virtual void SetMaxLength(unsigned long len) ;
84
85 // text control under some platforms supports the text styles: these
86 // methods allow to apply the given text style to the given selection or to
87 // set/get the style which will be used for all appended text
88 virtual bool SetStyle(long start, long end, const wxTextAttr& style);
89 virtual bool SetDefaultStyle(const wxTextAttr& style);
90
91 // writing text inserts it at the current position, appending always
92 // inserts it at the end
93 virtual void WriteText(const wxString& text);
94 virtual void AppendText(const wxString& text);
95
96 // translate between the position (which is just an index in the text ctrl
97 // considering all its contents as a single strings) and (x, y) coordinates
98 // which represent column and line.
99 virtual long XYToPosition(long x, long y) const;
100 virtual bool PositionToXY(long pos, long *x, long *y) const;
101
102 virtual void ShowPosition(long pos);
103
104 // Clipboard operations
105 virtual void Copy();
106 virtual void Cut();
107 virtual void Paste();
108
109 virtual bool CanCopy() const;
110 virtual bool CanCut() const;
111 virtual bool CanPaste() const;
112
113 // Undo/redo
114 virtual void Undo();
115 virtual void Redo();
116
117 virtual bool CanUndo() const;
118 virtual bool CanRedo() const;
119
120 // Insertion point
121 virtual void SetInsertionPoint(long pos);
122 virtual void SetInsertionPointEnd();
123 virtual long GetInsertionPoint() const;
124 virtual long GetLastPosition() const;
125
126 virtual void SetSelection(long from, long to);
127 virtual void SetEditable(bool editable);
128
129 // Implementation from now on
130 // --------------------------
131
132 // Implementation
133 // --------------
134 virtual void Command(wxCommandEvent& event);
135
136 virtual bool AcceptsFocus() const;
137
138 // callbacks
139 void OnDropFiles(wxDropFilesEvent& event);
140 void OnChar(wxKeyEvent& event); // Process 'enter' if required
141
142 void OnCut(wxCommandEvent& event);
143 void OnCopy(wxCommandEvent& event);
144 void OnPaste(wxCommandEvent& event);
145 void OnUndo(wxCommandEvent& event);
146 void OnRedo(wxCommandEvent& event);
147
148 void OnUpdateCut(wxUpdateUIEvent& event);
149 void OnUpdateCopy(wxUpdateUIEvent& event);
150 void OnUpdatePaste(wxUpdateUIEvent& event);
151 void OnUpdateUndo(wxUpdateUIEvent& event);
152 void OnUpdateRedo(wxUpdateUIEvent& event);
153
154 virtual bool MacCanFocus() const { return true ; }
155 virtual bool MacSetupCursor( const wxPoint& pt ) ;
156
157 virtual void MacSuperShown( bool show ) ;
158 virtual bool Show(bool show = TRUE) ;
159
160 protected:
161 virtual wxSize DoGetBestSize() const;
162
163 bool m_editable ;
164 // one of the following objects is used for representation, the other one is NULL
165 void* m_macTE ;
166 void* m_macTXN ;
167 void* m_macTXNvars ;
168 bool m_macUsesTXN ;
169 unsigned long m_maxLength ;
170
171 DECLARE_EVENT_TABLE()
172 };
173
174 #endif
175 // _WX_TEXTCTRL_H_