Improved hovering over tabs (no more messed up focus when mouse leaves)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8004 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-03-20 20:12:39 +00:00
parent 519770ec2f
commit 62c904c851
3 changed files with 12 additions and 1 deletions

View File

@ -722,11 +722,13 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const
/* tab-bar ribbons */
if (type == RIBBON_TABS)
{
const bool mouseIn = rect.isPointInside(irr_driver->getDevice()->getCursorControl()->getPosition());
BoxRenderParams* params;
if (mark_selected && (focused || parent_focused))
params = &SkinConfig::m_render_params["tab::focused"];
else if (parentRibbon->m_mouse_focus == widget)
else if (parentRibbon->m_mouse_focus == widget && mouseIn)
params = &SkinConfig::m_render_params["tab::focused"];
else if (mark_selected)
params = &SkinConfig::m_render_params["tab::down"];

View File

@ -435,6 +435,7 @@ EventPropagation RibbonWidget::leftPressed(const int playerID)
}
}
// -----------------------------------------------------------------------------
EventPropagation RibbonWidget::focused(const int playerID)
{
Widget::focused(playerID);
@ -456,6 +457,13 @@ EventPropagation RibbonWidget::focused(const int playerID)
return EVENT_LET;
}
// -----------------------------------------------------------------------------
void RibbonWidget::unfocused(const int playerID)
{
}
// -----------------------------------------------------------------------------
EventPropagation RibbonWidget::mouseHovered(Widget* child, const int mousePlayerID)
{

View File

@ -74,6 +74,7 @@ namespace GUIEngine
virtual EventPropagation mouseHovered(Widget* child, const int playerID);
virtual EventPropagation transmitEvent(Widget* w, std::string& originator, const int playerID=0);
virtual EventPropagation focused(const int playerID);
virtual void unfocused(const int playerID);
PtrVector<irr::gui::IGUIStaticText, REF> m_labels;