]> git.saurik.com Git - wxWidgets.git/blame - include/wx/stubs/textctrl.h
made wxLocale::GetSystemLanguage and wxLocale::AddLanguage static;
[wxWidgets.git] / include / wx / stubs / textctrl.h
CommitLineData
7c23a0b0
JS
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
47d67540 21#if wxUSE_IOSTREAMH
7c23a0b0
JS
22#include <iostream.h>
23#else
24#include <iostream>
25#endif
26
27WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr;
28WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
29
30// Single-line text item
31class WXDLLEXPORT wxTextCtrl: public wxControl
32
5e25ba90 33// TODO Some platforms/compilers don't like inheritance from streambuf.
7c23a0b0
JS
34
35#if (defined(__BORLANDC__) && !defined(__WIN32__)) || defined(__MWERKS__)
36#define NO_TEXT_WINDOW_STREAM
37#endif
38
39#ifndef NO_TEXT_WINDOW_STREAM
40, public streambuf
41#endif
42
43{
44 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
45
46public:
47 // creation
48 // --------
49 wxTextCtrl();
50 inline wxTextCtrl(wxWindow *parent, wxWindowID id,
51 const wxString& value = wxEmptyString,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize, long style = 0,
54 const wxValidator& validator = wxDefaultValidator,
55 const wxString& name = wxTextCtrlNameStr)
56#ifndef NO_TEXT_WINDOW_STREAM
57 :streambuf()
58#endif
59 {
60 Create(parent, id, value, pos, size, style, validator, name);
61 }
62
63 bool Create(wxWindow *parent, wxWindowID id,
64 const wxString& value = wxEmptyString,
65 const wxPoint& pos = wxDefaultPosition,
66 const wxSize& size = wxDefaultSize, long style = 0,
67 const wxValidator& validator = wxDefaultValidator,
68 const wxString& name = wxTextCtrlNameStr);
69
70 // accessors
71 // ---------
72 virtual wxString GetValue() const ;
73 virtual void SetValue(const wxString& value);
74
75 virtual int GetLineLength(long lineNo) const;
76 virtual wxString GetLineText(long lineNo) const;
77 virtual int GetNumberOfLines() const;
78
79 // operations
80 // ----------
81 virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
82
83 // Clipboard operations
84 virtual void Copy();
85 virtual void Cut();
86 virtual void Paste();
87
ca8b28f2
JS
88 virtual bool CanCopy() const;
89 virtual bool CanCut() const;
90 virtual bool CanPaste() const;
91
92 // Undo/redo
93 virtual void Undo();
94 virtual void Redo();
95
96 virtual bool CanUndo() const;
97 virtual bool CanRedo() const;
98
7c23a0b0
JS
99 virtual void SetInsertionPoint(long pos);
100 virtual void SetInsertionPointEnd();
101 virtual long GetInsertionPoint() const ;
102 virtual long GetLastPosition() const ;
103 virtual void Replace(long from, long to, const wxString& value);
104 virtual void Remove(long from, long to);
105 virtual void SetSelection(long from, long to);
106 virtual void SetEditable(bool editable);
ca8b28f2
JS
107
108 // If the return values from and to are the same, there is no
109 // selection.
110 virtual void GetSelection(long* from, long* to) const;
111 virtual bool IsEditable() const ;
112
7c23a0b0
JS
113 // streambuf implementation
114#ifndef NO_TEXT_WINDOW_STREAM
115 int overflow(int i);
116 int sync();
117 int underflow();
118#endif
119
120 wxTextCtrl& operator<<(const wxString& s);
121 wxTextCtrl& operator<<(int i);
122 wxTextCtrl& operator<<(long i);
123 wxTextCtrl& operator<<(float f);
124 wxTextCtrl& operator<<(double d);
125 wxTextCtrl& operator<<(const char c);
126
127 virtual bool LoadFile(const wxString& file);
128 virtual bool SaveFile(const wxString& file);
129 virtual void WriteText(const wxString& text);
13c21be5 130 virtual void AppendText(const wxString& text);
7c23a0b0
JS
131 virtual void DiscardEdits();
132 virtual bool IsModified() const;
133
134 virtual long XYToPosition(long x, long y) const ;
135 virtual void PositionToXY(long pos, long *x, long *y) const ;
136 virtual void ShowPosition(long pos);
137 virtual void Clear();
138
139 // callbacks
140 // ---------
141 void OnDropFiles(wxDropFilesEvent& event);
7f555861
JS
142// void OnChar(wxKeyEvent& event); // Process 'enter' if required
143// void OnEraseBackground(wxEraseEvent& event);
e702ff0f
JS
144 void OnCut(wxCommandEvent& event);
145 void OnCopy(wxCommandEvent& event);
146 void OnPaste(wxCommandEvent& event);
147 void OnUndo(wxCommandEvent& event);
148 void OnRedo(wxCommandEvent& event);
149
150 void OnUpdateCut(wxUpdateUIEvent& event);
151 void OnUpdateCopy(wxUpdateUIEvent& event);
152 void OnUpdatePaste(wxUpdateUIEvent& event);
153 void OnUpdateUndo(wxUpdateUIEvent& event);
154 void OnUpdateRedo(wxUpdateUIEvent& event);
155
7c23a0b0
JS
156 // Implementation
157 // --------------
158 virtual void Command(wxCommandEvent& event);
159
160protected:
5e25ba90 161 wxString m_fileName;
7c23a0b0
JS
162
163 DECLARE_EVENT_TABLE()
164};
165
166#endif
167 // _WX_TEXTCTRL_H_