]>
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
);
76 void AppendText( const wxString
&text
);
78 bool LoadFile( const wxString
&file
);
79 bool SaveFile( const wxString
&file
);
80 bool IsModified() const { return m_modified
; }
81 void SetModified() { m_modified
= TRUE
; }
82 void DiscardEdits() { m_modified
= FALSE
; }
83 wxString
GetLineText( long lineNo
) const;
84 void OnDropFiles( wxDropFilesEvent
&event
);
85 long PositionToXY( long pos
, long *x
, long *y
) const;
86 long XYToPosition( long x
, long y
) const;
87 int GetLineLength(long lineNo
) const;
88 int GetNumberOfLines() const;
89 virtual void SetInsertionPoint( long pos
);
90 virtual void SetInsertionPointEnd();
91 virtual void SetEditable( bool editable
);
92 virtual void SetSelection( long from
, long to
);
93 void ShowPosition( long pos
);
94 virtual long GetInsertionPoint() const;
95 virtual long GetLastPosition() const;
96 virtual void Remove( long from
, long to
);
97 virtual void Replace( long from
, long to
, const wxString
&value
);
103 virtual bool CanCopy() const;
104 virtual bool CanCut() const;
105 virtual bool CanPaste() const;
111 virtual bool CanUndo() const;
112 virtual bool CanRedo() const;
114 // If the return values from and to are the same, there is no
116 virtual void GetSelection(long* from
, long* to
) const;
117 virtual bool IsEditable() const ;
119 void OnChar( wxKeyEvent
&event
);
121 void OnCut(wxCommandEvent
& event
);
122 void OnCopy(wxCommandEvent
& event
);
123 void OnPaste(wxCommandEvent
& event
);
124 void OnUndo(wxCommandEvent
& event
);
125 void OnRedo(wxCommandEvent
& event
);
127 void OnUpdateCut(wxUpdateUIEvent
& event
);
128 void OnUpdateCopy(wxUpdateUIEvent
& event
);
129 void OnUpdatePaste(wxUpdateUIEvent
& event
);
130 void OnUpdateUndo(wxUpdateUIEvent
& event
);
131 void OnUpdateRedo(wxUpdateUIEvent
& event
);
133 #ifndef NO_TEXT_WINDOW_STREAM
138 wxTextCtrl
& operator<<(const wxString
& s
);
139 wxTextCtrl
& operator<<(int i
);
140 wxTextCtrl
& operator<<(long i
);
141 wxTextCtrl
& operator<<(float f
);
142 wxTextCtrl
& operator<<(double d
);
143 wxTextCtrl
& operator<<(const char c
);
146 bool SetFont( const wxFont
&font
);
147 bool SetForegroundColour(const wxColour
&colour
);
148 bool SetBackgroundColour(const wxColour
&colour
);
152 GtkWidget
* GetConnectWidget();
153 bool IsOwnGtkWindow( GdkWindow
*window
);
154 void ApplyWidgetStyle();
155 void CalculateScrollbar();
161 GtkWidget
*m_vScrollbar
;
162 bool m_vScrollbarVisible
;
165 #endif // __GTKTEXTCTRLH__