]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/textentrycmn.cpp
Added detection of vsscanf and whether or not a prototype exists in headers.
[wxWidgets.git] / src / common / textentrycmn.cpp
index 67443dcdad8e91dfa18cd1784f1a2e8c6f3bf2bf..c6b769601e4256fe2863a0afcb8c347c5b32a15c 100644 (file)
 #if wxUSE_TEXTCTRL || wxUSE_COMBOBOX
 
 #ifndef WX_PRECOMP
+    #include "wx/window.h"
+    #include "wx/dataobj.h"
 #endif //WX_PRECOMP
 
 #include "wx/textentry.h"
+#include "wx/clipbrd.h"
 
 // ============================================================================
 // wxTextEntryBase implementation
@@ -77,6 +80,14 @@ bool wxTextEntryBase::HasSelection() const
     return from < to;
 }
 
+void wxTextEntryBase::RemoveSelection()
+{
+    long from, to;
+    GetSelection(& from, & to);
+    if (from != -1 && to != -1)
+        Remove(from, to);
+}
+
 wxString wxTextEntryBase::GetStringSelection() const
 {
     long from, to;
@@ -97,7 +108,22 @@ bool wxTextEntryBase::CanCut() const
 
 bool wxTextEntryBase::CanPaste() const
 {
-    return IsEditable();
+    if ( IsEditable() )
+    {
+#if wxUSE_CLIPBOARD
+        // check if there is any text on the clipboard
+        if ( wxTheClipboard->IsSupported(wxDF_TEXT)
+#if wxUSE_UNICODE
+                || wxTheClipboard->IsSupported(wxDF_UNICODETEXT)
+#endif // wxUSE_UNICODE
+           )
+        {
+            return true;
+        }
+#endif // wxUSE_CLIPBOARD
+    }
+
+    return false;
 }
 
 #endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX