]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/textctrl.cpp
rtti api mods added
[wxWidgets.git] / src / os2 / textctrl.cpp
index a9e711e7b0b58659f535785ea2f5907cfc890491..679d0fa248cd56ac7bb8bb1da1306173bd09a3ea 100644 (file)
@@ -86,6 +86,10 @@ wxTextCtrl::wxTextCtrl()
 {
 }
 
 {
 }
 
+wxTextCtrl::~wxTextCtrl()
+{
+}
+
 bool wxTextCtrl::Create(
   wxWindow*                         pParent
 , wxWindowID                        vId
 bool wxTextCtrl::Create(
   wxWindow*                         pParent
 , wxWindowID                        vId
@@ -93,14 +97,13 @@ bool wxTextCtrl::Create(
 , const wxPoint&                    rPos
 , const wxSize&                     rSize
 , long                              lStyle
 , const wxPoint&                    rPos
 , const wxSize&                     rSize
 , long                              lStyle
-#if wxUSE_VALIDATORS
 , const wxValidator&                rValidator
 , const wxValidator&                rValidator
-#endif
 , const wxString&                   rsName
 )
 {
     HWND                            hParent;
     int                             nTempy;
 , const wxString&                   rsName
 )
 {
     HWND                            hParent;
     int                             nTempy;
+
     //
     // Base initialization
     //
     //
     // Base initialization
     //
@@ -109,9 +112,7 @@ bool wxTextCtrl::Create(
                      ,rPos
                      ,rSize
                      ,lStyle
                      ,rPos
                      ,rSize
                      ,lStyle
-#if wxUSE_VALIDATORS
                      ,rValidator
                      ,rValidator
-#endif
                      ,rsName
                     ))
         return FALSE;
                      ,rsName
                     ))
         return FALSE;
@@ -506,6 +507,15 @@ void wxTextCtrl::SetInsertionPointEnd()
 {
     long                            lPos = GetLastPosition();
 
 {
     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
 
     SetInsertionPoint(lPos);
 } // end of wxTextCtrl::SetInsertionPointEnd
 
@@ -1170,9 +1180,11 @@ void wxTextCtrl::AdjustSpaceLimit()
 bool wxTextCtrl::AcceptsFocus() const
 {
     //
 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
 } // end of wxTextCtrl::Command
 
 wxSize wxTextCtrl::DoGetBestSize() const
@@ -1232,6 +1244,29 @@ void wxTextCtrl::OnRedo(
     Redo();
 } // end of 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
 )
 void wxTextCtrl::OnUpdateCut(
   wxUpdateUIEvent&                  rEvent
 )
@@ -1267,6 +1302,26 @@ void wxTextCtrl::OnUpdateRedo(
     rEvent.Enable(CanRedo());
 } // end of 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
 )
 bool wxTextCtrl::SetBackgroundColour(
   const wxColour&                   rColour
 )