]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/cocoa/textctrl.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / cocoa / textctrl.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cocoa/textctrl.h
3// Purpose: wxTextCtrl class
4// Author: David Elliott
5// Modified by:
6// Created: 2003/03/16
7// Copyright: (c) 2003 David Elliott
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef __WX_COCOA_TEXTCTRL_H__
12#define __WX_COCOA_TEXTCTRL_H__
13
14#include "wx/cocoa/NSTextField.h"
15
16// ========================================================================
17// wxTextCtrl
18// ========================================================================
19class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase, protected wxCocoaNSTextField
20{
21 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
22 DECLARE_EVENT_TABLE()
23 WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView)
24// ------------------------------------------------------------------------
25// initialization
26// ------------------------------------------------------------------------
27public:
28 wxTextCtrl() {}
29 wxTextCtrl(wxWindow *parent, wxWindowID winid,
30 const wxString& value = wxEmptyString,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize, long style = 0,
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxTextCtrlNameStr)
35 {
36 Create(parent, winid, value, pos, size, style, validator, name);
37 }
38
39 bool Create(wxWindow *parent, wxWindowID winid,
40 const wxString& value = wxEmptyString,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize, long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxTextCtrlNameStr);
45 virtual ~wxTextCtrl();
46
47// ------------------------------------------------------------------------
48// Cocoa specifics
49// ------------------------------------------------------------------------
50protected:
51 virtual void Cocoa_didChangeText(void);
52 virtual void CocoaTarget_action(void);
53// ------------------------------------------------------------------------
54// Implementation
55// ------------------------------------------------------------------------
56public:
57 virtual wxString GetValue() const;
58
59 virtual int GetLineLength(long lineNo) const;
60 virtual wxString GetLineText(long lineNo) const;
61 virtual int GetNumberOfLines() const;
62
63 virtual bool IsModified() const;
64 virtual bool IsEditable() const;
65
66 // If the return values from and to are the same, there is no selection.
67 virtual void GetSelection(long* from, long* to) const;
68
69 // operations
70 // ----------
71
72 // editing
73 virtual void Clear();
74 virtual void Replace(long from, long to, const wxString& value);
75 virtual void Remove(long from, long to);
76
77 // clears the dirty flag
78 virtual void MarkDirty();
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
94 // Clipboard operations
95 virtual void Copy();
96 virtual void Cut();
97 virtual void Paste();
98
99 // Undo/redo
100 virtual void Undo();
101 virtual void Redo();
102
103 virtual bool CanUndo() const;
104 virtual bool CanRedo() const;
105
106 // Insertion point
107 virtual void SetInsertionPoint(long pos);
108 virtual void SetInsertionPointEnd();
109 virtual long GetInsertionPoint() const;
110 virtual wxTextPos GetLastPosition() const;
111
112 virtual void SetSelection(long from, long to);
113// virtual void SelectAll();
114 virtual void SetEditable(bool editable);
115
116protected:
117 virtual wxSize DoGetBestSize() const;
118
119 virtual void DoSetValue(const wxString& value, int flags = 0);
120};
121
122#endif // __WX_COCOA_TEXTCTRL_H__