Fixed the hard to click checkbox in a reasonably clean way

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5979 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-09-13 02:07:51 +00:00
parent 141ce78156
commit f97cec61ce
3 changed files with 18 additions and 13 deletions

View File

@ -14,19 +14,19 @@
<buttonbar id="choiceribbon" proportion="4" width="100%" align="center"> <buttonbar id="choiceribbon" proportion="4" width="100%" align="center">
<icon-button id="newrace" width="128" height="128" icon="gui/main_race.png" <icon-button id="newrace" width="128" height="128" icon="gui/main_race.png"
I18N="Race paused button" text="Setup New Race"/> I18N="Race paused button" text="Setup New Race" word_wrap="true"/>
<icon-button id="restart" width="128" height="128" icon="gui/restart.png" <icon-button id="restart" width="128" height="128" icon="gui/restart.png"
I18N="Race paused button" text="Restart Race"/> I18N="Race paused button" text="Restart Race" word_wrap="true"/>
<icon-button id="options" width="128" height="128" icon="gui/main_options.png" <icon-button id="options" width="128" height="128" icon="gui/main_options.png"
I18N="Race paused button" text="Options"/> I18N="Race paused button" text="Options" word_wrap="true"/>
<icon-button id="help" width="128" height="128" icon="gui/main_help.png" <icon-button id="help" width="128" height="128" icon="gui/main_help.png"
I18N="Race paused button" text="Help"/> I18N="Race paused button" text="Help" word_wrap="true"/>
<icon-button id="exit" width="128" height="128" icon="gui/main_quit.png" <icon-button id="exit" width="128" height="128" icon="gui/main_quit.png"
I18N="Race paused button" text="Exit Race"/> I18N="Race paused button" text="Exit Race" word_wrap="true"/>
</buttonbar> </buttonbar>

View File

@ -116,9 +116,10 @@
runtime, too. Just add no children to the ribbon in the XML file, and runtime, too. Just add no children to the ribbon in the XML file, and
add them at runtime through the method for this. add them at runtime through the method for this.
\note The layout algorithm will reserve space for at most one line of text \note The layout algorithm will reserve space for at most one line of text
(if needed) for ribbon elements. If you have ribbon elements will (if needed) for ribbon elements. If you have ribbon elements with
long texts that spawn many lines, expect that the extra lines will long texts that spawn many lines, 1. give the word_wrap="true" property
not be accounted for in the sizing algorithms (i.e. extra lines will to the icon button widget in the XML file; 2. expect that the extra lines
will not be accounted for in the sizing algorithms (i.e. extra lines will
just expand over whatever is located under the ribbon) just expand over whatever is located under the ribbon)
\n \n
@ -298,8 +299,10 @@
\subsection prop5 PROP_WORD_WRAP \subsection prop5 PROP_WORD_WRAP
<em> Name in XML files: </em> \c "word_wrap" <em> Name in XML files: </em> \c "word_wrap"
used exclusively by label components. Value can be "true" to indicate that used by label components and icon buttons. Value can be "true" to indicate
long text should spawn on multiple lines. that long text should spawn on multiple lines. Warning, in icon buttons,
the space under the button's text may be rendered unclickable by the label
widget overlapping other widgets under.
\n \n
\subsection prop6 PROP_MIN_VALUE, PROP_MAX_VALUE \subsection prop6 PROP_MIN_VALUE, PROP_MAX_VALUE

View File

@ -111,14 +111,16 @@ void IconButtonWidget::add()
const int label_extra_size = ( m_properties[PROP_EXTEND_LABEL].size() == 0 ? const int label_extra_size = ( m_properties[PROP_EXTEND_LABEL].size() == 0 ?
0 : atoi(m_properties[PROP_EXTEND_LABEL].c_str()) ); 0 : atoi(m_properties[PROP_EXTEND_LABEL].c_str()) );
// leave enough room for two lines of text const bool word_wrap = (m_properties[PROP_WORD_WRAP] == "true");
// leave enough room for (at least) two lines of text
widget_size = rect<s32>(m_x - label_extra_size/2, widget_size = rect<s32>(m_x - label_extra_size/2,
m_y + m_h, m_y + m_h,
m_x + m_w + label_extra_size/2, m_x + m_w + label_extra_size/2,
m_y + m_h + GUIEngine::getFontHeight()*2); m_y + m_h + (word_wrap ? GUIEngine::getFontHeight()*2 : 0));
m_label = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), widget_size, m_label = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), widget_size,
false, true /* word wrap */, m_parent); false, word_wrap, m_parent);
m_label->setTextAlignment(EGUIA_CENTER, EGUIA_UPPERLEFT); m_label->setTextAlignment(EGUIA_CENTER, EGUIA_UPPERLEFT);
m_label->setTabStop(false); m_label->setTabStop(false);
m_label->setNotClipped(true); m_label->setNotClipped(true);