Add skin-specific color emphasis for list items
This commit is contained in:
parent
1f1d87e838
commit
c84db6a571
@ -275,6 +275,14 @@ when the border that intersect at this corner are enabled.
|
||||
<!-- Color used in the credits -->
|
||||
<color type="credits_text" state="neutral" r="220" g="220" b="220" />
|
||||
|
||||
<!-- Color used for emphasized items in e.g. lists -->
|
||||
<color type="emphasis_text" state="neutral" r="230" g="210" b="50" />
|
||||
<color type="emphasis_text" state="focused" r="255" g="226" b="56" />
|
||||
|
||||
<!-- Color used for blue items in list (e.g. player team color in networking) -->
|
||||
<color type="list_blue" state="neutral" r="0" g="0" b="180" />
|
||||
<color type="list_blue" state="focused" r="0" g="0" b="255" />
|
||||
|
||||
<!-- Color used to fade out background when a dialog is shown -->
|
||||
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />
|
||||
|
||||
|
@ -275,6 +275,14 @@ when the border that intersect at this corner are enabled.
|
||||
<!-- Color used in the credits -->
|
||||
<color type="credits_text" state="neutral" r="0" g="55" b="0" />
|
||||
|
||||
<!-- Color used for emphasized items in e.g. lists -->
|
||||
<color type="emphasis_text" state="neutral" r="0" g="0" b="180" />
|
||||
<color type="emphasis_text" state="focused" r="0" g="0" b="160" />
|
||||
|
||||
<!-- Color used for blue items in list (e.g. player team color in networking) -->
|
||||
<color type="list_blue" state="neutral" r="0" g="0" b="255" />
|
||||
<color type="list_blue" state="focused" r="0" g="0" b="255" />
|
||||
|
||||
<!-- Color used to fade out background when a dialog is shown -->
|
||||
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />
|
||||
|
||||
|
@ -274,6 +274,14 @@ when the border that intersect at this corner are enabled.
|
||||
<!-- Color used in the credits -->
|
||||
<color type="credits_text" state="neutral" r="0" g="0" b="75" />
|
||||
|
||||
<!-- Color used for emphasized items in e.g. lists -->
|
||||
<color type="emphasis_text" state="neutral" r="0" g="0" b="180" />
|
||||
<color type="emphasis_text" state="focused" r="0" g="0" b="160" />
|
||||
|
||||
<!-- Color used for blue items in list (e.g. player team color in networking) -->
|
||||
<color type="list_blue" state="neutral" r="0" g="0" b="255" />
|
||||
<color type="list_blue" state="focused" r="0" g="0" b="255" />
|
||||
|
||||
<!-- Color used to fade out background when a dialog is shown -->
|
||||
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />
|
||||
|
||||
|
@ -272,6 +272,14 @@ when the border that intersect at this corner are enabled.
|
||||
<!-- Color used in the credits -->
|
||||
<color type="credits_text" state="neutral" r="65" g="15" b="0" />
|
||||
|
||||
<!-- Color used for emphasized items in e.g. lists -->
|
||||
<color type="emphasis_text" state="neutral" r="0" g="0" b="180" />
|
||||
<color type="emphasis_text" state="focused" r="0" g="0" b="160" />
|
||||
|
||||
<!-- Color used for blue items in list (e.g. player team color in networking) -->
|
||||
<color type="list_blue" state="neutral" r="0" g="0" b="255" />
|
||||
<color type="list_blue" state="focused" r="0" g="0" b="255" />
|
||||
|
||||
<!-- Color used to fade out background when a dialog is shown -->
|
||||
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />
|
||||
|
||||
|
@ -273,6 +273,14 @@ when the border that intersect at this corner are enabled.
|
||||
<!-- Color used in the credits -->
|
||||
<color type="credits_text" state="neutral" r="65" g="0" b="15" />
|
||||
|
||||
<!-- Color used for emphasized items in e.g. lists -->
|
||||
<color type="emphasis_text" state="neutral" r="0" g="0" b="180" />
|
||||
<color type="emphasis_text" state="focused" r="0" g="0" b="160" />
|
||||
|
||||
<!-- Color used for blue items in list (e.g. player team color in networking) -->
|
||||
<color type="list_blue" state="neutral" r="0" g="0" b="255" />
|
||||
<color type="list_blue" state="focused" r="0" g="0" b="255" />
|
||||
|
||||
<!-- Color used to fade out background when a dialog is shown -->
|
||||
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />
|
||||
|
||||
|
@ -431,8 +431,8 @@ void ListWidget::markItemRed(const int id, bool red)
|
||||
}
|
||||
else
|
||||
{
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT, video::SColor(255,0,0,0) );
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT_HIGHLIGHT, video::SColor(255,255,255,255) );
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT, GUIEngine::getSkin()->getColor("text::neutral"));
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT_HIGHLIGHT, GUIEngine::getSkin()->getColor("text::focused"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,18 +447,39 @@ void ListWidget::markItemBlue(const int id, bool blue)
|
||||
|
||||
if (blue)
|
||||
{
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT, video::SColor(255,0,0,255) );
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT_HIGHLIGHT, video::SColor(255,0,0,255) );
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT, GUIEngine::getSkin()->getColor("list_blue::neutral"));
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT_HIGHLIGHT, GUIEngine::getSkin()->getColor("list_blue::focused"));
|
||||
}
|
||||
else
|
||||
{
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT, video::SColor(255,0,0,0) );
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT_HIGHLIGHT, video::SColor(255,255,255,255) );
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT, GUIEngine::getSkin()->getColor("text::neutral"));
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT_HIGHLIGHT, GUIEngine::getSkin()->getColor("text::focused"));
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ListWidget::emphasisItem(const int id, bool enable)
|
||||
{
|
||||
// May only be called AFTER this widget has been add()ed
|
||||
assert(m_element != NULL);
|
||||
|
||||
CGUISTKListBox* irritem = getIrrlichtElement<CGUISTKListBox>();
|
||||
|
||||
if (enable)
|
||||
{
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT, GUIEngine::getSkin()->getColor("emphasis_text::neutral"));
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT_HIGHLIGHT, GUIEngine::getSkin()->getColor("emphasis_text::focused"));
|
||||
}
|
||||
else
|
||||
{
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT, GUIEngine::getSkin()->getColor("text::neutral"));
|
||||
irritem->setItemOverrideColor( id, EGUI_LBC_TEXT_HIGHLIGHT, GUIEngine::getSkin()->getColor("text::focused"));
|
||||
}
|
||||
} // emphasisItem
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
EventPropagation ListWidget::transmitEvent(Widget* w,
|
||||
const std::string& originator,
|
||||
const int playerID)
|
||||
|
@ -223,6 +223,7 @@ namespace GUIEngine
|
||||
*/
|
||||
void markItemRed(const int id, bool red=true);
|
||||
void markItemBlue(const int id, bool blue=true);
|
||||
void emphasisItem(const int id, bool enable=true);
|
||||
|
||||
/**
|
||||
* \brief Make an item red to mark an error, for instance
|
||||
@ -242,6 +243,13 @@ namespace GUIEngine
|
||||
markItemBlue( id, blue );
|
||||
}
|
||||
|
||||
void emphasisItem(const std::string &internalName, bool enable=true)
|
||||
{
|
||||
const int id = getItemID(internalName);
|
||||
assert(id != -1);
|
||||
emphasisItem(id, enable);
|
||||
}
|
||||
|
||||
/** Override callback from Widget */
|
||||
virtual EventPropagation transmitEvent(Widget* w,
|
||||
const std::string& originator,
|
||||
|
@ -120,7 +120,7 @@ void BaseOnlineProfileAchievements::init()
|
||||
const std::string id = StringUtils::toString(a->getInfo()->getID());
|
||||
m_achievements_list_widget->addItem(id, row);
|
||||
if (a->isAchieved())
|
||||
m_achievements_list_widget->markItemBlue(id);
|
||||
m_achievements_list_widget->emphasisItem(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user