]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/textctrl.h
added "access" parameter to wxFile::Create and Open. The default value is
[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$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __TEXTCTRLH__
13#define __TEXTCTRLH__
14
15#ifdef __GNUG__
16#pragma interface "textctrl.h"
17#endif
18
19#include "wx/control.h"
20
21#if USE_IOSTREAMH
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
33// 16-bit Borland 4.0 doesn't seem to allow multiple inheritance with wxWindow and streambuf:
34// it complains about deriving a huge class from the huge class streambuf. !!
35// Also, can't use streambuf if making or using a DLL :-(
36
37#if (defined(__BORLANDC__) && !defined(__WIN32__)) || defined(__MWERKS__) || defined(_WINDLL) || defined(WXUSINGDLL) || defined(WXMAKINGDLL)
38#define NO_TEXT_WINDOW_STREAM
39#endif
40
41#ifndef NO_TEXT_WINDOW_STREAM
42, public streambuf
43#endif
44
45{
46 DECLARE_DYNAMIC_CLASS(wxTextCtrl)
ae29de83
VZ
47
48public:
49 // creation
50 // --------
51 wxTextCtrl();
debe6624 52 inline wxTextCtrl(wxWindow *parent, wxWindowID id,
ae29de83
VZ
53 const wxString& value = wxEmptyString,
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize, long style = 0,
56 const wxValidator& validator = wxDefaultValidator,
57 const wxString& name = wxTextCtrlNameStr)
2bda0e17 58#ifndef NO_TEXT_WINDOW_STREAM
ae29de83 59 :streambuf()
2bda0e17
KB
60#endif
61 {
ae29de83 62 Create(parent, id, value, pos, size, style, validator, name);
2bda0e17 63 }
ae29de83 64
debe6624 65 bool Create(wxWindow *parent, wxWindowID id,
ae29de83
VZ
66 const wxString& value = wxEmptyString,
67 const wxPoint& pos = wxDefaultPosition,
68 const wxSize& size = wxDefaultSize, long style = 0,
69 const wxValidator& validator = wxDefaultValidator,
70 const wxString& name = wxTextCtrlNameStr);
71
72 // accessors
73 // ---------
74 virtual wxString GetValue() const ;
2bda0e17 75 virtual void SetValue(const wxString& value);
2bda0e17 76
ae29de83
VZ
77 virtual int GetLineLength(long lineNo) const;
78 virtual wxString GetLineText(long lineNo) const;
79 virtual int GetNumberOfLines() const;
2bda0e17 80
ae29de83
VZ
81 // operations
82 // ----------
83 virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
84
85 // Clipboard operations
86 virtual void Copy();
87 virtual void Cut();
88 virtual void Paste();
89
debe6624 90 virtual void SetInsertionPoint(long pos);
ae29de83
VZ
91 virtual void SetInsertionPointEnd();
92 virtual long GetInsertionPoint() const ;
93 virtual long GetLastPosition() const ;
debe6624
JS
94 virtual void Replace(long from, long to, const wxString& value);
95 virtual void Remove(long from, long to);
96 virtual void SetSelection(long from, long to);
debe6624 97 virtual void SetEditable(bool editable);
ae29de83
VZ
98
99 // streambuf implementation
2bda0e17
KB
100#ifndef NO_TEXT_WINDOW_STREAM
101 int overflow(int i);
ae29de83
VZ
102 int sync();
103 int underflow();
2bda0e17 104#endif
ae29de83 105
2bda0e17 106 wxTextCtrl& operator<<(const wxString& s);
debe6624
JS
107 wxTextCtrl& operator<<(int i);
108 wxTextCtrl& operator<<(long i);
109 wxTextCtrl& operator<<(float f);
110 wxTextCtrl& operator<<(double d);
2bda0e17 111 wxTextCtrl& operator<<(const char c);
ae29de83 112
2bda0e17
KB
113 virtual bool LoadFile(const wxString& file);
114 virtual bool SaveFile(const wxString& file);
115 virtual void WriteText(const wxString& text);
ae29de83
VZ
116 virtual void DiscardEdits();
117 virtual bool IsModified() const;
118
2bda0e17 119#if WXWIN_COMPATIBILITY
ae29de83 120 inline bool Modified() const { return IsModified(); }
2bda0e17 121#endif
ae29de83 122
debe6624
JS
123 virtual long XYToPosition(long x, long y) const ;
124 virtual void PositionToXY(long pos, long *x, long *y) const ;
125 virtual void ShowPosition(long pos);
ae29de83
VZ
126 virtual void Clear();
127
128 // callbacks
129 // ---------
130 void OnDropFiles(wxDropFilesEvent& event);
131 void OnChar(wxKeyEvent& event); // Process 'enter' if required
2bda0e17 132 void OnEraseBackground(wxEraseEvent& event);
ae29de83 133
2bda0e17 134 // Implementation
ae29de83
VZ
135 // --------------
136 virtual void Command(wxCommandEvent& event);
debe6624 137 virtual bool MSWCommand(WXUINT param, WXWORD id);
ae29de83 138 inline bool IsRich() const { return m_isRich; }
debe6624
JS
139 inline void SetRichEdit(bool isRich) { m_isRich = isRich; }
140 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
ae29de83
VZ
141 WXUINT message, WXWPARAM wParam,
142 WXLPARAM lParam);
143
144 virtual void AdoptAttributesFromHWND();
145 virtual void SetupColours();
146 virtual long MSWGetDlgCode();
147
2bda0e17 148protected:
ae29de83
VZ
149 bool m_isRich; // Are we using rich text edit to implement this?
150 wxString fileName;
151
152 DECLARE_EVENT_TABLE()
2bda0e17
KB
153};
154
155#endif
156 // __TEXTCTRLH__