]>
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 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __GTKTEXTCTRLH__
12 #define __GTKTEXTCTRLH__
15 #pragma interface "textctrl.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
28 class wxTextCtrl
: public wxTextCtrlBase
32 wxTextCtrl( wxWindow
*parent
, wxWindowID id
, const wxString
&value
= "",
33 const wxPoint
&pos
= wxDefaultPosition
, const wxSize
&size
= wxDefaultSize
,
34 int style
= 0, const wxValidator
& validator
= wxDefaultValidator
,
35 const wxString
&name
= wxTextCtrlNameStr
);
36 bool Create( wxWindow
*parent
, wxWindowID id
, const wxString
&value
= "",
37 const wxPoint
&pos
= wxDefaultPosition
, const wxSize
&size
= wxDefaultSize
,
38 int style
= 0, const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
&name
= wxTextCtrlNameStr
);
41 // implement base class pure virtuals
42 // ----------------------------------
44 virtual wxString
GetValue() const;
45 virtual void SetValue(const wxString
& value
);
47 virtual int GetLineLength(long lineNo
) const;
48 virtual wxString
GetLineText(long lineNo
) const;
49 virtual int GetNumberOfLines() const;
51 virtual bool IsModified() const;
52 virtual bool IsEditable() const;
54 // If the return values from and to are the same, there is no selection.
55 virtual void GetSelection(long* from
, long* to
) const;
62 virtual void Replace(long from
, long to
, const wxString
& value
);
63 virtual void Remove(long from
, long to
);
65 // clears the dirty flag
66 virtual void DiscardEdits();
68 // writing text inserts it at the current position, appending always
69 // inserts it at the end
70 virtual void WriteText(const wxString
& text
);
71 virtual void AppendText(const wxString
& text
);
73 // translate between the position (which is just an index in the text ctrl
74 // considering all its contents as a single strings) and (x, y) coordinates
75 // which represent column and line.
76 virtual long XYToPosition(long x
, long y
) const;
77 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
79 virtual void ShowPosition(long pos
);
81 // Clipboard operations
86 virtual bool CanCopy() const;
87 virtual bool CanCut() const;
88 virtual bool CanPaste() const;
94 virtual bool CanUndo() const;
95 virtual bool CanRedo() const;
98 virtual void SetInsertionPoint(long pos
);
99 virtual void SetInsertionPointEnd();
100 virtual long GetInsertionPoint() const;
101 virtual long GetLastPosition() const;
103 virtual void SetSelection(long from
, long to
);
104 virtual void SetEditable(bool editable
);
106 // Implementation from now on
107 void OnDropFiles( wxDropFilesEvent
&event
);
108 void OnChar( wxKeyEvent
&event
);
110 void OnCut(wxCommandEvent
& event
);
111 void OnCopy(wxCommandEvent
& event
);
112 void OnPaste(wxCommandEvent
& event
);
113 void OnUndo(wxCommandEvent
& event
);
114 void OnRedo(wxCommandEvent
& event
);
116 void OnUpdateCut(wxUpdateUIEvent
& event
);
117 void OnUpdateCopy(wxUpdateUIEvent
& event
);
118 void OnUpdatePaste(wxUpdateUIEvent
& event
);
119 void OnUpdateUndo(wxUpdateUIEvent
& event
);
120 void OnUpdateRedo(wxUpdateUIEvent
& event
);
122 bool SetFont( const wxFont
&font
);
123 bool SetForegroundColour(const wxColour
&colour
);
124 bool SetBackgroundColour(const wxColour
&colour
);
126 GtkWidget
* GetConnectWidget();
127 bool IsOwnGtkWindow( GdkWindow
*window
);
128 void ApplyWidgetStyle();
129 void CalculateScrollbar();
130 void OnInternalIdle();
132 void SetModified() { m_modified
= TRUE
; }
135 virtual wxSize
DoGetBestSize() const;
140 GtkWidget
*m_vScrollbar
;
141 bool m_vScrollbarVisible
;
143 DECLARE_EVENT_TABLE()
144 DECLARE_DYNAMIC_CLASS(wxTextCtrl
);
147 #endif // __GTKTEXTCTRLH__