]>
Commit | Line | Data |
---|---|---|
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 | ||
47d67540 | 24 | #if wxUSE_IOSTREAMH |
c801d85f KB |
25 | #include <iostream.h> |
26 | #else | |
27 | #include <iostream> | |
28 | #endif | |
29 | ||
30 | //----------------------------------------------------------------------------- | |
31 | // classes | |
32 | //----------------------------------------------------------------------------- | |
33 | ||
34 | class wxTextCtrl; | |
35 | ||
36 | //----------------------------------------------------------------------------- | |
37 | // global data | |
38 | //----------------------------------------------------------------------------- | |
39 | ||
40 | extern const char *wxTextCtrlNameStr; | |
41 | ||
42 | //----------------------------------------------------------------------------- | |
43 | // wxTextCtrl | |
44 | //----------------------------------------------------------------------------- | |
45 | ||
46 | class wxTextCtrl: public wxControl, public streambuf | |
47 | { | |
7c41ac7b | 48 | DECLARE_EVENT_TABLE() |
c801d85f KB |
49 | DECLARE_DYNAMIC_CLASS(wxTextCtrl); |
50 | ||
903f689b | 51 | public: |
7c41ac7b VZ |
52 | wxTextCtrl(); |
53 | wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "", | |
debe6624 | 54 | const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, |
6de97a3b RR |
55 | int style = 0, const wxValidator& validator = wxDefaultValidator, |
56 | const wxString &name = wxTextCtrlNameStr ); | |
debe6624 JS |
57 | bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "", |
58 | const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, | |
6de97a3b RR |
59 | int style = 0, const wxValidator& validator = wxDefaultValidator, |
60 | const wxString &name = wxTextCtrlNameStr ); | |
7c41ac7b | 61 | wxString GetValue() const; |
c801d85f KB |
62 | void SetValue( const wxString &value ); |
63 | void WriteText( const wxString &text ); | |
7c41ac7b | 64 | |
c801d85f KB |
65 | bool LoadFile( const wxString &file ); |
66 | bool SaveFile( const wxString &file ); | |
7c41ac7b VZ |
67 | bool IsModified() const { return m_modified; } |
68 | void SetModified() { m_modified = TRUE; } | |
69 | void DiscardEdits() { m_modified = FALSE; } | |
debe6624 | 70 | wxString GetLineText( long lineNo ) const; |
c801d85f | 71 | void OnDropFiles( wxDropFilesEvent &event ); |
debe6624 | 72 | long PositionToXY( long pos, long *x, long *y ) const; |
a81258be RR |
73 | long XYToPosition( long x, long y ) const; |
74 | int GetLineLength(long lineNo) const; | |
75 | int GetNumberOfLines() const; | |
debe6624 | 76 | virtual void SetInsertionPoint( long pos ); |
7c41ac7b | 77 | virtual void SetInsertionPointEnd(); |
debe6624 JS |
78 | virtual void SetEditable( bool editable ); |
79 | virtual void SetSelection( long from, long to ); | |
80 | void ShowPosition( long pos ); | |
7c41ac7b VZ |
81 | virtual long GetInsertionPoint() const; |
82 | virtual long GetLastPosition() const; | |
debe6624 JS |
83 | virtual void Remove( long from, long to ); |
84 | virtual void Replace( long from, long to, const wxString &value ); | |
7c41ac7b VZ |
85 | void Cut(); |
86 | void Copy(); | |
87 | void Paste(); | |
03f38c58 | 88 | void Clear(); |
7c41ac7b | 89 | |
c801d85f | 90 | void OnChar( wxKeyEvent &event ); |
7c41ac7b | 91 | |
c801d85f | 92 | int overflow(int i); |
7c41ac7b VZ |
93 | int sync(); |
94 | int underflow(); | |
c801d85f KB |
95 | |
96 | wxTextCtrl& operator<<(const wxString& s); | |
debe6624 JS |
97 | wxTextCtrl& operator<<(int i); |
98 | wxTextCtrl& operator<<(long i); | |
99 | wxTextCtrl& operator<<(float f); | |
100 | wxTextCtrl& operator<<(double d); | |
c801d85f KB |
101 | wxTextCtrl& operator<<(const char c); |
102 | ||
868a2826 | 103 | void SetFont( const wxFont &font ); |
58614078 RR |
104 | void SetForegroundColour(const wxColour &colour); |
105 | void SetBackgroundColour(const wxColour &colour); | |
68dda785 | 106 | |
868a2826 RR |
107 | // implementation |
108 | ||
b4071e91 RR |
109 | GtkWidget* GetConnectWidget(void); |
110 | bool IsOwnGtkWindow( GdkWindow *window ); | |
58614078 | 111 | void ApplyWidgetStyle(); |
e3e65dac | 112 | |
903f689b RR |
113 | private: |
114 | ||
115 | bool m_modified; | |
116 | GtkWidget *m_text; | |
c801d85f KB |
117 | }; |
118 | ||
119 | #endif // __GTKTEXTCTRLH__ | |
120 | ||
121 |