Continue waging war on hardcoded sizes

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8445 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-04-25 00:18:36 +00:00
parent 9021f35cac
commit f7a9c6bcbd
4 changed files with 18 additions and 16 deletions

View File

@ -26,19 +26,19 @@
<spacer width="20" height="40" />
<div width="75%" height="fit" layout="horizontal-row" >
<checkbox id="showfps" width="40" height="40"/>
<checkbox id="showfps"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Display FPS"/>
</div>
<div width="75%" height="fit" layout="horizontal-row" >
<checkbox id="enable-internet" width="40" height="40"/>
<checkbox id="enable-internet"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Internet STK news"/>
</div>
<div width="75%" height="40" layout="horizontal-row" >
<checkbox id="minimal-racegui" width="40" height="40"/>
<div width="75%" height="fit" layout="horizontal-row" >
<checkbox id="minimal-racegui"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the ui settings" text="Minimal Race GUI"/>
</div>

View File

@ -22,17 +22,14 @@
<div width="75%" height="50" layout="horizontal-row" >
<label I18N="In the graphics settings" text="Graphical Effects Settings"/>
<spacer width="20" height="20"/>
<!-- FIXME: don't hardcode size -->
<gauge id="gfx_level" min_value="1" max_value="5" width="300" height="50"/>
<gauge id="gfx_level" min_value="1" max_value="5" width="300" />
</div>
<spacer height="15" width="10"/>
<!-- ************ VSYNC ************ -->
<div width="75%" height="fit" layout="horizontal-row" >
<!-- FIXME don't hardcode height -->
<checkbox id="vsync" width="40" height="40"/>
<checkbox id="vsync"/>
<spacer width="20" height="100%" />
<label I18N="In the video settings" text="Vertical Sync (requires restart)"/>
</div>
@ -51,8 +48,7 @@
<div width="75%" height="fit" layout="horizontal-row" >
<spacer width="40" height="100%" />
<!-- FIXME don't hardcode height -->
<checkbox id="fullscreen" width="40" height="40"/>
<checkbox id="fullscreen"/>
<spacer width="20" height="100%" />
<label height="100%" I18N="In the video settings" text="Fullscreen"/>
</div>

View File

@ -163,19 +163,21 @@ void LayoutManager::readCoords(Widget* self)
// lines are required, we need to specify a height explicitely
label_h = dim.Height + self->getHeightNeededAroundLabel();
}
else if (self->getType() == WTYPE_SPINNER)
else if (self->getType() == WTYPE_CHECKBOX)
{
// User text height to guess spinner height
// User text height to guess checkbox size
IGUIFont* font = (self->m_title_font ? GUIEngine::getTitleFont() : GUIEngine::getFont());
core::dimension2d< u32 > dim = font->getDimension( L"X" );
label_h = dim.Height + self->getHeightNeededAroundLabel();
label_h = dim.Height + self->getHeightNeededAroundLabel();
label_w = label_h; // a checkbox is square
}
if (label_h == -1)
{
if (self->getType() == WTYPE_TEXTBOX ||
self->getType() == WTYPE_BUTTON ||
self->getType() == WTYPE_LABEL)
self->getType() == WTYPE_BUTTON ||
self->getType() == WTYPE_LABEL ||
self->getType() == WTYPE_SPINNER)
{
IGUIFont* font = (self->m_title_font ? GUIEngine::getTitleFont() : GUIEngine::getFont());

View File

@ -48,6 +48,10 @@ namespace GUIEngine
/** Set whether the checkbox is checked */
void setState(const bool checked) { m_state = checked; }
/** When inferring widget size from its label length, this method will be called to
* if/how much space must be added to the raw label's size for the widget to be large enough */
virtual int getHeightNeededAroundLabel() const { return 10; }
};
}