]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/textctrl.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / osx / textctrl.h
CommitLineData
6762286d 1/////////////////////////////////////////////////////////////////////////////
233f5738 2// Name: wx/osx/textctrl.h
6762286d
SC
3// Purpose: wxTextCtrl class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
6762286d
SC
7// Copyright: (c) Stefan Csomor
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_TEXTCTRL_H_
12#define _WX_TEXTCTRL_H_
13
14#if wxUSE_SYSTEM_OPTIONS
15 // set this to 'true' if you want to use the 'classic' MLTE-based implementation
16 // instead of the HIView-based implementation in 10.3 and upwards, the former
17 // has more features (backgrounds etc.), but may show redraw artefacts and other
18 // problems depending on your usage; hence, the default is 'false'.
19 #define wxMAC_TEXTCONTROL_USE_MLTE wxT("mac.textcontrol-use-mlte")
20 // set this to 'true' if you want editable text controls to have spell checking turned
21 // on by default, you can change this setting individually on a control using MacCheckSpelling
22 #define wxMAC_TEXTCONTROL_USE_SPELL_CHECKER wxT("mac.textcontrol-use-spell-checker")
5c6eb3a8 23#endif
6762286d
SC
24
25#include "wx/control.h"
26#include "wx/textctrl.h"
27
6762286d
SC
28class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase
29{
30 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
31
32public:
33 wxTextCtrl()
34 { Init(); }
35
36 wxTextCtrl(wxWindow *parent,
37 wxWindowID id,
38 const wxString& value = wxEmptyString,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = 0,
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxTextCtrlNameStr)
44 {
45 Init();
46 Create(parent, id, value, pos, size, style, validator, name);
47 }
48
a0e55920 49 virtual ~wxTextCtrl();
6762286d
SC
50
51 bool Create(wxWindow *parent,
52 wxWindowID id,
53 const wxString& value = wxEmptyString,
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize,
56 long style = 0,
57 const wxValidator& validator = wxDefaultValidator,
58 const wxString& name = wxTextCtrlNameStr);
59
60 // accessors
61 // ---------
6762286d
SC
62
63 virtual int GetLineLength(long lineNo) const;
64 virtual wxString GetLineText(long lineNo) const;
65 virtual int GetNumberOfLines() const;
66
67 virtual bool IsModified() const;
6762286d
SC
68
69 // operations
70 // ----------
71
6762286d
SC
72
73 // sets/clears the dirty flag
74 virtual void MarkDirty();
75 virtual void DiscardEdits();
76
99eb484a
SC
77 // set the grayed out hint text
78 virtual bool SetHint(const wxString& hint);
79 virtual wxString GetHint() const;
80
6762286d
SC
81 // text control under some platforms supports the text styles: these
82 // methods apply the given text style to the given selection or to
83 // set/get the style which will be used for all appended text
84 virtual bool SetFont( const wxFont &font );
16671f22 85 virtual bool GetStyle(long position, wxTextAttr& style);
6762286d
SC
86 virtual bool SetStyle(long start, long end, const wxTextAttr& style);
87 virtual bool SetDefaultStyle(const wxTextAttr& style);
88
6762286d
SC
89 // translate between the position (which is just an index into the textctrl
90 // considering all its contents as a single strings) and (x, y) coordinates
91 // which represent column and line.
92 virtual long XYToPosition(long x, long y) const;
93 virtual bool PositionToXY(long pos, long *x, long *y) const;
94
95 virtual void ShowPosition(long pos);
96
c84030e0 97 // overrides so that we can send text updated events
ac349b6e 98 virtual void Copy();
6762286d
SC
99 virtual void Cut();
100 virtual void Paste();
ce00f59b 101
6762286d
SC
102 // Implementation
103 // --------------
104 virtual void Command(wxCommandEvent& event);
105
106 virtual bool AcceptsFocus() const;
107
108 // callbacks
109 void OnDropFiles(wxDropFilesEvent& event);
110 void OnChar(wxKeyEvent& event); // Process 'enter' if required
5aa6ea93 111 void OnKeyDown(wxKeyEvent& event); // Process clipboard shortcuts
6762286d
SC
112
113 void OnCut(wxCommandEvent& event);
114 void OnCopy(wxCommandEvent& event);
115 void OnPaste(wxCommandEvent& event);
116 void OnUndo(wxCommandEvent& event);
117 void OnRedo(wxCommandEvent& event);
118 void OnDelete(wxCommandEvent& event);
119 void OnSelectAll(wxCommandEvent& event);
120
121 void OnUpdateCut(wxUpdateUIEvent& event);
122 void OnUpdateCopy(wxUpdateUIEvent& event);
123 void OnUpdatePaste(wxUpdateUIEvent& event);
124 void OnUpdateUndo(wxUpdateUIEvent& event);
125 void OnUpdateRedo(wxUpdateUIEvent& event);
126 void OnUpdateDelete(wxUpdateUIEvent& event);
127 void OnUpdateSelectAll(wxUpdateUIEvent& event);
128
129 void OnContextMenu(wxContextMenuEvent& event);
130
131 virtual bool MacSetupCursor( const wxPoint& pt );
132
133 virtual void MacVisibilityChanged();
134 virtual void MacSuperChangedPosition();
135 virtual void MacCheckSpelling(bool check);
136
6762286d
SC
137protected:
138 // common part of all ctors
139 void Init();
140
141 virtual wxSize DoGetBestSize() const;
142
6762286d
SC
143 // flag is set to true when the user edits the controls contents
144 bool m_dirty;
145
e567904a 146 virtual void EnableTextChangedEvents(bool WXUNUSED(enable))
03647350 147 {
e567904a
VZ
148 // nothing to do here as the events are never generated when we change
149 // the controls value programmatically anyhow
6762286d 150 }
03647350 151
6762286d 152private :
e567904a 153 wxMenu *m_privateContextMenu;
99eb484a 154 wxString m_hintString;
6762286d 155
e567904a 156 DECLARE_EVENT_TABLE()
6762286d
SC
157};
158
159#endif // _WX_TEXTCTRL_H_