]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/textctrl.h
changes to match recent CVS updates
[wxWidgets.git] / include / wx / mac / textctrl.h
CommitLineData
0dbd6262
SC
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#ifdef __GNUG__
16#pragma interface "textctrl.h"
17#endif
18
19#include "wx/control.h"
20
0dbd6262
SC
21WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr;
22WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
23
24// Single-line text item
05adb9d2 25class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase
0dbd6262
SC
26{
27 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
28
29public:
30 // creation
31 // --------
32 wxTextCtrl();
8481948e 33 ~wxTextCtrl();
0dbd6262
SC
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)
0dbd6262
SC
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
05adb9d2
SC
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
0dbd6262
SC
66 // operations
67 // ----------
05adb9d2
SC
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 // 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);
85
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;
91
92 virtual void ShowPosition(long pos);
93
0dbd6262
SC
94 // Clipboard operations
95 virtual void Copy();
96 virtual void Cut();
97 virtual void Paste();
98
05adb9d2
SC
99 virtual bool CanCopy() const;
100 virtual bool CanCut() const;
101 virtual bool CanPaste() const;
102
103 // Undo/redo
104 virtual void Undo();
105 virtual void Redo();
106
107 virtual bool CanUndo() const;
108 virtual bool CanRedo() const;
109
110 // Insertion point
0dbd6262
SC
111 virtual void SetInsertionPoint(long pos);
112 virtual void SetInsertionPointEnd();
05adb9d2
SC
113 virtual long GetInsertionPoint() const;
114 virtual long GetLastPosition() const;
115
0dbd6262
SC
116 virtual void SetSelection(long from, long to);
117 virtual void SetEditable(bool editable);
0dbd6262 118
05adb9d2
SC
119 // Implementation from now on
120 // --------------------------
121
122 // Implementation
123 // --------------
124 virtual void Command(wxCommandEvent& event);
125
126 virtual bool AcceptsFocus() const;
127
128 // callbacks
129 void OnDropFiles(wxDropFilesEvent& event);
130 void OnChar(wxKeyEvent& event); // Process 'enter' if required
131
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);
137
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);
143
144 virtual bool MacCanFocus() const { return true ; }
145
6fda4e7a
SC
146 virtual void MacSuperShown( bool show ) ;
147 virtual bool Show(bool show = TRUE) ;
148
0dbd6262 149protected:
05adb9d2 150 virtual wxSize DoGetBestSize() const;
8481948e
SC
151
152 bool m_editable ;
153 // one of the following objects is used for representation, the other one is NULL
154 void* m_macTE ;
155 void* m_macTXN ;
156 void* m_macTXNvars ;
157 bool m_macUsesTXN ;
0dbd6262
SC
158
159 DECLARE_EVENT_TABLE()
160};
161
162#endif
163 // _WX_TEXTCTRL_H_