]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/auibar.cpp
Fix --enable-webview_xxx options names in configure.
[wxWidgets.git] / src / aui / auibar.cpp
index fb62e3089436e8440d02f8db21179a7820bbb794..9cb1b9ab0a77ec7aa2e50b73b6fa45de6bcf556c 100644 (file)
@@ -1406,6 +1406,9 @@ bool wxAuiToolBar::SetFont(const wxFont& font)
 
 void wxAuiToolBar::SetHoverItem(wxAuiToolBarItem* pitem)
 {
 
 void wxAuiToolBar::SetHoverItem(wxAuiToolBarItem* pitem)
 {
+    if (pitem && (pitem->m_state & wxAUI_BUTTON_STATE_DISABLED))
+        pitem = NULL;
+
     wxAuiToolBarItem* former_hover = NULL;
 
     size_t i, count;
     wxAuiToolBarItem* former_hover = NULL;
 
     size_t i, count;
@@ -2150,7 +2153,7 @@ void wxAuiToolBar::DoIdleUpdate()
             {
                 bool is_enabled;
                 if (item.m_window)
             {
                 bool is_enabled;
                 if (item.m_window)
-                    is_enabled = item.m_window->IsEnabled();
+                    is_enabled = item.m_window->IsThisEnabled();
                 else
                     is_enabled = (item.m_state & wxAUI_BUTTON_STATE_DISABLED) ? false : true;
 
                 else
                     is_enabled = (item.m_state & wxAUI_BUTTON_STATE_DISABLED) ? false : true;
 
@@ -2580,6 +2583,11 @@ void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt)
         if(!GetEventHandler()->ProcessEvent(e) || e.GetSkipped())
             CaptureMouse();
 
         if(!GetEventHandler()->ProcessEvent(e) || e.GetSkipped())
             CaptureMouse();
 
+        // Ensure hovered item is really ok, as mouse may have moved during
+        //  event processing
+        wxPoint cursor_pos_after_evt = ScreenToClient(wxGetMousePosition());
+        SetHoverItem(FindToolByPosition(cursor_pos_after_evt.x, cursor_pos_after_evt.y));
+
         DoIdleUpdate();
     }
 }
         DoIdleUpdate();
     }
 }
@@ -2591,11 +2599,9 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt)
 
     SetPressedItem(NULL);
 
 
     SetPressedItem(NULL);
 
-    wxAuiToolBarItem* hitItem = FindToolByPosition(evt.GetX(), evt.GetY());
-    if (hitItem && !(hitItem->m_state & wxAUI_BUTTON_STATE_DISABLED))
-    {
-        SetHoverItem(hitItem);
-    }
+    wxAuiToolBarItem* hitItem;
+    hitItem = FindToolByPosition(evt.GetX(), evt.GetY());
+    SetHoverItem(hitItem);
 
     if (m_dragging)
     {
 
     if (m_dragging)
     {
@@ -2636,6 +2642,12 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt)
             ReleaseMouse();
 
             GetEventHandler()->ProcessEvent(e);
             ReleaseMouse();
 
             GetEventHandler()->ProcessEvent(e);
+
+            // Ensure hovered item is really ok, as mouse may have moved during
+            // event processing
+            wxPoint cursor_pos_after_evt = ScreenToClient(wxGetMousePosition());
+            SetHoverItem(FindToolByPosition(cursor_pos_after_evt.x, cursor_pos_after_evt.y));
+
             DoIdleUpdate();
         }
         else
             DoIdleUpdate();
         }
         else
@@ -2654,14 +2666,13 @@ void wxAuiToolBar::OnRightDown(wxMouseEvent& evt)
             return;
     }
 
             return;
     }
 
-    if (m_overflowSizerItem)
+    if (m_overflowSizerItem && m_art)
     {
         int dropdown_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE);
         if (dropdown_size > 0 &&
             evt.m_x > cli_rect.width - dropdown_size &&
             evt.m_y >= 0 &&
     {
         int dropdown_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE);
         if (dropdown_size > 0 &&
             evt.m_x > cli_rect.width - dropdown_size &&
             evt.m_y >= 0 &&
-            evt.m_y < cli_rect.height &&
-            m_art)
+            evt.m_y < cli_rect.height)
         {
             return;
         }
         {
             return;
         }
@@ -2721,14 +2732,13 @@ void wxAuiToolBar::OnMiddleDown(wxMouseEvent& evt)
             return;
     }
 
             return;
     }
 
-    if (m_overflowSizerItem)
+    if (m_overflowSizerItem && m_art)
     {
         int dropdown_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE);
         if (dropdown_size > 0 &&
             evt.m_x > cli_rect.width - dropdown_size &&
             evt.m_y >= 0 &&
     {
         int dropdown_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE);
         if (dropdown_size > 0 &&
             evt.m_x > cli_rect.width - dropdown_size &&
             evt.m_y >= 0 &&
-            evt.m_y < cli_rect.height &&
-            m_art)
+            evt.m_y < cli_rect.height)
         {
             return;
         }
         {
             return;
         }
@@ -2810,10 +2820,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
     }
     else
     {
     }
     else
     {
-        if (hitItem && (hitItem->m_state & wxAUI_BUTTON_STATE_DISABLED))
-            SetHoverItem(NULL);
-        else
-            SetHoverItem(hitItem);
+        SetHoverItem(hitItem);
 
         // tooltips handling
         wxAuiToolBarItem* packingHitItem;
 
         // tooltips handling
         wxAuiToolBarItem* packingHitItem;