]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/textctrl.h
Made icons configurable via a wxMApp virtual function. Tested on wxGTK only,
[wxWidgets.git] / include / wx / gtk / 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#endif
33
c801d85f
KB
34//-----------------------------------------------------------------------------
35// classes
36//-----------------------------------------------------------------------------
37
38class wxTextCtrl;
39
40//-----------------------------------------------------------------------------
41// global data
42//-----------------------------------------------------------------------------
43
44extern const char *wxTextCtrlNameStr;
45
46//-----------------------------------------------------------------------------
47// wxTextCtrl
48//-----------------------------------------------------------------------------
49
38830220 50#if wxUSE_STD_IOSTREAM
c801d85f 51class wxTextCtrl: public wxControl, public streambuf
f5abe911
RR
52#else
53class wxTextCtrl: public wxControl
54#endif
c801d85f 55{
7c41ac7b 56 DECLARE_EVENT_TABLE()
c801d85f
KB
57 DECLARE_DYNAMIC_CLASS(wxTextCtrl);
58
903f689b 59 public:
7c41ac7b
VZ
60 wxTextCtrl();
61 wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
debe6624 62 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
6de97a3b
RR
63 int style = 0, const wxValidator& validator = wxDefaultValidator,
64 const wxString &name = wxTextCtrlNameStr );
debe6624
JS
65 bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "",
66 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
6de97a3b
RR
67 int style = 0, const wxValidator& validator = wxDefaultValidator,
68 const wxString &name = wxTextCtrlNameStr );
7c41ac7b 69 wxString GetValue() const;
c801d85f
KB
70 void SetValue( const wxString &value );
71 void WriteText( const wxString &text );
a6e21573 72 void AppendText( const wxString &text );
7c41ac7b 73
c801d85f
KB
74 bool LoadFile( const wxString &file );
75 bool SaveFile( const wxString &file );
7c41ac7b
VZ
76 bool IsModified() const { return m_modified; }
77 void SetModified() { m_modified = TRUE; }
78 void DiscardEdits() { m_modified = FALSE; }
debe6624 79 wxString GetLineText( long lineNo ) const;
c801d85f 80 void OnDropFiles( wxDropFilesEvent &event );
debe6624 81 long PositionToXY( long pos, long *x, long *y ) const;
a81258be
RR
82 long XYToPosition( long x, long y ) const;
83 int GetLineLength(long lineNo) const;
84 int GetNumberOfLines() const;
debe6624 85 virtual void SetInsertionPoint( long pos );
7c41ac7b 86 virtual void SetInsertionPointEnd();
debe6624
JS
87 virtual void SetEditable( bool editable );
88 virtual void SetSelection( long from, long to );
89 void ShowPosition( long pos );
7c41ac7b
VZ
90 virtual long GetInsertionPoint() const;
91 virtual long GetLastPosition() const;
debe6624
JS
92 virtual void Remove( long from, long to );
93 virtual void Replace( long from, long to, const wxString &value );
7c41ac7b
VZ
94 void Cut();
95 void Copy();
96 void Paste();
03f38c58 97 void Clear();
7c41ac7b 98
ca8b28f2
JS
99 virtual bool CanCopy() const;
100 virtual bool CanCut() const;
101 virtual bool CanPaste() const;
102
103 // Undo/redo
104 virtual void Undo();
105 virtual void Redo();
106
107 virtual bool CanUndo() const;
108 virtual bool CanRedo() const;
109
110 // If the return values from and to are the same, there is no
111 // selection.
112 virtual void GetSelection(long* from, long* to) const;
113 virtual bool IsEditable() const ;
114
c801d85f 115 void OnChar( wxKeyEvent &event );
7c41ac7b 116
e702ff0f
JS
117 void OnCut(wxCommandEvent& event);
118 void OnCopy(wxCommandEvent& event);
119 void OnPaste(wxCommandEvent& event);
120 void OnUndo(wxCommandEvent& event);
121 void OnRedo(wxCommandEvent& event);
122
123 void OnUpdateCut(wxUpdateUIEvent& event);
124 void OnUpdateCopy(wxUpdateUIEvent& event);
125 void OnUpdatePaste(wxUpdateUIEvent& event);
126 void OnUpdateUndo(wxUpdateUIEvent& event);
127 void OnUpdateRedo(wxUpdateUIEvent& event);
128
38830220 129#if wxUSE_STD_IOSTREAM
c801d85f 130 int overflow(int i);
7c41ac7b
VZ
131 int sync();
132 int underflow();
38830220 133#endif
c801d85f
KB
134
135 wxTextCtrl& operator<<(const wxString& s);
debe6624
JS
136 wxTextCtrl& operator<<(int i);
137 wxTextCtrl& operator<<(long i);
138 wxTextCtrl& operator<<(float f);
139 wxTextCtrl& operator<<(double d);
c801d85f
KB
140 wxTextCtrl& operator<<(const char c);
141
f03fc89f
VZ
142 bool SetFont( const wxFont &font );
143 bool SetForegroundColour(const wxColour &colour);
144 bool SetBackgroundColour(const wxColour &colour);
68dda785 145
868a2826
RR
146 // implementation
147
2830bf19 148 GtkWidget* GetConnectWidget();
b4071e91 149 bool IsOwnGtkWindow( GdkWindow *window );
58614078 150 void ApplyWidgetStyle();
2830bf19 151 void CalculateScrollbar();
e3e65dac 152
903f689b
RR
153 private:
154
155 bool m_modified;
156 GtkWidget *m_text;
2830bf19
RR
157 GtkWidget *m_vScrollbar;
158 bool m_vScrollbarVisible;
c801d85f
KB
159};
160
161#endif // __GTKTEXTCTRLH__
162
163