]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/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 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
44 extern const char *wxTextCtrlNameStr
;
46 //-----------------------------------------------------------------------------
48 //-----------------------------------------------------------------------------
50 #if wxUSE_STD_IOSTREAM
51 class wxTextCtrl
: public wxControl
, public streambuf
53 class wxTextCtrl
: public wxControl
57 DECLARE_DYNAMIC_CLASS(wxTextCtrl
);
61 wxTextCtrl( wxWindow
*parent
, wxWindowID id
, const wxString
&value
= "",
62 const wxPoint
&pos
= wxDefaultPosition
, const wxSize
&size
= wxDefaultSize
,
63 int style
= 0, const wxValidator
& validator
= wxDefaultValidator
,
64 const wxString
&name
= wxTextCtrlNameStr
);
65 bool Create( 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 wxString
GetValue() const;
70 void SetValue( const wxString
&value
);
71 void WriteText( const wxString
&text
);
72 void AppendText( const wxString
&text
);
74 bool LoadFile( const wxString
&file
);
75 bool SaveFile( const wxString
&file
);
76 bool IsModified() const { return m_modified
; }
77 void SetModified() { m_modified
= TRUE
; }
78 void DiscardEdits() { m_modified
= FALSE
; }
79 wxString
GetLineText( long lineNo
) const;
80 void OnDropFiles( wxDropFilesEvent
&event
);
81 long PositionToXY( long pos
, long *x
, long *y
) const;
82 long XYToPosition( long x
, long y
) const;
83 int GetLineLength(long lineNo
) const;
84 int GetNumberOfLines() const;
85 virtual void SetInsertionPoint( long pos
);
86 virtual void SetInsertionPointEnd();
87 virtual void SetEditable( bool editable
);
88 virtual void SetSelection( long from
, long to
);
89 void ShowPosition( long pos
);
90 virtual long GetInsertionPoint() const;
91 virtual long GetLastPosition() const;
92 virtual void Remove( long from
, long to
);
93 virtual void Replace( long from
, long to
, const wxString
&value
);
99 virtual bool CanCopy() const;
100 virtual bool CanCut() const;
101 virtual bool CanPaste() const;
107 virtual bool CanUndo() const;
108 virtual bool CanRedo() const;
110 // If the return values from and to are the same, there is no
112 virtual void GetSelection(long* from
, long* to
) const;
113 virtual bool IsEditable() const ;
115 void OnChar( wxKeyEvent
&event
);
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
);
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
);
129 #if wxUSE_STD_IOSTREAM
135 wxTextCtrl
& operator<<(const wxString
& s
);
136 wxTextCtrl
& operator<<(int i
);
137 wxTextCtrl
& operator<<(long i
);
138 wxTextCtrl
& operator<<(float f
);
139 wxTextCtrl
& operator<<(double d
);
140 wxTextCtrl
& operator<<(const char c
);
142 bool SetFont( const wxFont
&font
);
143 bool SetForegroundColour(const wxColour
&colour
);
144 bool SetBackgroundColour(const wxColour
&colour
);
148 GtkWidget
* GetConnectWidget();
149 bool IsOwnGtkWindow( GdkWindow
*window
);
150 void ApplyWidgetStyle();
151 void CalculateScrollbar();
157 GtkWidget
*m_vScrollbar
;
158 bool m_vScrollbarVisible
;
161 #endif // __GTKTEXTCTRLH__