Fixed a few text clipping issues
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4352 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
be081d92ce
commit
4ab27d4b00
@ -179,6 +179,10 @@ PROP_SQUARE "square_items"
|
||||
Valid on Ribbons or RibbonGrids. Can be "true" (omitting it means "false"). Indicates whether the contents
|
||||
use rectangular icons (this will affect the type of focus/highlighting used)
|
||||
|
||||
PROP_EXTEND_LABEL "extend_label"
|
||||
How many pixels the label is allowed to expand beyond the boundaries of the widget itself. Currently only
|
||||
allowed on icon widgets,
|
||||
|
||||
+--------------------------+
|
||||
+ Using the Engine in Code +
|
||||
+--------------------------+
|
||||
|
@ -183,6 +183,7 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = prop_name; else widget.m_
|
||||
|
||||
READ_PROPERTY(max_width, PROP_MAX_WIDTH);
|
||||
READ_PROPERTY(max_height, PROP_MAX_HEIGHT);
|
||||
READ_PROPERTY(extend_label, PROP_EXTEND_LABEL);
|
||||
#undef READ_PROPERTY
|
||||
|
||||
const char* text = xml->getAttributeValue( "text" );
|
||||
|
@ -71,7 +71,8 @@ namespace GUIEngine
|
||||
PROP_MAX_VALUE,
|
||||
PROP_MAX_WIDTH,
|
||||
PROP_MAX_HEIGHT,
|
||||
PROP_SQUARE
|
||||
PROP_SQUARE,
|
||||
PROP_EXTEND_LABEL
|
||||
};
|
||||
|
||||
bool isWithinATextBox();
|
||||
|
@ -175,11 +175,11 @@ void DynamicRibbonWidget::setSubElements()
|
||||
|
||||
// ajust column amount to not add more items slot than we actually need
|
||||
const int item_count = m_items.size();
|
||||
std::cout << "item_count=" << item_count << ", row_amount*m_col_amount=" << m_row_amount*m_col_amount << std::endl;
|
||||
//std::cout << "item_count=" << item_count << ", row_amount*m_col_amount=" << m_row_amount*m_col_amount << std::endl;
|
||||
if (m_row_amount*m_col_amount > item_count)
|
||||
{
|
||||
m_col_amount = (int)ceil((float)item_count/(float)m_row_amount);
|
||||
std::cout << "Adjusting m_col_amount to be " << m_col_amount << std::endl;
|
||||
//std::cout << "Adjusting m_col_amount to be " << m_col_amount << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,10 @@ void IconButtonWidget::add()
|
||||
stringw& message = m_text;
|
||||
if (message.size() > 0)
|
||||
{
|
||||
widget_size = rect<s32>(x, y + h, x + w, y + h*2);
|
||||
//std::cout << "Adding label of icon widget, m_properties[PROP_EXTEND_LABEL] = " << m_properties[PROP_EXTEND_LABEL] << std::endl;
|
||||
const int label_extra_size = ( m_properties[PROP_EXTEND_LABEL].size() == 0 ?
|
||||
0 : atoi(m_properties[PROP_EXTEND_LABEL].c_str()) );
|
||||
widget_size = rect<s32>(x - label_extra_size/2, y + h, x + w + label_extra_size/2, y + h*2);
|
||||
|
||||
m_label = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), widget_size, false, false /* word wrap */, m_parent);
|
||||
m_label->setTextAlignment(EGUIA_CENTER, EGUIA_UPPERLEFT);
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "input/input_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
using namespace GUIEngine;
|
||||
using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
@ -72,7 +74,8 @@ void RibbonWidget::add()
|
||||
// ribbon children must not be keyboard navigatable, the parent ribbon takes care of that
|
||||
if (m_children[i].m_type == WTYPE_ICON_BUTTON)
|
||||
{
|
||||
((IconButtonWidget*)m_children.get(i))->m_tab_stop = false;
|
||||
IconButtonWidget* icon = ((IconButtonWidget*)m_children.get(i));
|
||||
icon->m_tab_stop = false;
|
||||
}
|
||||
|
||||
total_needed_space += m_children[i].w;
|
||||
@ -116,6 +119,7 @@ void RibbonWidget::add()
|
||||
0,
|
||||
subsize.getHeight()+15,
|
||||
subsize.getHeight());
|
||||
// label at the *right* of the icon (for tabs)
|
||||
rect<s32> label_part = rect<s32>(subsize.getHeight()+15,
|
||||
0,
|
||||
subsize.getWidth()-15,
|
||||
@ -184,10 +188,13 @@ void RibbonWidget::add()
|
||||
m_children[i].y = button_y;
|
||||
m_children[i].w = (int)(image_w*zoom);
|
||||
m_children[i].h = (int)(image_h*zoom);
|
||||
|
||||
|
||||
//std::wcout << L"Widget has text '" << m_children[i].m_text.c_str() << "'\n";
|
||||
|
||||
IconButtonWidget* icon = ((IconButtonWidget*)m_children.get(i));
|
||||
//std::cout << "Setting PROP_EXTEND_LABEL to " << (one_button_space - icon->w) << std::endl;
|
||||
icon->m_properties[PROP_EXTEND_LABEL] = StringUtils::toString(one_button_space - icon->w);
|
||||
|
||||
m_children.get(i)->m_parent = btn;
|
||||
m_children.get(i)->add();
|
||||
//subbtn->setUseAlphaChannel(true);
|
||||
|
Loading…
Reference in New Issue
Block a user