Changeset View
Changeset View
Standalone View
Standalone View
source/gui/CDropDown.cpp
Show First 20 Lines • Show All 470 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
float bz = GetBufferedZ(); | float bz = GetBufferedZ(); | ||||
float dropdown_size, button_width; | float dropdown_size, button_width; | ||||
GUI<float>::GetSetting(this, "dropdown_size", dropdown_size); | GUI<float>::GetSetting(this, "dropdown_size", dropdown_size); | ||||
GUI<float>::GetSetting(this, "button_width", button_width); | GUI<float>::GetSetting(this, "button_width", button_width); | ||||
int cell_id, selected = 0; | int cell_id, selected = 0; | ||||
CGUIColor color; | |||||
bool enabled; | bool enabled; | ||||
GUI<bool>::GetSetting(this, "enabled", enabled); | GUI<bool>::GetSetting(this, "enabled", enabled); | ||||
CGUISpriteInstance& sprite = GUI<CGUISpriteInstance>::GetSetting(this, enabled ? "sprite" : "sprite_disabled"); | CGUISpriteInstance& sprite = GUI<CGUISpriteInstance>::GetSetting(this, enabled ? "sprite" : "sprite_disabled"); | ||||
CGUISpriteInstance& sprite2 = GUI<CGUISpriteInstance>::GetSetting(this, "sprite2"); | CGUISpriteInstance& sprite2 = GUI<CGUISpriteInstance>::GetSetting(this, "sprite2"); | ||||
GUI<int>::GetSetting(this, "cell_id", cell_id); | GUI<int>::GetSetting(this, "cell_id", cell_id); | ||||
GUI<int>::GetSetting(this, "selected", selected); | GUI<int>::GetSetting(this, "selected", selected); | ||||
GUI<CGUIColor>::GetSetting(this, enabled ? "textcolor_selected" : "textcolor_disabled", color); | |||||
m_pGUI->DrawSprite(sprite, cell_id, bz, m_CachedActualSize); | m_pGUI->DrawSprite(sprite, cell_id, bz, m_CachedActualSize); | ||||
if (button_width > 0.f) | if (button_width > 0.f) | ||||
{ | { | ||||
CRect rect(m_CachedActualSize.right-button_width, m_CachedActualSize.top, | CRect rect(m_CachedActualSize.right-button_width, m_CachedActualSize.top, | ||||
m_CachedActualSize.right, m_CachedActualSize.bottom); | m_CachedActualSize.right, m_CachedActualSize.bottom); | ||||
Show All 16 Lines | else | ||||
m_pGUI->DrawSprite(sprite2, cell_id, bz + 0.05f, rect); | m_pGUI->DrawSprite(sprite2, cell_id, bz + 0.05f, rect); | ||||
} | } | ||||
if (selected != -1) // TODO: Maybe check validity completely? | if (selected != -1) // TODO: Maybe check validity completely? | ||||
{ | { | ||||
CRect cliparea(m_CachedActualSize.left, m_CachedActualSize.top, | CRect cliparea(m_CachedActualSize.left, m_CachedActualSize.top, | ||||
m_CachedActualSize.right-button_width, m_CachedActualSize.bottom); | m_CachedActualSize.right-button_width, m_CachedActualSize.bottom); | ||||
const CGUIColor& color = GUI<CGUIColor>::GetSetting(this, enabled ? "textcolor_selected" : "textcolor_disabled"); | |||||
CPos pos(m_CachedActualSize.left, m_CachedActualSize.top); | CPos pos(m_CachedActualSize.left, m_CachedActualSize.top); | ||||
DrawText(selected, color, pos, bz+0.1f, cliparea); | DrawText(selected, color, pos, bz+0.1f, cliparea); | ||||
} | } | ||||
// Disable scrollbar during drawing without sending a setting-changed message | // Disable scrollbar during drawing without sending a setting-changed message | ||||
bool& scrollbar = GUI<bool>::GetSetting(this, "scrollbar"); | bool& scrollbar = GUI<bool>::GetSetting(this, "scrollbar"); | ||||
bool old = scrollbar; | bool old = scrollbar; | ||||
Show All 23 Lines |
Wildfire Games · Phabricator