button bug fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43185 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -456,6 +456,7 @@ protected:
|
|||||||
wxWindow* m_click_tab;
|
wxWindow* m_click_tab;
|
||||||
bool m_is_dragging;
|
bool m_is_dragging;
|
||||||
wxAuiTabContainerButton* m_hover_button;
|
wxAuiTabContainerButton* m_hover_button;
|
||||||
|
wxAuiTabContainerButton* m_pressed_button;
|
||||||
|
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
DECLARE_CLASS(wxAuiTabCtrl)
|
DECLARE_CLASS(wxAuiTabCtrl)
|
||||||
|
@@ -1834,6 +1834,7 @@ wxAuiTabCtrl::wxAuiTabCtrl(wxWindow* parent,
|
|||||||
m_click_pt = wxDefaultPosition;
|
m_click_pt = wxDefaultPosition;
|
||||||
m_is_dragging = false;
|
m_is_dragging = false;
|
||||||
m_hover_button = NULL;
|
m_hover_button = NULL;
|
||||||
|
m_pressed_button = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxAuiTabCtrl::~wxAuiTabCtrl()
|
wxAuiTabCtrl::~wxAuiTabCtrl()
|
||||||
@@ -1867,14 +1868,12 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt)
|
|||||||
m_click_pt = wxDefaultPosition;
|
m_click_pt = wxDefaultPosition;
|
||||||
m_is_dragging = false;
|
m_is_dragging = false;
|
||||||
m_click_tab = NULL;
|
m_click_tab = NULL;
|
||||||
|
m_pressed_button = NULL;
|
||||||
|
|
||||||
|
|
||||||
wxWindow* wnd;
|
wxWindow* wnd;
|
||||||
if (TabHitTest(evt.m_x, evt.m_y, &wnd))
|
if (TabHitTest(evt.m_x, evt.m_y, &wnd))
|
||||||
{
|
{
|
||||||
if (m_flags & wxAUI_NB_CLOSE_ON_ACTIVE_TAB)
|
|
||||||
m_hover_button = NULL;
|
|
||||||
|
|
||||||
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId);
|
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId);
|
||||||
e.SetSelection(GetIdxFromWindow(wnd));
|
e.SetSelection(GetIdxFromWindow(wnd));
|
||||||
e.SetOldSelection(GetActivePage());
|
e.SetOldSelection(GetActivePage());
|
||||||
@@ -1888,13 +1887,14 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt)
|
|||||||
|
|
||||||
if (m_hover_button)
|
if (m_hover_button)
|
||||||
{
|
{
|
||||||
m_hover_button->cur_state = wxAUI_BUTTON_STATE_PRESSED;
|
m_pressed_button = m_hover_button;
|
||||||
|
m_pressed_button->cur_state = wxAUI_BUTTON_STATE_PRESSED;
|
||||||
Refresh();
|
Refresh();
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxAuiTabCtrl::OnLeftUp(wxMouseEvent&)
|
void wxAuiTabCtrl::OnLeftUp(wxMouseEvent& evt)
|
||||||
{
|
{
|
||||||
if (GetCapture() == this)
|
if (GetCapture() == this)
|
||||||
ReleaseMouse();
|
ReleaseMouse();
|
||||||
@@ -1909,19 +1909,31 @@ void wxAuiTabCtrl::OnLeftUp(wxMouseEvent&)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_hover_button)
|
if (m_pressed_button)
|
||||||
{
|
{
|
||||||
m_hover_button->cur_state = wxAUI_BUTTON_STATE_HOVER;
|
// make sure we're still clicking the button
|
||||||
|
wxAuiTabContainerButton* button = NULL;
|
||||||
|
if (!ButtonHitTest(evt.m_x, evt.m_y, &button))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (button != m_pressed_button)
|
||||||
|
{
|
||||||
|
m_pressed_button = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
Update();
|
Update();
|
||||||
|
|
||||||
if (!(m_hover_button->cur_state & wxAUI_BUTTON_STATE_DISABLED))
|
if (!(m_pressed_button->cur_state & wxAUI_BUTTON_STATE_DISABLED))
|
||||||
{
|
{
|
||||||
wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId);
|
wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId);
|
||||||
evt.SetInt(m_hover_button->id);
|
evt.SetInt(m_pressed_button->id);
|
||||||
evt.SetEventObject(this);
|
evt.SetEventObject(this);
|
||||||
GetEventHandler()->ProcessEvent(evt);
|
GetEventHandler()->ProcessEvent(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_pressed_button = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_click_pt = wxDefaultPosition;
|
m_click_pt = wxDefaultPosition;
|
||||||
|
Reference in New Issue
Block a user