All widget used the default defintion due to a bug, this has been fixed.
This commit is contained in:
parent
2474f3237f
commit
7b1312dfb6
14 changed files with 32 additions and 17 deletions
|
@ -29,7 +29,6 @@ public:
|
|||
retval_(0),
|
||||
callback_mouse_left_click_(0)
|
||||
{
|
||||
load_config();
|
||||
}
|
||||
|
||||
void mouse_enter(tevent_handler&);
|
||||
|
|
|
@ -224,6 +224,14 @@ void tcontrol::set_canvas_text()
|
|||
}
|
||||
}
|
||||
|
||||
void tcontrol::set_definition(const std::string& definition)
|
||||
{
|
||||
assert(!config());
|
||||
twidget::set_definition(definition);
|
||||
load_config();
|
||||
assert(config());
|
||||
}
|
||||
|
||||
void tcontrol::draw(surface& surface)
|
||||
{
|
||||
assert(config_);
|
||||
|
|
|
@ -67,6 +67,17 @@ public:
|
|||
tcanvas& canvas(const unsigned index)
|
||||
{ assert(index < canvas_.size()); return canvas_[index]; }
|
||||
|
||||
/**
|
||||
* Inherited from twidget.
|
||||
*
|
||||
* This function sets the defintion of a control and should be called soon
|
||||
* after creating the object since a lot of internal functions depend on the
|
||||
* definition.
|
||||
*
|
||||
* This function should be called one time only!!!
|
||||
*/
|
||||
void set_definition(const std::string& definition);
|
||||
|
||||
//! Inherited from twidget.
|
||||
void draw(surface& surface);
|
||||
|
||||
|
@ -84,7 +95,11 @@ public:
|
|||
tpoint get_best_size() const;
|
||||
tpoint get_maximum_size() const;
|
||||
|
||||
//! Inherited from twidget.
|
||||
/**
|
||||
* Inherited from twidget.
|
||||
*
|
||||
* This function shouldn't be called directly it's called by set_definition().
|
||||
*/
|
||||
void load_config();
|
||||
|
||||
private:
|
||||
|
|
|
@ -27,7 +27,6 @@ public:
|
|||
tcontrol(COUNT),
|
||||
state_(ENABLED)
|
||||
{
|
||||
load_config();
|
||||
}
|
||||
|
||||
void set_active(const bool active) { set_state(active ? ENABLED : DISABLED); };
|
||||
|
|
|
@ -80,7 +80,6 @@ tlistbox::tlistbox() :
|
|||
best_spacer_size_(0, 0),
|
||||
rows_()
|
||||
{
|
||||
load_config();
|
||||
}
|
||||
|
||||
void tlistbox::list_item_selected(twidget* caller)
|
||||
|
|
|
@ -26,14 +26,11 @@ class tpanel : public tcontrol
|
|||
public:
|
||||
//! Constructor.
|
||||
//!
|
||||
//! @param load_conf When a class inherits from a panel that
|
||||
//! config should be loaded, so set this to false.
|
||||
//! @param canvas_count The canvas count for tcontrol.
|
||||
tpanel(const bool load_conf = true, const unsigned canvas_count = 2) :
|
||||
tpanel(const unsigned canvas_count = 2) :
|
||||
tcontrol(canvas_count),
|
||||
grid_()
|
||||
{
|
||||
if(load_conf) load_config();
|
||||
grid_.set_parent(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ public:
|
|||
tcontrol(0),
|
||||
best_size_(0, 0)
|
||||
{
|
||||
load_config();
|
||||
}
|
||||
|
||||
//! Inherited from tcontrol.
|
||||
|
|
|
@ -78,7 +78,6 @@ public:
|
|||
text_height_(0),
|
||||
dragging_(false)
|
||||
{
|
||||
load_config();
|
||||
set_wants_mouse_left_double_click();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ public:
|
|||
state_(ENABLED),
|
||||
callback_mouse_left_click_(0)
|
||||
{
|
||||
load_config();
|
||||
}
|
||||
|
||||
void mouse_enter(tevent_handler&);
|
||||
|
|
|
@ -26,7 +26,6 @@ public:
|
|||
ttooltip() :
|
||||
tcontrol(1)
|
||||
{
|
||||
load_config();
|
||||
set_multiline_label();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ public:
|
|||
tvertical_scrollbar() :
|
||||
tscrollbar_()
|
||||
{
|
||||
load_config();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
|
||||
//! This should not be changed after the widget is shown, strange things
|
||||
//! might occur.
|
||||
void set_definition(const std::string& definition)
|
||||
virtual void set_definition(const std::string& definition)
|
||||
{ definition_ = definition; }
|
||||
|
||||
//! Draws a widget.
|
||||
|
|
|
@ -55,7 +55,7 @@ twindow::twindow(CVideo& video,
|
|||
const bool automatic_placement,
|
||||
const unsigned horizontal_placement,
|
||||
const unsigned vertical_placement) :
|
||||
tpanel(false),
|
||||
tpanel(),
|
||||
tevent_handler(),
|
||||
video_(video),
|
||||
status_(NEW),
|
||||
|
@ -67,6 +67,7 @@ twindow::twindow(CVideo& video,
|
|||
horizontal_placement_(horizontal_placement),
|
||||
vertical_placement_(vertical_placement)
|
||||
{
|
||||
// We load the config in here as exception.
|
||||
load_config();
|
||||
|
||||
set_size(::create_rect(x, y, w, h));
|
||||
|
|
|
@ -819,12 +819,14 @@ twidget* tbuilder_listbox::build() const
|
|||
twidget* list_area = 0;
|
||||
if(list_builder) {
|
||||
list_area = new tspacer();
|
||||
assert(list_area);
|
||||
list_area->set_definition("default");
|
||||
} else {
|
||||
assert(list);
|
||||
/*tgrid* */list_area = dynamic_cast<tgrid*>(list->build());
|
||||
list_area = dynamic_cast<tgrid*>(list->build());
|
||||
assert(list_area);
|
||||
}
|
||||
|
||||
assert(list_area);
|
||||
list_area->set_id("_list");
|
||||
|
||||
listbox->grid().set_rows_cols(1, 2);
|
||||
|
|
Loading…
Add table
Reference in a new issue