]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/textctrl.cpp
*** empty log message ***
[wxWidgets.git] / src / gtk / textctrl.cpp
index 73293accf3b0cdc0ed4c7c22f6f39f572c2c104c..51169aaa6041cc961bad5365132a393f2b3148dd 100644 (file)
@@ -137,7 +137,9 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
 
     PreCreation( parent, id, pos, size, style, name );
 
+#if wxUSE_VALIDATORS
     SetValidator( validator );
+#endif // wxUSE_VALIDATORS
 
     m_vScrollbarVisible = FALSE;
 
@@ -695,7 +697,7 @@ void wxTextCtrl::SetSelection( long from, long to )
 
 void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
 {
-    wxFAIL_MSG( _T("wxTextCtrl::ShowPosition not implemented") );
+//    SetInsertionPoint( pos );
 }
 
 long wxTextCtrl::GetInsertionPoint() const
@@ -825,17 +827,24 @@ bool wxTextCtrl::CanRedo() const
 // selection.
 void wxTextCtrl::GetSelection(long* from, long* to) const
 {
-    // TODO
-    *from = 0;
-    *to = 0;
-    wxFAIL_MSG( _T("wxTextCtrl::GetSelection not implemented") );
+    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
 {
-    // TODO
-    wxFAIL_MSG( _T("wxTextCtrl::IsEditable not implemented") );
-    return FALSE;
+    wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
+
+    return GTK_EDITABLE(m_text)->editable;
 }
 
 void wxTextCtrl::Clear()