]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/textctrl.h
b480306b089d1f40c93a2aae5dc3565fd0d28ec4
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__
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 // load/save the controls contents from/to the file
66 virtual bool LoadFile(const wxString
& file
);
67 virtual bool SaveFile(const wxString
& file
);
69 // clears the dirty flag
70 virtual void DiscardEdits();
72 // writing text inserts it at the current position, appending always
73 // inserts it at the end
74 virtual void WriteText(const wxString
& text
);
75 virtual void AppendText(const wxString
& text
);
77 // translate between the position (which is just an index in the text ctrl
78 // considering all its contents as a single strings) and (x, y) coordinates
79 // which represent column and line.
80 virtual long XYToPosition(long x
, long y
) const;
81 virtual void PositionToXY(long pos
, long *x
, long *y
) const;
83 virtual void ShowPosition(long pos
);
85 // Clipboard operations
90 virtual bool CanCopy() const;
91 virtual bool CanCut() const;
92 virtual bool CanPaste() const;
98 virtual bool CanUndo() const;
99 virtual bool CanRedo() const;
102 virtual void SetInsertionPoint(long pos
);
103 virtual void SetInsertionPointEnd();
104 virtual long GetInsertionPoint() const;
105 virtual long GetLastPosition() const;
107 virtual void SetSelection(long from
, long to
);
108 virtual void SetEditable(bool editable
);
110 // Implementation from now on
111 void OnDropFiles( wxDropFilesEvent
&event
);
112 void OnChar( wxKeyEvent
&event
);
114 void OnCut(wxCommandEvent
& event
);
115 void OnCopy(wxCommandEvent
& event
);
116 void OnPaste(wxCommandEvent
& event
);
117 void OnUndo(wxCommandEvent
& event
);
118 void OnRedo(wxCommandEvent
& event
);
120 void OnUpdateCut(wxUpdateUIEvent
& event
);
121 void OnUpdateCopy(wxUpdateUIEvent
& event
);
122 void OnUpdatePaste(wxUpdateUIEvent
& event
);
123 void OnUpdateUndo(wxUpdateUIEvent
& event
);
124 void OnUpdateRedo(wxUpdateUIEvent
& event
);
126 bool SetFont( const wxFont
&font
);
127 bool SetForegroundColour(const wxColour
&colour
);
128 bool SetBackgroundColour(const wxColour
&colour
);
130 GtkWidget
* GetConnectWidget();
131 bool IsOwnGtkWindow( GdkWindow
*window
);
132 void ApplyWidgetStyle();
133 void CalculateScrollbar();
138 GtkWidget
*m_vScrollbar
;
139 bool m_vScrollbarVisible
;
141 DECLARE_EVENT_TABLE()
142 DECLARE_DYNAMIC_CLASS(wxTextCtrl
);
145 #endif // __GTKTEXTCTRLH__