]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/textctrl.h
Added wxTE_PROCESS_TAB
[wxWidgets.git] / include / wx / gtk1 / textctrl.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: textctrl.h
3// Purpose:
4// Author: Robert Roebling
5// Created: 01/02/97
7c41ac7b 6// Id: $Id$
c801d85f 7// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
7c41ac7b 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
11
12#ifndef __GTKTEXTCTRLH__
13#define __GTKTEXTCTRLH__
14
15#ifdef __GNUG__
16#pragma interface
17#endif
18
19#include "wx/defs.h"
20#include "wx/object.h"
21#include "wx/string.h"
22#include "wx/control.h"
23
4bf78aae 24#if wxUSE_STD_IOSTREAM
f5abe911 25
47d67540 26#if wxUSE_IOSTREAMH
c801d85f
KB
27#include <iostream.h>
28#else
29#include <iostream>
30#endif
31
f5abe911
RR
32#else
33
34#define NO_TEXT_WINDOW_STREAM
35
36#endif
37
c801d85f
KB
38//-----------------------------------------------------------------------------
39// classes
40//-----------------------------------------------------------------------------
41
42class wxTextCtrl;
43
44//-----------------------------------------------------------------------------
45// global data
46//-----------------------------------------------------------------------------
47
48extern const char *wxTextCtrlNameStr;
49
50//-----------------------------------------------------------------------------
51// wxTextCtrl
52//-----------------------------------------------------------------------------
53
f5abe911 54#ifndef NO_TEXT_WINDOW_STREAM
c801d85f 55class wxTextCtrl: public wxControl, public streambuf
f5abe911
RR
56#else
57class wxTextCtrl: public wxControl
58#endif
c801d85f 59{
7c41ac7b 60 DECLARE_EVENT_TABLE()
c801d85f
KB
61 DECLARE_DYNAMIC_CLASS(wxTextCtrl);
62
903f689b 63 public:
7c41ac7b
VZ
64 wxTextCtrl();
65 wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
debe6624 66 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
6de97a3b
RR
67 int style = 0, const wxValidator& validator = wxDefaultValidator,
68 const wxString &name = wxTextCtrlNameStr );
debe6624
JS
69 bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "",
70 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
6de97a3b
RR
71 int style = 0, const wxValidator& validator = wxDefaultValidator,
72 const wxString &name = wxTextCtrlNameStr );
7c41ac7b 73 wxString GetValue() const;
c801d85f
KB
74 void SetValue( const wxString &value );
75 void WriteText( const wxString &text );
7c41ac7b 76
c801d85f
KB
77 bool LoadFile( const wxString &file );
78 bool SaveFile( const wxString &file );
7c41ac7b
VZ
79 bool IsModified() const { return m_modified; }
80 void SetModified() { m_modified = TRUE; }
81 void DiscardEdits() { m_modified = FALSE; }
debe6624 82 wxString GetLineText( long lineNo ) const;
c801d85f 83 void OnDropFiles( wxDropFilesEvent &event );
debe6624 84 long PositionToXY( long pos, long *x, long *y ) const;
a81258be
RR
85 long XYToPosition( long x, long y ) const;
86 int GetLineLength(long lineNo) const;
87 int GetNumberOfLines() const;
debe6624 88 virtual void SetInsertionPoint( long pos );
7c41ac7b 89 virtual void SetInsertionPointEnd();
debe6624
JS
90 virtual void SetEditable( bool editable );
91 virtual void SetSelection( long from, long to );
92 void ShowPosition( long pos );
7c41ac7b
VZ
93 virtual long GetInsertionPoint() const;
94 virtual long GetLastPosition() const;
debe6624
JS
95 virtual void Remove( long from, long to );
96 virtual void Replace( long from, long to, const wxString &value );
7c41ac7b
VZ
97 void Cut();
98 void Copy();
99 void Paste();
03f38c58 100 void Clear();
7c41ac7b 101
c801d85f 102 void OnChar( wxKeyEvent &event );
7c41ac7b 103
f5abe911 104#ifndef NO_TEXT_WINDOW_STREAM
c801d85f 105 int overflow(int i);
7c41ac7b
VZ
106 int sync();
107 int underflow();
c801d85f
KB
108
109 wxTextCtrl& operator<<(const wxString& s);
debe6624
JS
110 wxTextCtrl& operator<<(int i);
111 wxTextCtrl& operator<<(long i);
112 wxTextCtrl& operator<<(float f);
113 wxTextCtrl& operator<<(double d);
c801d85f 114 wxTextCtrl& operator<<(const char c);
f5abe911 115#endif
c801d85f 116
868a2826 117 void SetFont( const wxFont &font );
58614078
RR
118 void SetForegroundColour(const wxColour &colour);
119 void SetBackgroundColour(const wxColour &colour);
68dda785 120
868a2826
RR
121 // implementation
122
2830bf19 123 GtkWidget* GetConnectWidget();
b4071e91 124 bool IsOwnGtkWindow( GdkWindow *window );
58614078 125 void ApplyWidgetStyle();
2830bf19 126 void CalculateScrollbar();
e3e65dac 127
903f689b
RR
128 private:
129
130 bool m_modified;
131 GtkWidget *m_text;
2830bf19
RR
132 GtkWidget *m_vScrollbar;
133 bool m_vScrollbarVisible;
c801d85f
KB
134};
135
136#endif // __GTKTEXTCTRLH__
137
138