]>
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 | ||
24 | #if USE_IOSTREAMH | |
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 | ||
7c41ac7b VZ |
51 | public: |
52 | wxTextCtrl(); | |
53 | wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "", | |
debe6624 JS |
54 | const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, |
55 | int style = 0, const wxString &name = wxTextCtrlNameStr ); | |
56 | bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "", | |
57 | const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, | |
58 | int style = 0, const wxString &name = wxTextCtrlNameStr ); | |
7c41ac7b | 59 | wxString GetValue() const; |
c801d85f KB |
60 | void SetValue( const wxString &value ); |
61 | void WriteText( const wxString &text ); | |
7c41ac7b | 62 | |
c801d85f KB |
63 | bool LoadFile( const wxString &file ); |
64 | bool SaveFile( const wxString &file ); | |
7c41ac7b VZ |
65 | bool IsModified() const { return m_modified; } |
66 | void SetModified() { m_modified = TRUE; } | |
67 | void DiscardEdits() { m_modified = FALSE; } | |
112892b9 | 68 | /* |
debe6624 | 69 | wxString GetLineText( long lineNo ) const; |
c801d85f | 70 | void OnDropFiles( wxDropFilesEvent &event ); |
debe6624 JS |
71 | long PositionToXY( long pos, long *x, long *y ) const; |
72 | long XYToPosition( long x, long y ); | |
7c41ac7b | 73 | int GetNumberOfLines(); |
c801d85f | 74 | */ |
debe6624 | 75 | virtual void SetInsertionPoint( long pos ); |
7c41ac7b | 76 | virtual void SetInsertionPointEnd(); |
debe6624 JS |
77 | virtual void SetEditable( bool editable ); |
78 | virtual void SetSelection( long from, long to ); | |
79 | void ShowPosition( long pos ); | |
7c41ac7b VZ |
80 | virtual long GetInsertionPoint() const; |
81 | virtual long GetLastPosition() const; | |
debe6624 JS |
82 | virtual void Remove( long from, long to ); |
83 | virtual void Replace( long from, long to, const wxString &value ); | |
7c41ac7b VZ |
84 | void Cut(); |
85 | void Copy(); | |
86 | void Paste(); | |
87 | void Delete(); | |
88 | ||
c801d85f | 89 | void OnChar( wxKeyEvent &event ); |
7c41ac7b | 90 | |
c801d85f | 91 | int overflow(int i); |
7c41ac7b VZ |
92 | int sync(); |
93 | int underflow(); | |
c801d85f KB |
94 | |
95 | wxTextCtrl& operator<<(const wxString& s); | |
debe6624 JS |
96 | wxTextCtrl& operator<<(int i); |
97 | wxTextCtrl& operator<<(long i); | |
98 | wxTextCtrl& operator<<(float f); | |
99 | wxTextCtrl& operator<<(double d); | |
c801d85f KB |
100 | wxTextCtrl& operator<<(const char c); |
101 | ||
e3e65dac RR |
102 | virtual GtkWidget* GetDropTargetWidget(void); |
103 | ||
7c41ac7b VZ |
104 | private: |
105 | bool m_modified; | |
13289f04 VZ |
106 | |
107 | GtkWidget *m_text; | |
c801d85f KB |
108 | }; |
109 | ||
110 | #endif // __GTKTEXTCTRLH__ | |
111 | ||
112 |