]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/textctrl.h
use global operator new to fix compilation errors if type T overloads new (as wxObjec...
[wxWidgets.git] / include / wx / cocoa / textctrl.h
CommitLineData
fb896a32
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cocoa/textctrl.h
3// Purpose: wxTextCtrl class
4// Author: David Elliott
5// Modified by:
6// Created: 2003/03/16
1c4e8f38 7// RCS-ID: $Id$
fb896a32 8// Copyright: (c) 2003 David Elliott
7d8268a1 9// Licence: wxWindows licence
fb896a32
DE
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// ========================================================================
53a2db12 20class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase, protected wxCocoaNSTextField
fb896a32
DE
21{
22 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
23 DECLARE_EVENT_TABLE()
24 WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView)
25// ------------------------------------------------------------------------
26// initialization
27// ------------------------------------------------------------------------
28public:
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// ------------------------------------------------------------------------
51protected:
52 virtual void Cocoa_didChangeText(void);
715b3df0 53 virtual void CocoaTarget_action(void);
fb896a32
DE
54// ------------------------------------------------------------------------
55// Implementation
56// ------------------------------------------------------------------------
57public:
58 virtual wxString GetValue() const;
f6519b40 59
fb896a32
DE
60 virtual int GetLineLength(long lineNo) const;
61 virtual wxString GetLineText(long lineNo) const;
62 virtual int GetNumberOfLines() const;
63
64 virtual bool IsModified() const;
65 virtual bool IsEditable() const;
66
67 // If the return values from and to are the same, there is no selection.
68 virtual void GetSelection(long* from, long* to) const;
69
70 // operations
71 // ----------
72
73 // editing
74 virtual void Clear();
75 virtual void Replace(long from, long to, const wxString& value);
76 virtual void Remove(long from, long to);
77
78 // clears the dirty flag
3a9fa0d6 79 virtual void MarkDirty();
fb896a32
DE
80 virtual void DiscardEdits();
81
82 // writing text inserts it at the current position, appending always
83 // inserts it at the end
84 virtual void WriteText(const wxString& text);
85 virtual void AppendText(const wxString& text);
86
87 // translate between the position (which is just an index in the text ctrl
88 // considering all its contents as a single strings) and (x, y) coordinates
89 // which represent column and line.
90 virtual long XYToPosition(long x, long y) const;
91 virtual bool PositionToXY(long pos, long *x, long *y) const;
92
93 virtual void ShowPosition(long pos);
94
95 // Clipboard operations
96 virtual void Copy();
97 virtual void Cut();
98 virtual void Paste();
99
100 // Undo/redo
101 virtual void Undo();
102 virtual void Redo();
103
104 virtual bool CanUndo() const;
105 virtual bool CanRedo() const;
106
107 // Insertion point
108 virtual void SetInsertionPoint(long pos);
109 virtual void SetInsertionPointEnd();
110 virtual long GetInsertionPoint() const;
7d8268a1 111 virtual wxTextPos GetLastPosition() const;
fb896a32
DE
112
113 virtual void SetSelection(long from, long to);
114// virtual void SelectAll();
115 virtual void SetEditable(bool editable);
116
79e1f224
DE
117protected:
118 virtual wxSize DoGetBestSize() const;
ee2ec18e
VZ
119
120 virtual void DoSetValue(const wxString& value, int flags = 0);
fb896a32
DE
121};
122
123#endif // __WX_COCOA_TEXTCTRL_H__