]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/textctrl.h
Removed unnecessary code from utilsunx.cpp
[wxWidgets.git] / include / wx / msw / textctrl.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: textctrl.h
3// Purpose: wxTextCtrl class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
5fb9fcfc 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_TEXTCTRL_H_
13#define _WX_TEXTCTRL_H_
2bda0e17
KB
14
15#ifdef __GNUG__
396bdd5a 16 #pragma interface "textctrl.h"
2bda0e17
KB
17#endif
18
a1b82138 19class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
2bda0e17 20{
ae29de83 21public:
bfc6fde4
VZ
22 // creation
23 // --------
a1b82138 24
bfc6fde4
VZ
25 wxTextCtrl();
26 wxTextCtrl(wxWindow *parent, wxWindowID id,
a1b82138
VZ
27 const wxString& value = wxEmptyString,
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize,
30 long style = 0,
31 const wxValidator& validator = wxDefaultValidator,
32 const wxString& name = wxTextCtrlNameStr)
33 {
34 Create(parent, id, value, pos, size, style, validator, name);
35 }
bfc6fde4
VZ
36
37 bool Create(wxWindow *parent, wxWindowID id,
a1b82138
VZ
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);
bfc6fde4 44
a1b82138
VZ
45 // implement base class pure virtuals
46 // ----------------------------------
4438caf4
VZ
47
48 virtual wxString GetValue() const;
bfc6fde4
VZ
49 virtual void SetValue(const wxString& value);
50
51 virtual int GetLineLength(long lineNo) const;
52 virtual wxString GetLineText(long lineNo) const;
53 virtual int GetNumberOfLines() const;
54
a1b82138
VZ
55 virtual bool IsModified() const;
56 virtual bool IsEditable() const;
57
58 // If the return values from and to are the same, there is no selection.
59 virtual void GetSelection(long* from, long* to) const;
60
bfc6fde4
VZ
61 // operations
62 // ----------
63
a1b82138
VZ
64 // editing
65 virtual void Clear();
66 virtual void Replace(long from, long to, const wxString& value);
67 virtual void Remove(long from, long to);
68
69 // load the controls contents from the file
70 virtual bool LoadFile(const wxString& file);
71
72 // clears the dirty flag
73 virtual void DiscardEdits();
74
75 // writing text inserts it at the current position, appending always
76 // inserts it at the end
77 virtual void WriteText(const wxString& text);
78 virtual void AppendText(const wxString& text);
79
80 // translate between the position (which is just an index in the text ctrl
81 // considering all its contents as a single strings) and (x, y) coordinates
82 // which represent column and line.
83 virtual long XYToPosition(long x, long y) const;
0efe5ba7 84 virtual bool PositionToXY(long pos, long *x, long *y) const;
a1b82138
VZ
85
86 virtual void ShowPosition(long pos);
87
bfc6fde4
VZ
88 // Clipboard operations
89 virtual void Copy();
90 virtual void Cut();
91 virtual void Paste();
92
ca8b28f2
JS
93 virtual bool CanCopy() const;
94 virtual bool CanCut() const;
95 virtual bool CanPaste() const;
96
97 // Undo/redo
98 virtual void Undo();
99 virtual void Redo();
100
101 virtual bool CanUndo() const;
102 virtual bool CanRedo() const;
103
a1b82138 104 // Insertion point
bfc6fde4
VZ
105 virtual void SetInsertionPoint(long pos);
106 virtual void SetInsertionPointEnd();
a1b82138
VZ
107 virtual long GetInsertionPoint() const;
108 virtual long GetLastPosition() const;
109
bfc6fde4
VZ
110 virtual void SetSelection(long from, long to);
111 virtual void SetEditable(bool editable);
112
4438caf4
VZ
113 // Implementation from now on
114 // --------------------------
e702ff0f 115
bfc6fde4
VZ
116 virtual void Command(wxCommandEvent& event);
117 virtual bool MSWCommand(WXUINT param, WXWORD id);
396bdd5a
VZ
118
119#if wxUSE_RICHEDIT
bfc6fde4
VZ
120 bool IsRich() const { return m_isRich; }
121 void SetRichEdit(bool isRich) { m_isRich = isRich; }
a1b82138 122#endif // wxUSE_RICHEDIT
396bdd5a 123
bfc6fde4
VZ
124 virtual void AdoptAttributesFromHWND();
125 virtual void SetupColours();
5fb9fcfc 126
c50f1fb9
VZ
127 virtual bool AcceptsFocus() const;
128
4438caf4 129 // callbacks
4438caf4
VZ
130 void OnDropFiles(wxDropFilesEvent& event);
131 void OnChar(wxKeyEvent& event); // Process 'enter' if required
132
133 void OnCut(wxCommandEvent& event);
134 void OnCopy(wxCommandEvent& event);
135 void OnPaste(wxCommandEvent& event);
136 void OnUndo(wxCommandEvent& event);
137 void OnRedo(wxCommandEvent& event);
138
139 void OnUpdateCut(wxUpdateUIEvent& event);
140 void OnUpdateCopy(wxUpdateUIEvent& event);
141 void OnUpdatePaste(wxUpdateUIEvent& event);
142 void OnUpdateUndo(wxUpdateUIEvent& event);
143 void OnUpdateRedo(wxUpdateUIEvent& event);
144
2bda0e17 145protected:
396bdd5a 146#if wxUSE_RICHEDIT
bfc6fde4 147 bool m_isRich; // Are we using rich text edit to implement this?
396bdd5a
VZ
148#endif
149
789295bf
VZ
150 // call this to increase the size limit (will do nothing if the current
151 // limit is big enough)
152 void AdjustSpaceLimit();
153
f68586e5 154 virtual wxSize DoGetBestSize() const;
bfc6fde4
VZ
155
156private:
157 DECLARE_EVENT_TABLE()
a1b82138 158 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
2bda0e17
KB
159};
160
161#endif
bbcdf8bc 162 // _WX_TEXTCTRL_H_