Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/CText.cpp
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | if (m_GeneratedTexts.empty()) | ||||
return; | return; | ||||
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) Don't define standard like this. Do it with the default style. | // TODO Gee: (2004-08-14) Don't define standard like this. Do it with the default style. | ||||
font = L"default"; | font = L"default"; | ||||
CGUIString* caption = nullptr; | |||||
GUI<CGUIString>::GetSettingPointer(this, "caption", caption); | |||||
bool scrollbar; | bool scrollbar; | ||||
GUI<bool>::GetSetting(this, "scrollbar", scrollbar); | GUI<bool>::GetSetting(this, "scrollbar", scrollbar); | ||||
float width = m_CachedActualSize.GetWidth(); | float width = m_CachedActualSize.GetWidth(); | ||||
// remove scrollbar if applicable | // remove scrollbar if applicable | ||||
if (scrollbar && GetScrollBar(0).GetStyle()) | if (scrollbar && GetScrollBar(0).GetStyle()) | ||||
width -= GetScrollBar(0).GetStyle()->m_Width; | width -= GetScrollBar(0).GetStyle()->m_Width; | ||||
const CGUIString& caption = GUI<CGUIString>::GetSetting(this, "caption"); | |||||
const float buffer_zone = GUI<float>::GetSetting(this, "buffer_zone"); | |||||
float buffer_zone = 0.f; | m_GeneratedTexts[0] = CGUIText(m_pGUI, caption, font, width, buffer_zone, this); | ||||
GUI<float>::GetSetting(this, "buffer_zone", buffer_zone); | |||||
m_GeneratedTexts[0] = CGUIText(m_pGUI, *caption, font, width, buffer_zone, this); | |||||
if (!scrollbar) | if (!scrollbar) | ||||
CalculateTextPosition(m_CachedActualSize, m_TextPos, m_GeneratedTexts[0]); | CalculateTextPosition(m_CachedActualSize, m_TextPos, m_GeneratedTexts[0]); | ||||
// Setup scrollbar | // Setup scrollbar | ||||
if (scrollbar) | if (scrollbar) | ||||
{ | { | ||||
bool scroll_top = false, scroll_bottom = false; | bool scroll_top = false, scroll_bottom = false; | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | void CText::Draw() | ||||
// First call draw on ScrollBarOwner | // First call draw on ScrollBarOwner | ||||
bool scrollbar; | bool scrollbar; | ||||
GUI<bool>::GetSetting(this, "scrollbar", scrollbar); | GUI<bool>::GetSetting(this, "scrollbar", scrollbar); | ||||
if (scrollbar) | if (scrollbar) | ||||
// Draw scrollbar | // Draw scrollbar | ||||
IGUIScrollBarOwner::Draw(); | IGUIScrollBarOwner::Draw(); | ||||
CGUISpriteInstance* sprite; | CGUISpriteInstance& sprite = GUI<CGUISpriteInstance>::GetSetting(this, "sprite"); | ||||
int cell_id; | int cell_id; | ||||
bool clip; | bool clip; | ||||
GUI<CGUISpriteInstance>::GetSettingPointer(this, "sprite", sprite); | |||||
GUI<int>::GetSetting(this, "cell_id", cell_id); | GUI<int>::GetSetting(this, "cell_id", cell_id); | ||||
GUI<bool>::GetSetting(this, "clip", clip); | GUI<bool>::GetSetting(this, "clip", clip); | ||||
GetGUI()->DrawSprite(*sprite, cell_id, bz, m_CachedActualSize); | m_pGUI->DrawSprite(sprite, cell_id, bz, m_CachedActualSize); | ||||
float scroll = 0.f; | float scroll = 0.f; | ||||
if (scrollbar) | if (scrollbar) | ||||
scroll = GetScrollBar(0).GetPos(); | scroll = GetScrollBar(0).GetPos(); | ||||
// Clipping area (we'll have to subtract the scrollbar) | // Clipping area (we'll have to subtract the scrollbar) | ||||
CRect cliparea; | CRect cliparea; | ||||
if (clip) | if (clip) | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator