]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/textctrl.h
oops... fixed a typo
[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();
33 inline 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)
0dbd6262
SC
39 {
40 Create(parent, id, value, pos, size, style, validator, name);
41 }
42
43 bool Create(wxWindow *parent, wxWindowID id,
44 const wxString& value = wxEmptyString,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize, long style = 0,
47 const wxValidator& validator = wxDefaultValidator,
48 const wxString& name = wxTextCtrlNameStr);
49
50 // accessors
51 // ---------
52 virtual wxString GetValue() const ;
53 virtual void SetValue(const wxString& value);
54
55 virtual int GetLineLength(long lineNo) const;
56 virtual wxString GetLineText(long lineNo) const;
57 virtual int GetNumberOfLines() const;
58
05adb9d2
SC
59 virtual bool IsModified() const;
60 virtual bool IsEditable() const;
61
62 // If the return values from and to are the same, there is no selection.
63 virtual void GetSelection(long* from, long* to) const;
64
0dbd6262
SC
65 // operations
66 // ----------
05adb9d2
SC
67
68 // editing
69
70 virtual void Clear();
71 virtual void Replace(long from, long to, const wxString& value);
72 virtual void Remove(long from, long to);
73
74 // load the controls contents from the file
75 virtual bool LoadFile(const wxString& file);
76
77 // clears the dirty flag
78 virtual void DiscardEdits();
79
80 // writing text inserts it at the current position, appending always
81 // inserts it at the end
82 virtual void WriteText(const wxString& text);
83 virtual void AppendText(const wxString& text);
84
85 // translate between the position (which is just an index in the text ctrl
86 // considering all its contents as a single strings) and (x, y) coordinates
87 // which represent column and line.
88 virtual long XYToPosition(long x, long y) const;
89 virtual bool PositionToXY(long pos, long *x, long *y) const;
90
91 virtual void ShowPosition(long pos);
92
0dbd6262
SC
93 // Clipboard operations
94 virtual void Copy();
95 virtual void Cut();
96 virtual void Paste();
97
05adb9d2
SC
98 virtual bool CanCopy() const;
99 virtual bool CanCut() const;
100 virtual bool CanPaste() const;
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
0dbd6262
SC
110 virtual void SetInsertionPoint(long pos);
111 virtual void SetInsertionPointEnd();
05adb9d2
SC
112 virtual long GetInsertionPoint() const;
113 virtual long GetLastPosition() const;
114
0dbd6262
SC
115 virtual void SetSelection(long from, long to);
116 virtual void SetEditable(bool editable);
0dbd6262 117
05adb9d2
SC
118 // Implementation from now on
119 // --------------------------
120
121 // Implementation
122 // --------------
123 virtual void Command(wxCommandEvent& event);
124
125 virtual bool AcceptsFocus() const;
126
127 // callbacks
128 void OnDropFiles(wxDropFilesEvent& event);
129 void OnChar(wxKeyEvent& event); // Process 'enter' if required
130
131 void OnCut(wxCommandEvent& event);
132 void OnCopy(wxCommandEvent& event);
133 void OnPaste(wxCommandEvent& event);
134 void OnUndo(wxCommandEvent& event);
135 void OnRedo(wxCommandEvent& event);
136
137 void OnUpdateCut(wxUpdateUIEvent& event);
138 void OnUpdateCopy(wxUpdateUIEvent& event);
139 void OnUpdatePaste(wxUpdateUIEvent& event);
140 void OnUpdateUndo(wxUpdateUIEvent& event);
141 void OnUpdateRedo(wxUpdateUIEvent& event);
142
143 virtual bool MacCanFocus() const { return true ; }
144
0dbd6262 145protected:
05adb9d2 146 virtual wxSize DoGetBestSize() const;
0dbd6262
SC
147
148 DECLARE_EVENT_TABLE()
149};
150
151#endif
152 // _WX_TEXTCTRL_H_