Add NEW_request_reduce_width for tcontrol.

This commit is contained in:
Mark de Wever 2009-04-30 12:14:41 +00:00
parent 23aed788a3
commit 395d79dafb
2 changed files with 32 additions and 0 deletions

View File

@ -145,6 +145,35 @@ void tcontrol::NEW_layout_init(const bool full_initialization)
}
}
void tcontrol::NEW_request_reduce_width(const unsigned maximum_width)
{
// Inherited.
twidget::NEW_request_reduce_width(maximum_width);
assert(config_);
if(!label_.empty() && can_wrap()) {
tpoint size = get_best_text_size(
tpoint(0,0),
tpoint(maximum_width - config_->text_extra_width, 0));
size.x += config_->text_extra_width;
size.y += config_->text_extra_height;
set_layout_size(size);
DBG_GUI_L << "tcontrol(" + get_control_type() + ") " + __func__ + ":"
<< " maximum_width " << maximum_width
<< " result " << size
<< ".\n";
} else {
DBG_GUI_L << "tcontrol(" + get_control_type() + ") " + __func__ + ":"
<< " failed; either no label or wrapping not allowed.\n";
}
}
void tcontrol::layout_wrap(const unsigned maximum_width)
{
// Inherited.

View File

@ -154,6 +154,9 @@ public:
void layout_init2(const bool full_initialization);
void NEW_layout_init(const bool full_initialization);
/** Inherited from twidget. */
void NEW_request_reduce_width(const unsigned maximum_width);
/** Inherited from twidget. */
void layout_wrap(const unsigned maximum_width);