Added bubble widget to work around clipped text in help menu .I'm not sure I like it, and it's especially ugly in the glass skin, but that can be worked on later.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5884 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
15523034da
commit
431e65b745
@ -20,45 +20,45 @@
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="models/bubblegum-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true" text="BubbleGum - leave a sticky pink puddle behind you"/>
|
||||
<bubble proportion="1" height="100%" text="BubbleGum - leave a sticky pink puddle behind you"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="models/cake-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
text="Cake - thrown at the closest rival, best on short ranges and long straights"/>
|
||||
<bubble proportion="1" height="100%"
|
||||
text="Cake - thrown at the closest rival, best on short ranges and long straights"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="models/plunger-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true" text="Plunger - throw straight to pull an opponent back, or throw while looking back to make one lose sight!"/>
|
||||
<bubble proportion="1" height="100%" text="Plunger - throw straight to pull an opponent back, or throw while looking back to make one lose sight!"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="models/bowling-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
text="Bowling Ball - bounces off walls. If you are looking back, it will be thrown backwards."/>
|
||||
<bubble proportion="1" height="100%"
|
||||
text="Bowling Ball - bounces off walls. If you are looking back, it will be thrown backwards."/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="models/parachute-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true" text="Parachute - slows down all karts in a better position!"/>
|
||||
<bubble proportion="1" height="100%" text="Parachute - slows down all karts in a better position!"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="models/anchor-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true" text="Anchor - slows down greatly the kart in the first position"/>
|
||||
<bubble proportion="1" height="100%" text="Anchor - slows down greatly the kart in the first position"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="models/swap-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true" text="Swapper - gift boxes are transformed into bananas and vice versa for a short time"/>
|
||||
<bubble proportion="1" height="100%" text="Swapper - gift boxes are transformed into bananas and vice versa for a short time"/>
|
||||
</div>
|
||||
|
||||
</box>
|
||||
|
@ -20,36 +20,36 @@
|
||||
<div width="100%" proportion="2" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="gui/mode_normal.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="Regular Race - all blows allowed, so catch weapons and make clever use of them!"/>
|
||||
<bubble proportion="1" height="100%"
|
||||
I18N="In the help menu"
|
||||
text="Regular Race - all blows allowed, so catch weapons and make clever use of them!"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="2" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="gui/mode_tt.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="Time Trial: Contains no powerups, so only your driving skills matter!"/>
|
||||
<bubble proportion="1" height="100%"
|
||||
I18N="In the help menu"
|
||||
text="Time Trial: Contains no powerups, so only your driving skills matter!"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="2" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="gui/mode_ftl.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="Follow the leader: run for second place, as the last kart will be disqualified every time the counter hits zero. Beware : going in front of the leader will get you eliminated too!"/>
|
||||
<bubble proportion="1" height="100%"
|
||||
I18N="In the help menu"
|
||||
text="Follow the leader: run for second place, as the last kart will be disqualified every time the counter hits zero. Beware : going in front of the leader will get you eliminated too!"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="2" layout="horizontal-row">
|
||||
<icon align="center" width="64" height="64" icon="gui/mode_3strikes.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="3 Strikes Battle : only in multiplayer games. Hit others with weapons until they lose all their lives."/>
|
||||
<bubble proportion="1" height="100%"
|
||||
I18N="In the help menu"
|
||||
text="3 Strikes Battle : only in multiplayer games. Hit others with weapons until they lose all their lives."/>
|
||||
</div>
|
||||
|
||||
<label proportion="3" width="100%" word_wrap="true" I18N="In the help menu"
|
||||
<bubble proportion="3" width="100%" I18N="In the help menu"
|
||||
text="* Most of these game modes can also be played in a Grand Prix fashion : instead of playing a single race, you play many in a row. The better you rank, the more points you get. In the end, the player with the most points wins the cup."/>
|
||||
|
||||
</box>
|
||||
|
@ -75,6 +75,11 @@ when the border that intersect at this corner are enabled.
|
||||
|
||||
<!-- TODO : buttons could support 'pressed' state -->
|
||||
|
||||
|
||||
<element type="textbubble" state="neutral" image="glass/textbubble.png"
|
||||
left_border="28" right_border="28" top_border="28" bottom_border="28"
|
||||
preserve_h_aspect_ratios="false" hborder_out_portion="1.0" />
|
||||
|
||||
<element type="progress" state="fill" image="glass/glassprogress_fill.png"
|
||||
left_border="80" right_border="80" top_border="0" bottom_border="36"
|
||||
preserve_h_aspect_ratios="true" />
|
||||
|
@ -75,6 +75,10 @@ when the border that intersect at this corner are enabled.
|
||||
|
||||
<!-- TODO : buttons could support 'pressed' state -->
|
||||
|
||||
<element type="textbubble" state="neutral" image="ocean/textbubble.png"
|
||||
left_border="28" right_border="28" top_border="28" bottom_border="28"
|
||||
preserve_h_aspect_ratios="false" hborder_out_portion="1.0" />
|
||||
|
||||
<element type="progress" state="fill" image="ocean/glasssgauge_fill.png"
|
||||
left_border="20" right_border="20" top_border="0" bottom_border="0"
|
||||
preserve_h_aspect_ratios="true" />
|
||||
|
@ -75,6 +75,10 @@ when the border that intersect at this corner are enabled.
|
||||
|
||||
<!-- TODO : buttons could support 'pressed' state -->
|
||||
|
||||
<element type="textbubble" state="neutral" image="peach/textbubble.png"
|
||||
left_border="28" right_border="28" top_border="28" bottom_border="28"
|
||||
preserve_h_aspect_ratios="false" hborder_out_portion="1.0" />
|
||||
|
||||
<element type="progress" state="fill" image="peach/glasssgauge_fill.png"
|
||||
left_border="20" right_border="20" top_border="0" bottom_border="0"
|
||||
preserve_h_aspect_ratios="true" />
|
||||
|
BIN
data/gui/skins/ocean/textbubble.png
Normal file
BIN
data/gui/skins/ocean/textbubble.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
data/gui/skins/peach/textbubble.png
Normal file
BIN
data/gui/skins/peach/textbubble.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
@ -101,6 +101,8 @@ supertuxkart_SOURCES = \
|
||||
guiengine/widget.cpp \
|
||||
guiengine/widget.hpp \
|
||||
guiengine/widgets.hpp \
|
||||
guiengine/widgets/bubble_widget.cpp \
|
||||
guiengine/widgets/bubble_widget.hpp \
|
||||
guiengine/widgets/button_widget.cpp \
|
||||
guiengine/widgets/button_widget.hpp \
|
||||
guiengine/widgets/check_box_widget.cpp \
|
||||
|
@ -178,6 +178,12 @@
|
||||
\note The "header" variant uses a bigger and more colourful font.
|
||||
\note The "bright" variant uses a more colourful font but is not bigger.
|
||||
|
||||
|
||||
\c WTYPE_BUBBLE is a variation of the plain label; the difference with a
|
||||
bubble widget is that it can be focused, and when focused it will expand
|
||||
to show more text, if the label is too long to be displayed in the allocated
|
||||
space.
|
||||
|
||||
\n
|
||||
\subsection widget7 WTYPE_SPACER
|
||||
<em> Name in XML files: </em> \c "spacer"
|
||||
|
@ -564,10 +564,12 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// select ribbons on hover
|
||||
if (w->m_event_handler != NULL && w->m_event_handler->m_type == WTYPE_RIBBON)
|
||||
{
|
||||
{
|
||||
// FIXME: don't make a special case for ribbon here, there should be a generic callback
|
||||
// that all widgets may hook onto
|
||||
RibbonWidget* ribbon = (RibbonWidget*)(w->m_event_handler);
|
||||
if (ribbon == NULL) break;
|
||||
|
||||
|
@ -121,6 +121,10 @@ void Screen::parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>&
|
||||
{
|
||||
append_to.push_back(new LabelWidget(false, true));
|
||||
}
|
||||
else if (!strcmp("bubble", xml->getNodeName()))
|
||||
{
|
||||
append_to.push_back(new BubbleWidget());
|
||||
}
|
||||
else if (!strcmp("header", xml->getNodeName()))
|
||||
{
|
||||
append_to.push_back(new LabelWidget(true));
|
||||
|
@ -1345,7 +1345,7 @@ void Skin::draw2DRectangle (IGUIElement *element, const video::SColor &color, co
|
||||
{
|
||||
if (GUIEngine::getStateManager()->getGameState() == GUIEngine::GAME) return; // ignore in game mode
|
||||
|
||||
if (element->getType()==gui::EGUIET_SCROLL_BAR)
|
||||
if (element->getType() == gui::EGUIET_SCROLL_BAR)
|
||||
{
|
||||
drawScrollbarBackground(rect);
|
||||
return;
|
||||
@ -1610,6 +1610,58 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f
|
||||
{
|
||||
drawList(rect, widget, focused);
|
||||
}
|
||||
else if (type == WTYPE_BUBBLE)
|
||||
{
|
||||
BubbleWidget* bubble = (BubbleWidget*)widget;
|
||||
|
||||
// zoom in/out effect
|
||||
if (bubble->isFocusedForPlayer(PLAYER_ID_GAME_MASTER))
|
||||
{
|
||||
if (bubble->m_zoom < 1.0f)
|
||||
{
|
||||
bubble->m_zoom += GUIEngine::getLatestDt()*10.0f;
|
||||
if (bubble->m_zoom > 1.0f) bubble->m_zoom = 1.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bubble->m_zoom > 0.0f)
|
||||
{
|
||||
bubble->m_zoom -= GUIEngine::getLatestDt()*10.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (bubble->m_zoom > 0.0f)
|
||||
{
|
||||
core::rect< s32 > rect2 = rect;
|
||||
|
||||
// minor adjustments...
|
||||
rect2.UpperLeftCorner.Y += 13;
|
||||
rect2.LowerRightCorner.X -= 15;
|
||||
rect2.LowerRightCorner.Y -= 8;
|
||||
|
||||
// apply zoom effect
|
||||
const int centerX = (rect2.UpperLeftCorner.X + rect2.LowerRightCorner.X)/2;
|
||||
const int centerY = (rect2.UpperLeftCorner.Y + rect2.LowerRightCorner.Y)/2;
|
||||
const int width = rect2.getWidth();
|
||||
const int height = rect2.getHeight();
|
||||
rect2.UpperLeftCorner.X = (int)(centerX - width*bubble->m_zoom/2.0f);
|
||||
rect2.UpperLeftCorner.Y = (int)(centerY - height*bubble->m_zoom/2.0f);
|
||||
rect2.LowerRightCorner.X = (int)(centerX + width*bubble->m_zoom/2.0f);
|
||||
rect2.LowerRightCorner.Y = (int)(centerY + height*bubble->m_zoom/2.0f);
|
||||
|
||||
drawBoxFromStretchableTexture(widget, rect2, SkinConfig::m_render_params["textbubble::neutral"]);
|
||||
}
|
||||
|
||||
//ITexture* texture;
|
||||
//texture = SkinConfig::m_render_params["checkbox::focused+unchecked"].getImage();
|
||||
//const int texture_w = texture->getSize().Width;
|
||||
//const int texture_h = texture->getSize().Height;
|
||||
//const core::rect< s32 > source_area = core::rect< s32 >(0, 0, texture_w, texture_h);
|
||||
//GUIEngine::getDriver()->draw2DImage( texture, rect, source_area,
|
||||
// 0 /* no clipping */, 0, true /* alpha */);
|
||||
return;
|
||||
}
|
||||
|
||||
//if(focused)
|
||||
// GUIEngine::getDriver()->draw2DRectangle( SColor(255, 150, 0, 0), rect );
|
||||
|
@ -42,6 +42,7 @@ namespace GUIEngine
|
||||
WTYPE_ICON_BUTTON,
|
||||
WTYPE_CHECKBOX,
|
||||
WTYPE_LABEL,
|
||||
WTYPE_BUBBLE,
|
||||
WTYPE_SPACER,
|
||||
WTYPE_DIV,
|
||||
WTYPE_DYNAMIC_RIBBON,
|
||||
@ -289,7 +290,7 @@ namespace GUIEngine
|
||||
return m_badges;
|
||||
}
|
||||
|
||||
/** Set to false if widget is something that should not receieve focus */
|
||||
/** Set to false if widget is something that should not receive focus */
|
||||
bool m_focusable;
|
||||
|
||||
/** \brief undos setDeactivated() */
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
// A shortcut header to get all widgets
|
||||
|
||||
#include "guiengine/widgets/bubble_widget.hpp"
|
||||
#include "guiengine/widgets/button_widget.hpp"
|
||||
#include "guiengine/widgets/icon_button_widget.hpp"
|
||||
#include "guiengine/widgets/list_widget.hpp"
|
||||
|
105
src/guiengine/widgets/bubble_widget.cpp
Normal file
105
src/guiengine/widgets/bubble_widget.cpp
Normal file
@ -0,0 +1,105 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2010 Marianne Gagnon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/widgets/bubble_widget.hpp"
|
||||
#include <irrlicht.h>
|
||||
using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
BubbleWidget::BubbleWidget() : Widget(WTYPE_BUBBLE)
|
||||
{
|
||||
m_zoom = 0.0f;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void BubbleWidget::add()
|
||||
{
|
||||
m_shrinked_size = rect<s32>(m_x, m_y, m_x + m_w, m_y + m_h);
|
||||
stringw message = getText();
|
||||
|
||||
EGUI_ALIGNMENT align = EGUIA_UPPERLEFT;
|
||||
if (m_properties[PROP_TEXT_ALIGN] == "center") align = EGUIA_CENTER;
|
||||
else if (m_properties[PROP_TEXT_ALIGN] == "right") align = EGUIA_LOWERRIGHT;
|
||||
EGUI_ALIGNMENT valign = EGUIA_CENTER ; //TODO: make label v-align configurable through XML file?
|
||||
|
||||
IGUIStaticText* irrwidget;
|
||||
irrwidget = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), m_shrinked_size,
|
||||
false, true /* word wrap */, m_parent, getNewID());
|
||||
|
||||
// find expanded bubble size
|
||||
int text_height = irrwidget->getTextHeight();
|
||||
|
||||
m_expanded_size = m_shrinked_size;
|
||||
const int additionalNeededSize = std::max(0, text_height - m_shrinked_size.getHeight());
|
||||
m_expanded_size.UpperLeftCorner.Y -= additionalNeededSize/2;
|
||||
m_expanded_size.LowerRightCorner.Y += additionalNeededSize/2;
|
||||
|
||||
// reduce text to fit in the available space if it's too long
|
||||
while (text_height > m_shrinked_size.getHeight())
|
||||
{
|
||||
message = message.subString(0, message.size() - 10) + "...";
|
||||
irrwidget->setText(message.c_str());
|
||||
text_height = irrwidget->getTextHeight();
|
||||
}
|
||||
m_shrinked_text = message;
|
||||
|
||||
m_element = irrwidget;
|
||||
irrwidget->setTextAlignment( align, valign );
|
||||
|
||||
m_id = m_element->getID();
|
||||
|
||||
m_element->setTabOrder(m_id);
|
||||
m_element->setTabStop(true);
|
||||
|
||||
m_element->setNotClipped(true);
|
||||
irrwidget->setDrawBorder(true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
EventPropagation BubbleWidget::focused(const int playerID)
|
||||
{
|
||||
if (m_element != NULL)
|
||||
{
|
||||
IGUIStaticText* widget = getIrrlichtElement<IGUIStaticText>();
|
||||
//widget->setDrawBorder(true);
|
||||
widget->setRelativePosition(m_expanded_size);
|
||||
widget->setText(getText().c_str());
|
||||
}
|
||||
return EVENT_LET;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void BubbleWidget::unfocused(const int playerID)
|
||||
{
|
||||
if (m_element != NULL)
|
||||
{
|
||||
IGUIStaticText* widget = getIrrlichtElement<IGUIStaticText>();
|
||||
//widget->setDrawBorder(false);
|
||||
widget->setRelativePosition(m_shrinked_size);
|
||||
widget->setText(m_shrinked_text.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
59
src/guiengine/widgets/bubble_widget.hpp
Normal file
59
src/guiengine/widgets/bubble_widget.hpp
Normal file
@ -0,0 +1,59 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2010 Marianne Gagnon
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef __BUBBLE_WIDGET_HPP__
|
||||
#define __BUBBLE_WIDGET_HPP__
|
||||
|
||||
#include <irrlicht.h>
|
||||
#include "guiengine/widget.hpp"
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
|
||||
class BubbleWidget : public Widget
|
||||
{
|
||||
/** shrinked size of this widget (size allowed in layout; internal text may be bigger than that).
|
||||
* If the text all fits in the allowed layout space, m_shrinked_size == m_expanded_size.
|
||||
*/
|
||||
irr::core::rect<s32> m_shrinked_size;
|
||||
|
||||
/** Expanded size of this widget (size to see all text inside the bubble).
|
||||
* If the text all fits in the allowed layout space, m_shrinked_size == m_expanded_size.
|
||||
*/
|
||||
irr::core::rect<s32> m_expanded_size;
|
||||
|
||||
/** Text shrinked to fit into the allowed layout space (will be same as m_text if all text fits) */
|
||||
irr::core::stringw m_shrinked_text;
|
||||
public:
|
||||
|
||||
// For the skin
|
||||
float m_zoom;
|
||||
|
||||
BubbleWidget();
|
||||
|
||||
virtual void add();
|
||||
|
||||
/** \brief overriding event form base class */
|
||||
virtual EventPropagation focused(const int playerID);
|
||||
|
||||
/** \brief overriding event form base class */
|
||||
virtual void unfocused(const int playerID);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -21,6 +21,8 @@
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "guiengine/skin.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace GUIEngine;
|
||||
using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
@ -39,7 +41,6 @@ LabelWidget::LabelWidget(bool title, bool bright) : Widget(WTYPE_LABEL)
|
||||
m_has_color = true;
|
||||
m_color = Skin::getColor("brighttext::neutral");
|
||||
}
|
||||
|
||||
} // LabelWidget
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -49,14 +50,17 @@ void LabelWidget::add()
|
||||
{
|
||||
rect<s32> widget_size = rect<s32>(m_x, m_y, m_x + m_w, m_y + m_h);
|
||||
const bool word_wrap = m_properties[PROP_WORD_WRAP] == "true";
|
||||
const stringw& message = getText();
|
||||
stringw message = getText();
|
||||
|
||||
EGUI_ALIGNMENT align = EGUIA_UPPERLEFT;
|
||||
if (m_properties[PROP_TEXT_ALIGN] == "center") align = EGUIA_CENTER;
|
||||
else if (m_properties[PROP_TEXT_ALIGN] == "right") align = EGUIA_LOWERRIGHT;
|
||||
EGUI_ALIGNMENT valign = EGUIA_CENTER ; //TODO: make label v-align configurable through XML file?
|
||||
|
||||
IGUIStaticText* irrwidget = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), widget_size, false, word_wrap, m_parent, -1);
|
||||
IGUIStaticText* irrwidget;
|
||||
irrwidget = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), widget_size,
|
||||
false, word_wrap, m_parent, -1);
|
||||
|
||||
m_element = irrwidget;
|
||||
irrwidget->setTextAlignment( align, valign );
|
||||
|
||||
@ -74,9 +78,11 @@ void LabelWidget::add()
|
||||
//irrwidget->setDrawBackground(true);
|
||||
|
||||
m_id = m_element->getID();
|
||||
//m_element->setTabOrder(id);
|
||||
|
||||
m_element->setTabStop(false);
|
||||
m_element->setTabGroup(false);
|
||||
|
||||
m_element->setNotClipped(true);
|
||||
} // add
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -39,7 +39,7 @@ namespace GUIEngine
|
||||
LabelWidget(bool title=false, bool bright=false);
|
||||
virtual ~LabelWidget() {}
|
||||
|
||||
void add();
|
||||
virtual void add();
|
||||
|
||||
/** Sets the color of the widget.
|
||||
* \param color The color to use for this widget. */
|
||||
@ -48,7 +48,7 @@ namespace GUIEngine
|
||||
m_color = color;
|
||||
m_has_color = true;
|
||||
} // setColor
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -246,6 +246,7 @@
|
||||
956541BB10DD5F0A00C83E99 /* arenas_screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956541B910DD5F0A00C83E99 /* arenas_screen.cpp */; };
|
||||
956541E110DD628C00C83E99 /* add_device_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956541DF10DD628C00C83E99 /* add_device_dialog.cpp */; };
|
||||
956830E01132EC9E00088D14 /* irr_debug_drawer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956830DE1132EC9E00088D14 /* irr_debug_drawer.cpp */; };
|
||||
956B0A9F1232D2E900767CCD /* bubble_widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956B0A9E1232D2E900767CCD /* bubble_widget.cpp */; };
|
||||
956C6ED31128D3FB004336C8 /* controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956C6EC81128D3FB004336C8 /* controller.cpp */; };
|
||||
956C6ED41128D3FB004336C8 /* default_ai_controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956C6ECA1128D3FB004336C8 /* default_ai_controller.cpp */; };
|
||||
956C6ED51128D3FB004336C8 /* end_controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956C6ECC1128D3FB004336C8 /* end_controller.cpp */; };
|
||||
@ -464,6 +465,8 @@
|
||||
956541E010DD628C00C83E99 /* add_device_dialog.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = add_device_dialog.hpp; path = ../../states_screens/dialogs/add_device_dialog.hpp; sourceTree = SOURCE_ROOT; };
|
||||
956830DE1132EC9E00088D14 /* irr_debug_drawer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = irr_debug_drawer.cpp; path = ../../physics/irr_debug_drawer.cpp; sourceTree = SOURCE_ROOT; };
|
||||
956830DF1132EC9E00088D14 /* irr_debug_drawer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = irr_debug_drawer.hpp; path = ../../physics/irr_debug_drawer.hpp; sourceTree = SOURCE_ROOT; };
|
||||
956B0A9E1232D2E900767CCD /* bubble_widget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = bubble_widget.cpp; path = ../../guiengine/widgets/bubble_widget.cpp; sourceTree = SOURCE_ROOT; };
|
||||
956B0AA21232D45D00767CCD /* bubble_widget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = bubble_widget.hpp; path = ../../guiengine/widgets/bubble_widget.hpp; sourceTree = SOURCE_ROOT; };
|
||||
956C6EC81128D3FB004336C8 /* controller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = controller.cpp; path = ../../karts/controller/controller.cpp; sourceTree = SOURCE_ROOT; };
|
||||
956C6EC91128D3FB004336C8 /* controller.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = controller.hpp; path = ../../karts/controller/controller.hpp; sourceTree = SOURCE_ROOT; };
|
||||
956C6ECA1128D3FB004336C8 /* default_ai_controller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = default_ai_controller.cpp; path = ../../karts/controller/default_ai_controller.cpp; sourceTree = SOURCE_ROOT; };
|
||||
@ -2269,6 +2272,8 @@
|
||||
95ECA0EB10124C5000D47C5F /* widgets */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
956B0A9E1232D2E900767CCD /* bubble_widget.cpp */,
|
||||
956B0AA21232D45D00767CCD /* bubble_widget.hpp */,
|
||||
95ECA0EC10124C5000D47C5F /* button_widget.cpp */,
|
||||
95ECA0ED10124C5000D47C5F /* button_widget.hpp */,
|
||||
95ECA0EE10124C5000D47C5F /* check_box_widget.cpp */,
|
||||
@ -2642,6 +2647,7 @@
|
||||
9560368C12187EFB00EB96C4 /* layout_manager.cpp in Sources */,
|
||||
956039BA1218C09E00EB96C4 /* abstract_top_level_container.cpp in Sources */,
|
||||
9552C1FB1231249000347B6C /* world_with_rank.cpp in Sources */,
|
||||
956B0A9F1232D2E900767CCD /* bubble_widget.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user