]> git.saurik.com Git - wxWidgets.git/commitdiff
Improved wxTreeCtrl tooltip processing performance (causing
authorJulian Smart <julian@anthemion.co.uk>
Sun, 7 Mar 2004 17:28:36 +0000 (17:28 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 7 Mar 2004 17:28:36 +0000 (17:28 +0000)
major delays in processing button clicks)
Added wxFULL_REPAINT_ON_RESIZE as default for wxStatusBar
on wxGTK since otherwise there are display problems.
Similarly for wxGrid.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26132 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/frame.h
include/wx/generic/statusbr.h
include/wx/generic/treectlg.h
include/wx/gtk/frame.h
include/wx/gtk1/frame.h
src/generic/grid.cpp
src/generic/treectlg.cpp

index e202679bb9b1a6800a9b265db0724479c06934f1..ee270269f75ea4f4c35816b452ff69f0497ed870 100644 (file)
@@ -89,7 +89,7 @@ public:
 #if wxUSE_STATUSBAR
     // create the main status bar by calling OnCreateStatusBar()
     virtual wxStatusBar* CreateStatusBar(int number = 1,
 #if wxUSE_STATUSBAR
     // create the main status bar by calling OnCreateStatusBar()
     virtual wxStatusBar* CreateStatusBar(int number = 1,
-                                         long style = wxST_SIZEGRIP,
+                                         long style = wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE,
                                          wxWindowID winid = 0,
                                          const wxString& name =
                                             wxStatusLineNameStr);
                                          wxWindowID winid = 0,
                                          const wxString& name =
                                             wxStatusLineNameStr);
index c36a0c7cdcc3c30a8b3592b6c243566cfa0d6ce6..364c1b3d0b013d1e806829b559e9d7fa94dbafe4 100644 (file)
@@ -31,7 +31,7 @@ public:
               wxWindowID winid,
               const wxPoint& pos = wxDefaultPosition,
               const wxSize& size = wxDefaultSize,
               wxWindowID winid,
               const wxPoint& pos = wxDefaultPosition,
               const wxSize& size = wxDefaultSize,
-              long style = 0,
+              long style = wxFULL_REPAINT_ON_RESIZE,
               const wxString& name = wxPanelNameStr)
   {
       Init();
               const wxString& name = wxPanelNameStr)
   {
       Init();
@@ -53,7 +53,7 @@ public:
   bool Create(wxWindow *parent, wxWindowID winid,
               const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
               const wxSize& WXUNUSED(size) = wxDefaultSize,
   bool Create(wxWindow *parent, wxWindowID winid,
               const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
               const wxSize& WXUNUSED(size) = wxDefaultSize,
-              long style = 0,
+              long style = wxFULL_REPAINT_ON_RESIZE,
               const wxString& name = wxPanelNameStr)
   {
       return Create(parent, winid, style, name);
               const wxString& name = wxPanelNameStr)
   {
       return Create(parent, winid, style, name);
index b8aa298b8b68fcc6044abec86d11746ce97388c2..f82e154ac7bf2bafd85cf2509abf28a651c79591 100644 (file)
@@ -384,6 +384,7 @@ public:
     void OnKillFocus( wxFocusEvent &event );
     void OnChar( wxKeyEvent &event );
     void OnMouse( wxMouseEvent &event );
     void OnKillFocus( wxFocusEvent &event );
     void OnChar( wxKeyEvent &event );
     void OnMouse( wxMouseEvent &event );
+    void OnGetToolTip( wxTreeEvent &event );
     void OnInternalIdle( );
 
     // implementation helpers
     void OnInternalIdle( );
 
     // implementation helpers
index 3c452d5451bae88e718a7085db3bdbc4dea36915..ecb5d0d02ad8f3214cb7761d85155302cc234ea5 100644 (file)
@@ -62,7 +62,7 @@ public:
     virtual void PositionStatusBar();
 
     virtual wxStatusBar* CreateStatusBar(int number = 1,
     virtual void PositionStatusBar();
 
     virtual wxStatusBar* CreateStatusBar(int number = 1,
-                                         long style = wxST_SIZEGRIP,
+                                         long style = wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE,
                                          wxWindowID id = 0,
                                          const wxString& name = wxStatusLineNameStr);
 #endif // wxUSE_STATUSBAR
                                          wxWindowID id = 0,
                                          const wxString& name = wxStatusLineNameStr);
 #endif // wxUSE_STATUSBAR
index 3c452d5451bae88e718a7085db3bdbc4dea36915..ecb5d0d02ad8f3214cb7761d85155302cc234ea5 100644 (file)
@@ -62,7 +62,7 @@ public:
     virtual void PositionStatusBar();
 
     virtual wxStatusBar* CreateStatusBar(int number = 1,
     virtual void PositionStatusBar();
 
     virtual wxStatusBar* CreateStatusBar(int number = 1,
-                                         long style = wxST_SIZEGRIP,
+                                         long style = wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE,
                                          wxWindowID id = 0,
                                          const wxString& name = wxStatusLineNameStr);
 #endif // wxUSE_STATUSBAR
                                          wxWindowID id = 0,
                                          const wxString& name = wxStatusLineNameStr);
 #endif // wxUSE_STATUSBAR
index 74de24b9f7a24a16e21e8955aab49ef780ae27eb..ee086a77c8aa5361a5e22e4e0c967216db8baa8c 100644 (file)
@@ -3479,7 +3479,7 @@ END_EVENT_TABLE()
 wxGridRowLabelWindow::wxGridRowLabelWindow( wxGrid *parent,
                                             wxWindowID id,
                                             const wxPoint &pos, const wxSize &size )
 wxGridRowLabelWindow::wxGridRowLabelWindow( wxGrid *parent,
                                             wxWindowID id,
                                             const wxPoint &pos, const wxSize &size )
-  : wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE )
+  : wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE )
 {
     m_owner = parent;
 }
 {
     m_owner = parent;
 }
@@ -3545,7 +3545,7 @@ END_EVENT_TABLE()
 wxGridColLabelWindow::wxGridColLabelWindow( wxGrid *parent,
                                             wxWindowID id,
                                             const wxPoint &pos, const wxSize &size )
 wxGridColLabelWindow::wxGridColLabelWindow( wxGrid *parent,
                                             wxWindowID id,
                                             const wxPoint &pos, const wxSize &size )
-  : wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE )
+  : wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE )
 {
     m_owner = parent;
 }
 {
     m_owner = parent;
 }
@@ -3610,7 +3610,7 @@ END_EVENT_TABLE()
 wxGridCornerLabelWindow::wxGridCornerLabelWindow( wxGrid *parent,
                                                   wxWindowID id,
                                                   const wxPoint &pos, const wxSize &size )
 wxGridCornerLabelWindow::wxGridCornerLabelWindow( wxGrid *parent,
                                                   wxWindowID id,
                                                   const wxPoint &pos, const wxSize &size )
-  : wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE )
+  : wxWindow( parent, id, pos, size, wxWANTS_CHARS|wxBORDER_NONE|wxFULL_REPAINT_ON_RESIZE )
 {
     m_owner = parent;
 }
 {
     m_owner = parent;
 }
@@ -3682,7 +3682,7 @@ wxGridWindow::wxGridWindow( wxGrid *parent,
                             wxWindowID id,
                             const wxPoint &pos,
                             const wxSize &size )
                             wxWindowID id,
                             const wxPoint &pos,
                             const wxSize &size )
-            : wxWindow( parent, id, pos, size, wxWANTS_CHARS | wxBORDER_NONE | wxCLIP_CHILDREN,
+            : wxWindow( parent, id, pos, size, wxWANTS_CHARS | wxBORDER_NONE | wxCLIP_CHILDREN|wxFULL_REPAINT_ON_RESIZE,
                         wxT("grid window") )
 
 {
                         wxT("grid window") )
 
 {
index bf31859dd7dcd03a53c971f4c4f4c9ab5bca51a9..4e79785c025ea9836ef03d218d4dfa8da8f31924 100644 (file)
@@ -674,6 +674,7 @@ BEGIN_EVENT_TABLE(wxGenericTreeCtrl,wxScrolledWindow)
     EVT_CHAR           (wxGenericTreeCtrl::OnChar)
     EVT_SET_FOCUS      (wxGenericTreeCtrl::OnSetFocus)
     EVT_KILL_FOCUS     (wxGenericTreeCtrl::OnKillFocus)
     EVT_CHAR           (wxGenericTreeCtrl::OnChar)
     EVT_SET_FOCUS      (wxGenericTreeCtrl::OnSetFocus)
     EVT_KILL_FOCUS     (wxGenericTreeCtrl::OnKillFocus)
+    EVT_TREE_ITEM_GETTOOLTIP(-1, wxGenericTreeCtrl::OnGetToolTip)
 END_EVENT_TABLE()
 
 #if !defined(__WXMSW__) || defined(__WIN16__) || defined(__WXUNIVERSAL__)
 END_EVENT_TABLE()
 
 #if !defined(__WXMSW__) || defined(__WIN16__) || defined(__WXUNIVERSAL__)
@@ -2882,7 +2883,10 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
     
     // Is the mouse over a tree item button?
     int flags = 0;
     
     // Is the mouse over a tree item button?
     int flags = 0;
-    wxGenericTreeItem *underMouse = m_anchor->HitTest(pt, this, flags, 0);
+    wxGenericTreeItem *thisItem = m_anchor->HitTest(pt, this, flags, 0);
+    wxGenericTreeItem *underMouse = thisItem;
+    bool underMouseChanged = (underMouse != m_underMouse) ;
+
     if ((underMouse) &&
         (flags & wxTREE_HITTEST_ONITEMBUTTON) &&
         (!event.LeftIsDown()) &&
     if ((underMouse) &&
         (flags & wxTREE_HITTEST_ONITEMBUTTON) &&
         (!event.LeftIsDown()) &&
@@ -2912,10 +2916,10 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
 
 #if wxUSE_TOOLTIPS
     // Determines what item we are hovering over and need a tooltip for
 
 #if wxUSE_TOOLTIPS
     // Determines what item we are hovering over and need a tooltip for
-    wxTreeItemId hoverItem = HitTest(ScreenToClient(wxGetMousePosition()));
+    wxTreeItemId hoverItem = thisItem;
 
     // We do not want a tooltip if we are dragging, or if the rename timer is running
 
     // We do not want a tooltip if we are dragging, or if the rename timer is running
-    if (hoverItem.IsOk() && !m_isDragging  && (!m_renameTimer || !m_renameTimer->IsRunning()))
+    if (underMouseChanged && hoverItem.IsOk() && !m_isDragging && (!m_renameTimer || !m_renameTimer->IsRunning()))
     {
         // Ask the tree control what tooltip (if any) should be shown
         wxTreeEvent hevent(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, GetId());
     {
         // Ask the tree control what tooltip (if any) should be shown
         wxTreeEvent hevent(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, GetId());
@@ -3365,4 +3369,11 @@ bool wxGenericTreeCtrl::SetForegroundColour(const wxColour& colour)
     return TRUE;
 }
 
     return TRUE;
 }
 
+// Process the tooltip event, to speed up event processing.
+// Doesn't actually get a tooltip.
+void wxGenericTreeCtrl::OnGetToolTip( wxTreeEvent &event )
+{
+    event.Veto();
+}
+
 #endif // wxUSE_TREECTRL
 #endif // wxUSE_TREECTRL