Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/CCheckBox.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | void CCheckBox::SetupText() | ||||
if (GUI<CStrW>::GetSetting(this, "font", font) != PSRETURN_OK || font.empty()) | if (GUI<CStrW>::GetSetting(this, "font", font) != PSRETURN_OK || font.empty()) | ||||
// Use the default if none is specified | // Use the default if none is specified | ||||
// TODO Gee: (2004-08-14) Default should not be hard-coded, but be in styles! | // TODO Gee: (2004-08-14) Default should not be hard-coded, but be in styles! | ||||
font = L"default"; | font = L"default"; | ||||
float square_side; | float square_side; | ||||
GUI<float>::GetSetting(this, "square_side", square_side); | GUI<float>::GetSetting(this, "square_side", square_side); | ||||
CGUIString* caption = nullptr; | const CGUIString& caption = GUI<CGUIString>::GetSetting(this, "caption"); | ||||
GUI<CGUIString>::GetSettingPointer(this, "caption", caption); | |||||
float buffer_zone = 0.f; | float buffer_zone = 0.f; | ||||
GUI<float>::GetSetting(this, "buffer_zone", buffer_zone); | GUI<float>::GetSetting(this, "buffer_zone", buffer_zone); | ||||
m_GeneratedTexts[0] = CGUIText(m_pGUI, *caption, font, m_CachedActualSize.GetWidth() - square_side, 0.f, this); | m_GeneratedTexts[0] = CGUIText(m_pGUI, caption, font, m_CachedActualSize.GetWidth() - square_side, 0.f, this); | ||||
} | } | ||||
void CCheckBox::HandleMessage(SGUIMessage& Message) | void CCheckBox::HandleMessage(SGUIMessage& Message) | ||||
{ | { | ||||
// Important | // Important | ||||
IGUIButtonBehavior::HandleMessage(Message); | IGUIButtonBehavior::HandleMessage(Message); | ||||
IGUITextOwner::HandleMessage(Message); | IGUITextOwner::HandleMessage(Message); | ||||
Show All 12 Lines | void CCheckBox::HandleMessage(SGUIMessage& Message) | ||||
default: | default: | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
void CCheckBox::Draw() | void CCheckBox::Draw() | ||||
{ | { | ||||
float bz = GetBufferedZ(); | if (GUI<bool>::GetSetting(this, "checked")) | ||||
bool checked; | DrawButton( | ||||
int cell_id; | m_CachedActualSize, | ||||
CGUISpriteInstance* sprite; | GetBufferedZ(), | ||||
CGUISpriteInstance* sprite_over; | GUI<CGUISpriteInstance>::GetSetting(this, "sprite2"), | ||||
CGUISpriteInstance* sprite_pressed; | GUI<CGUISpriteInstance>::GetSetting(this, "sprite2_over"), | ||||
CGUISpriteInstance* sprite_disabled; | GUI<CGUISpriteInstance>::GetSetting(this, "sprite2_pressed"), | ||||
GUI<CGUISpriteInstance>::GetSetting(this, "sprite2_disabled"), | |||||
GUI<bool>::GetSetting(this, "checked", checked); | GUI<int>::GetSetting(this, "cell_id")); | ||||
GUI<int>::GetSetting(this, "cell_id", cell_id); | |||||
if (checked) | |||||
{ | |||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2", sprite); | |||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2_over", sprite_over); | |||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2_pressed", sprite_pressed); | |||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite2_disabled", sprite_disabled); | |||||
} | |||||
else | else | ||||
{ | DrawButton( | ||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite", sprite); | m_CachedActualSize, | ||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite_over", sprite_over); | GetBufferedZ(), | ||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite_pressed", sprite_pressed); | GUI<CGUISpriteInstance>::GetSetting(this, "sprite"), | ||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite_disabled", sprite_disabled); | GUI<CGUISpriteInstance>::GetSetting(this, "sprite_over"), | ||||
} | GUI<CGUISpriteInstance>::GetSetting(this, "sprite_pressed"), | ||||
GUI<CGUISpriteInstance>::GetSetting(this, "sprite_disabled"), | |||||
DrawButton(m_CachedActualSize, | GUI<int>::GetSetting(this, "cell_id")); | ||||
bz, | |||||
*sprite, | |||||
*sprite_over, | |||||
*sprite_pressed, | |||||
*sprite_disabled, | |||||
cell_id); | |||||
} | } |
Wildfire Games · Phabricator