Fix problem changing tabs with the mouse wheel

This commit is contained in:
David Capello 2015-02-25 09:00:19 -03:00
parent 7839a6761a
commit c396f271c8

View File

@ -185,11 +185,8 @@ void Tabs::selectNextTab()
else else
++it; ++it;
if (it != currentTabIt) { if (it != currentTabIt)
selectTabInternal(*it); selectTabInternal(*it);
if (m_delegate)
m_delegate->onSelectTab(this, m_selected->view);
}
} }
} }
@ -205,11 +202,8 @@ void Tabs::selectPreviousTab()
else else
--it; --it;
if (it != currentTabIt) { if (it != currentTabIt)
selectTabInternal(*it); selectTabInternal(*it);
if (m_delegate)
m_delegate->onSelectTab(this, m_selected->view);
}
} }
} }
@ -333,9 +327,10 @@ bool Tabs::onProcessMessage(Message* msg)
int index = (it - m_list.begin()); int index = (it - m_list.begin());
int newIndex = index + dz; int newIndex = index + dz;
newIndex = MID(0, newIndex, int(m_list.size())-1); newIndex = MID(0, newIndex, int(m_list.size())-1);
if (newIndex != index) if (newIndex != index) {
selectTabInternal(m_list[newIndex]); selectTabInternal(m_list[newIndex]);
} }
}
return true; return true;
} }
@ -460,6 +455,9 @@ void Tabs::selectTabInternal(Tab* tab)
m_selected = tab; m_selected = tab;
makeTabVisible(tab); makeTabVisible(tab);
invalidate(); invalidate();
if (m_delegate)
m_delegate->onSelectTab(this, tab->view);
} }
void Tabs::drawTab(Graphics* g, const gfx::Rect& _box, Tab* tab, int dy, void Tabs::drawTab(Graphics* g, const gfx::Rect& _box, Tab* tab, int dy,