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