]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/textctrl.cpp
added sample showing how to use custom renderers and load them from DLL
[wxWidgets.git] / src / os2 / textctrl.cpp
index 9d38365087f2a2a123a24961c9cb645625a8c510..679d0fa248cd56ac7bb8bb1da1306173bd09a3ea 100644 (file)
@@ -86,6 +86,10 @@ wxTextCtrl::wxTextCtrl()
 {
 }
 
+wxTextCtrl::~wxTextCtrl()
+{
+}
+
 bool wxTextCtrl::Create(
   wxWindow*                         pParent
 , wxWindowID                        vId
@@ -93,9 +97,7 @@ bool wxTextCtrl::Create(
 , const wxPoint&                    rPos
 , const wxSize&                     rSize
 , long                              lStyle
-#if wxUSE_VALIDATORS
 , const wxValidator&                rValidator
-#endif
 , const wxString&                   rsName
 )
 {
@@ -110,9 +112,7 @@ bool wxTextCtrl::Create(
                      ,rPos
                      ,rSize
                      ,lStyle
-#if wxUSE_VALIDATORS
                      ,rValidator
-#endif
                      ,rsName
                     ))
         return FALSE;
@@ -507,6 +507,15 @@ void wxTextCtrl::SetInsertionPointEnd()
 {
     long                            lPos = GetLastPosition();
 
+    //
+    // We must not do anything if the caret is already there because calling
+    // SetInsertionPoint() thaws the controls if Freeze() had been called even
+    // if it doesn't actually move the caret anywhere and so the simple fact of
+    // doing it results in horrible flicker when appending big amounts of text
+    // to the control in a few chunks (see DoAddText() test in the text sample)
+    //
+    if (GetInsertionPoint() == GetLastPosition())
+        return;
     SetInsertionPoint(lPos);
 } // end of wxTextCtrl::SetInsertionPointEnd
 
@@ -1171,9 +1180,11 @@ void wxTextCtrl::AdjustSpaceLimit()
 bool wxTextCtrl::AcceptsFocus() const
 {
     //
-    // We don't want focus if we can't be edited
+    // We don't want focus if we can't be edited unless we're a multiline
+    // control because then it might be still nice to get focus from keyboard
+    // to be able to scroll it without mouse
     //
-    return IsEditable() && wxControl::AcceptsFocus();
+    return (IsEditable() || IsMultiLine()) && wxControl::AcceptsFocus();
 } // end of wxTextCtrl::Command
 
 wxSize wxTextCtrl::DoGetBestSize() const
@@ -1233,6 +1244,29 @@ void wxTextCtrl::OnRedo(
     Redo();
 } // end of wxTextCtrl::OnRedo
 
+void wxTextCtrl::OnDelete(
+  wxCommandEvent&                   rEvent
+)
+{
+    long                            lFrom;
+    long                            lTo;
+
+    GetSelection( &lFrom
+                 ,&lTo
+                );
+    if (lFrom != -1 && lTo != -1)
+        Remove( lFrom
+               ,lTo
+              );
+} // end of wxTextCtrl::OnDelete
+
+void wxTextCtrl::OnSelectAll(
+  wxCommandEvent&                   rEvent
+)
+{
+    SetSelection(-1, -1);
+} // end of wxTextCtrl::OnSelectAll
+
 void wxTextCtrl::OnUpdateCut(
   wxUpdateUIEvent&                  rEvent
 )
@@ -1268,6 +1302,26 @@ void wxTextCtrl::OnUpdateRedo(
     rEvent.Enable(CanRedo());
 } // end of wxTextCtrl::OnUpdateRedo
 
+void wxTextCtrl::OnUpdateDelete(
+  wxUpdateUIEvent&                  rEvent
+)
+{
+    long                            lFrom;
+    long                            lTo;
+
+    GetSelection( &lFrom
+                 ,&lTo
+                );
+    rEvent.Enable( lFrom != -1L && lTo != -1L && lFrom != lTo && IsEditable()) ;
+} // end of wxTextCtrl::OnUpdateDelete
+
+void wxTextCtrl::OnUpdateSelectAll(
+  wxUpdateUIEvent&                  rEvent
+)
+{
+    rEvent.Enable(GetLastPosition() > 0);
+} // end of wxTextCtrl::OnUpdateSelectAll
+
 bool wxTextCtrl::SetBackgroundColour(
   const wxColour&                   rColour
 )