]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't generate AUINOTEBOOK_BG_DCLICK when clicking inactive arrow.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 May 2010 20:05:34 +0000 (20:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 May 2010 20:05:34 +0000 (20:05 +0000)
Clicking on a disabled arrow shouldn't do anything, in particular it shouldn't
generate a wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK event.

See #12084.

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

src/aui/auibook.cpp

index b3b443f62a829f3e532f5461dcaa79a52c8274b7..ac483df48634a2ef6e63676bac5d917097845903 100644 (file)
@@ -2051,7 +2051,7 @@ bool wxAuiTabContainer::TabHitTest(int x, int y, wxWindow** hit) const
         return false;
 
     wxAuiTabContainerButton* btn = NULL;
-    if (ButtonHitTest(x, y, &btn))
+    if (ButtonHitTest(x, y, &btn) && !(btn->cur_state & wxAUI_BUTTON_STATE_DISABLED))
     {
         if (m_buttons.Index(*btn) != wxNOT_FOUND)
             return false;
@@ -2089,8 +2089,7 @@ bool wxAuiTabContainer::ButtonHitTest(int x, int y,
     {
         wxAuiTabContainerButton& button = m_buttons.Item(i);
         if (button.rect.Contains(x,y) &&
-            !(button.cur_state & (wxAUI_BUTTON_STATE_HIDDEN |
-                                   wxAUI_BUTTON_STATE_DISABLED)))
+            !(button.cur_state & wxAUI_BUTTON_STATE_HIDDEN ))
         {
             if (hit)
                 *hit = &button;
@@ -2298,7 +2297,8 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt)
     {
         // make sure we're still clicking the button
         wxAuiTabContainerButton* button = NULL;
-        if (!ButtonHitTest(evt.m_x, evt.m_y, &button))
+        if (!ButtonHitTest(evt.m_x, evt.m_y, &button) ||
+            button->cur_state & wxAUI_BUTTON_STATE_DISABLED)
             return;
 
         if (button != m_pressed_button)
@@ -2393,7 +2393,7 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt)
 
     // check if the mouse is hovering above a button
     wxAuiTabContainerButton* button;
-    if (ButtonHitTest(pos.x, pos.y, &button))
+    if (ButtonHitTest(pos.x, pos.y, &button) && !(button->cur_state & wxAUI_BUTTON_STATE_DISABLED))
     {
         if (m_hover_button && button != m_hover_button)
         {