]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/textctrl.h
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __GTKTEXTCTRLH__
13 #define __GTKTEXTCTRLH__
20 #include "wx/object.h"
21 #include "wx/string.h"
22 #include "wx/control.h"
24 #if wxUSE_STD_IOSTREAM
34 #define NO_TEXT_WINDOW_STREAM
38 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
46 //-----------------------------------------------------------------------------
48 extern const char *wxTextCtrlNameStr
;
50 //-----------------------------------------------------------------------------
52 //-----------------------------------------------------------------------------
54 #ifndef NO_TEXT_WINDOW_STREAM
55 class wxTextCtrl
: public wxControl
, public streambuf
57 class wxTextCtrl
: public wxControl
61 DECLARE_DYNAMIC_CLASS(wxTextCtrl
);
65 wxTextCtrl( wxWindow
*parent
, wxWindowID id
, const wxString
&value
= "",
66 const wxPoint
&pos
= wxDefaultPosition
, const wxSize
&size
= wxDefaultSize
,
67 int style
= 0, const wxValidator
& validator
= wxDefaultValidator
,
68 const wxString
&name
= wxTextCtrlNameStr
);
69 bool Create( wxWindow
*parent
, wxWindowID id
, const wxString
&value
= "",
70 const wxPoint
&pos
= wxDefaultPosition
, const wxSize
&size
= wxDefaultSize
,
71 int style
= 0, const wxValidator
& validator
= wxDefaultValidator
,
72 const wxString
&name
= wxTextCtrlNameStr
);
73 wxString
GetValue() const;
74 void SetValue( const wxString
&value
);
75 void WriteText( const wxString
&text
);
77 bool LoadFile( const wxString
&file
);
78 bool SaveFile( const wxString
&file
);
79 bool IsModified() const { return m_modified
; }
80 void SetModified() { m_modified
= TRUE
; }
81 void DiscardEdits() { m_modified
= FALSE
; }
82 wxString
GetLineText( long lineNo
) const;
83 void OnDropFiles( wxDropFilesEvent
&event
);
84 long PositionToXY( long pos
, long *x
, long *y
) const;
85 long XYToPosition( long x
, long y
) const;
86 int GetLineLength(long lineNo
) const;
87 int GetNumberOfLines() const;
88 virtual void SetInsertionPoint( long pos
);
89 virtual void SetInsertionPointEnd();
90 virtual void SetEditable( bool editable
);
91 virtual void SetSelection( long from
, long to
);
92 void ShowPosition( long pos
);
93 virtual long GetInsertionPoint() const;
94 virtual long GetLastPosition() const;
95 virtual void Remove( long from
, long to
);
96 virtual void Replace( long from
, long to
, const wxString
&value
);
102 void OnChar( wxKeyEvent
&event
);
104 #ifndef NO_TEXT_WINDOW_STREAM
109 wxTextCtrl
& operator<<(const wxString
& s
);
110 wxTextCtrl
& operator<<(int i
);
111 wxTextCtrl
& operator<<(long i
);
112 wxTextCtrl
& operator<<(float f
);
113 wxTextCtrl
& operator<<(double d
);
114 wxTextCtrl
& operator<<(const char c
);
117 void SetFont( const wxFont
&font
);
118 void SetForegroundColour(const wxColour
&colour
);
119 void SetBackgroundColour(const wxColour
&colour
);
123 GtkWidget
* GetConnectWidget();
124 bool IsOwnGtkWindow( GdkWindow
*window
);
125 void ApplyWidgetStyle();
126 void CalculateScrollbar();
132 GtkWidget
*m_vScrollbar
;
133 bool m_vScrollbarVisible
;
136 #endif // __GTKTEXTCTRLH__