]> git.saurik.com Git - wxWidgets.git/blame - include/wx/qt/textctrl.h
some changes to make wxHtmlHelpController easier to subclass
[wxWidgets.git] / include / wx / qt / textctrl.h
CommitLineData
7c78e7c7
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: textctrl.h
01b2eeec
KB
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
7c78e7c7
RR
10/////////////////////////////////////////////////////////////////////////////
11
01b2eeec
KB
12#ifndef _WX_TEXTCTRL_H_
13#define _WX_TEXTCTRL_H_
7c78e7c7
RR
14
15#ifdef __GNUG__
01b2eeec 16#pragma interface "textctrl.h"
7c78e7c7
RR
17#endif
18
7c78e7c7
RR
19#include "wx/control.h"
20
47d67540 21#if wxUSE_IOSTREAMH
7c78e7c7
RR
22#include <iostream.h>
23#else
24#include <iostream>
25#endif
26
01b2eeec
KB
27WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr;
28WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
7c78e7c7 29
01b2eeec
KB
30// Single-line text item
31class WXDLLEXPORT wxTextCtrl: public wxControl
7c78e7c7 32
01b2eeec 33// TODO Some platforms/compilers don't like inheritance from streambuf.
7c78e7c7 34
01b2eeec
KB
35#if (defined(__BORLANDC__) && !defined(__WIN32__)) || defined(__MWERKS__)
36#define NO_TEXT_WINDOW_STREAM
37#endif
7c78e7c7 38
01b2eeec
KB
39#ifndef NO_TEXT_WINDOW_STREAM
40, public streambuf
41#endif
7c78e7c7 42
7c78e7c7 43{
01b2eeec
KB
44 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
45
7c78e7c7 46public:
01b2eeec
KB
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
88 virtual void SetInsertionPoint(long pos);
89 virtual void SetInsertionPointEnd();
90 virtual long GetInsertionPoint() const ;
91 virtual long GetLastPosition() const ;
92 virtual void Replace(long from, long to, const wxString& value);
93 virtual void Remove(long from, long to);
94 virtual void SetSelection(long from, long to);
95 virtual void SetEditable(bool editable);
96
97 // streambuf implementation
98#ifndef NO_TEXT_WINDOW_STREAM
99 int overflow(int i);
100 int sync();
101 int underflow();
102#endif
103
104 wxTextCtrl& operator<<(const wxString& s);
105 wxTextCtrl& operator<<(int i);
106 wxTextCtrl& operator<<(long i);
107 wxTextCtrl& operator<<(float f);
108 wxTextCtrl& operator<<(double d);
109 wxTextCtrl& operator<<(const char c);
110
111 virtual bool LoadFile(const wxString& file);
112 virtual bool SaveFile(const wxString& file);
113 virtual void WriteText(const wxString& text);
13c21be5 114 virtual void AppendText(const wxString& text);
01b2eeec
KB
115 virtual void DiscardEdits();
116 virtual bool IsModified() const;
117
118 virtual long XYToPosition(long x, long y) const ;
119 virtual void PositionToXY(long pos, long *x, long *y) const ;
120 virtual void ShowPosition(long pos);
121 virtual void Clear();
122
123 // callbacks
124 // ---------
125 void OnDropFiles(wxDropFilesEvent& event);
126 void OnChar(wxKeyEvent& event); // Process 'enter' if required
127 void OnEraseBackground(wxEraseEvent& event);
128
129 // Implementation
130 // --------------
131 virtual void Command(wxCommandEvent& event);
132
133protected:
134 wxString m_fileName;
135
136 DECLARE_EVENT_TABLE()
7c78e7c7
RR
137};
138
01b2eeec
KB
139#endif
140 // _WX_TEXTCTRL_H_