Minor update to tabs widget, makes focus follow mouse in skin, looks nicer

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7993 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-03-19 18:27:59 +00:00
parent 7f02234592
commit c0daa96282
3 changed files with 6 additions and 4 deletions

View File

@ -726,6 +726,8 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const
if (mark_selected && (focused || parent_focused))
params = &SkinConfig::m_render_params["tab::focused"];
else if (parentRibbon->m_mouse_focus == widget)
params = &SkinConfig::m_render_params["tab::focused"];
else if (mark_selected)
params = &SkinConfig::m_render_params["tab::down"];
else

View File

@ -320,7 +320,7 @@ EventPropagation RibbonWidget::rightPressed(const int playerID)
}
updateSelection();
if (m_ribbon_type == RIBBON_COMBO)
if (m_ribbon_type == RIBBON_COMBO || m_ribbon_type == RIBBON_TABS)
{
const int mousePlayerID = input_manager->getPlayerKeyboardID();
if (playerID == mousePlayerID || playerID == PLAYER_ID_GAME_MASTER)
@ -396,7 +396,7 @@ EventPropagation RibbonWidget::focused(const int playerID)
if (m_children.size() < 1) return EVENT_LET; // empty ribbon
if (m_ribbon_type == RIBBON_COMBO)
if (m_ribbon_type == RIBBON_COMBO || m_ribbon_type == RIBBON_TABS)
{
const int mousePlayerID = input_manager->getPlayerKeyboardID();
if (m_mouse_focus == NULL && m_selection[playerID] != -1 &&
@ -419,7 +419,7 @@ EventPropagation RibbonWidget::mouseHovered(Widget* child, const int mousePlayer
//std::cout << "RibbonWidget::mouseHovered " << mousePlayerID << std::endl;
const int subbuttons_amount = m_children.size();
if (m_ribbon_type == RIBBON_COMBO)
if (m_ribbon_type == RIBBON_COMBO || m_ribbon_type == RIBBON_TABS)
{
//std::cout << "SETTING m_mouse_focus\n";
m_mouse_focus = child;

View File

@ -89,7 +89,7 @@ namespace GUIEngine
static const char* NO_ITEM_ID;
/** Contains which element within the ribbon is currently focused by player 0 (used by the skin to
show mouse hovers over items that are not selected). Only used for COMBO ribbons. */
show mouse hovers over items that are not selected). Only used for COMBO and TAB ribbons. */
Widget* m_mouse_focus;
RibbonWidget(const RibbonType type=RIBBON_COMBO);