]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/textctrl.h
General tidy-up (mainly typecasts) to allow the use of the SGI native
[wxWidgets.git] / include / wx / gtk / textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: textctrl.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id: $Id$
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
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 {
48 DECLARE_EVENT_TABLE()
49 DECLARE_DYNAMIC_CLASS(wxTextCtrl);
50
51 public:
52 wxTextCtrl();
53 wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
54 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
55 int style = 0, const wxValidator& validator = wxDefaultValidator,
56 const wxString &name = wxTextCtrlNameStr );
57 bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "",
58 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
59 int style = 0, const wxValidator& validator = wxDefaultValidator,
60 const wxString &name = wxTextCtrlNameStr );
61 wxString GetValue() const;
62 void SetValue( const wxString &value );
63 void WriteText( const wxString &text );
64
65 bool LoadFile( const wxString &file );
66 bool SaveFile( const wxString &file );
67 bool IsModified() const { return m_modified; }
68 void SetModified() { m_modified = TRUE; }
69 void DiscardEdits() { m_modified = FALSE; }
70 /*
71 wxString GetLineText( long lineNo ) const;
72 void OnDropFiles( wxDropFilesEvent &event );
73 long PositionToXY( long pos, long *x, long *y ) const;
74 long XYToPosition( long x, long y );
75 int GetNumberOfLines();
76 */
77 virtual void SetInsertionPoint( long pos );
78 virtual void SetInsertionPointEnd();
79 virtual void SetEditable( bool editable );
80 virtual void SetSelection( long from, long to );
81 void ShowPosition( long pos );
82 virtual long GetInsertionPoint() const;
83 virtual long GetLastPosition() const;
84 virtual void Remove( long from, long to );
85 virtual void Replace( long from, long to, const wxString &value );
86 void Cut();
87 void Copy();
88 void Paste();
89 void Delete();
90
91 void OnChar( wxKeyEvent &event );
92
93 int overflow(int i);
94 int sync();
95 int underflow();
96
97 wxTextCtrl& operator<<(const wxString& s);
98 wxTextCtrl& operator<<(int i);
99 wxTextCtrl& operator<<(long i);
100 wxTextCtrl& operator<<(float f);
101 wxTextCtrl& operator<<(double d);
102 wxTextCtrl& operator<<(const char c);
103
104 virtual GtkWidget* GetConnectWidget(void);
105 virtual bool IsOwnGtkWindow( GdkWindow *window );
106
107 private:
108
109 bool m_modified;
110 GtkWidget *m_text;
111 };
112
113 #endif // __GTKTEXTCTRLH__
114
115