Changeset View
Changeset View
Standalone View
Standalone View
source/gui/CCheckBox.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | CCheckBox::CCheckBox(CGUI* pGUI) | ||||
AddSetting<float>("square_side"); | AddSetting<float>("square_side"); | ||||
AddSetting<CGUIColor>("textcolor"); | AddSetting<CGUIColor>("textcolor"); | ||||
AddSetting<CGUIColor>("textcolor_over"); | AddSetting<CGUIColor>("textcolor_over"); | ||||
AddSetting<CGUIColor>("textcolor_pressed"); | AddSetting<CGUIColor>("textcolor_pressed"); | ||||
AddSetting<CGUIColor>("textcolor_disabled"); | AddSetting<CGUIColor>("textcolor_disabled"); | ||||
AddSetting<CStrW>("tooltip"); | AddSetting<CStrW>("tooltip"); | ||||
AddSetting<CStr>("tooltip_style"); | AddSetting<CStr>("tooltip_style"); | ||||
AddText(new SGUIText()); | AddText(); | ||||
} | } | ||||
CCheckBox::~CCheckBox() | CCheckBox::~CCheckBox() | ||||
{ | { | ||||
} | } | ||||
void CCheckBox::SetupText() | void CCheckBox::SetupText() | ||||
{ | { | ||||
ENSURE(m_GeneratedTexts.size() == 1); | ENSURE(m_GeneratedTexts.size() == 1); | ||||
CStrW font; | CStrW font; | ||||
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; | CGUIString* caption = nullptr; | ||||
GUI<CGUIString>::GetSettingPointer(this, "caption", 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] = GetGUI()->GenerateText(*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 20 Lines • Show All 54 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator