+bool wxTextCtrl::CanCopy() const
+{
+ // Can copy if there's a selection
+ long from, to;
+ GetSelection(& from, & to);
+ return (from != to) ;
+}
+
+bool wxTextCtrl::CanCut() const
+{
+ // Can cut if there's a selection
+ long from, to;
+ GetSelection(& from, & to);
+ return (from != to) ;
+}
+
+bool wxTextCtrl::CanPaste() const
+{
+ return IsEditable() ;
+}
+
+// Undo/redo
+void wxTextCtrl::Undo()
+{
+ // TODO
+ wxFAIL_MSG( _T("wxTextCtrl::Undo not implemented") );
+}
+
+void wxTextCtrl::Redo()
+{
+ // TODO
+ wxFAIL_MSG( _T("wxTextCtrl::Redo not implemented") );
+}
+
+bool wxTextCtrl::CanUndo() const
+{
+ // TODO
+ wxFAIL_MSG( _T("wxTextCtrl::CanUndo not implemented") );
+ return FALSE;
+}
+
+bool wxTextCtrl::CanRedo() const
+{
+ // TODO
+ wxFAIL_MSG( _T("wxTextCtrl::CanRedo not implemented") );
+ return FALSE;
+}
+
+// If the return values from and to are the same, there is no
+// selection.
+void wxTextCtrl::GetSelection(long* from, long* to) const
+{
+ wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
+
+ if (!(GTK_EDITABLE(m_text)->has_selection))
+ {
+ if (from) *from = 0;
+ if (to) *to = 0;
+ return;
+ }
+
+ if (from) *from = (long) GTK_EDITABLE(m_text)->selection_start_pos;
+ if (to) *to = (long) GTK_EDITABLE(m_text)->selection_end_pos;
+}
+
+bool wxTextCtrl::IsEditable() const
+{
+ wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
+
+ return GTK_EDITABLE(m_text)->editable;
+}
+