Allow a sizer to be fixed size,

...this is only available for C++ and not yetfor WML.
This commit is contained in:
Mark de Wever 2008-05-12 07:37:32 +00:00
parent 51f8b73e4b
commit b51e63abd1

View File

@ -24,7 +24,8 @@ class tspacer : public tcontrol
{
public:
tspacer() :
tcontrol(0)
tcontrol(0),
best_size_(0, 0)
{
load_config();
}
@ -37,8 +38,17 @@ public:
void draw(surface&) {}
void set_best_size(const tpoint& best_size) { best_size_ = best_size; }
/** Inherited from tcontrol. */
tpoint get_best_size() const
{ return best_size_ != tpoint(0, 0) ? best_size_ : tcontrol::get_best_size(); }
private:
/** When we're used as a fixed size item, this holds the best size. */
tpoint best_size_;
//! Inherited from tcontrol.
const std::string& get_control_type() const
{ static const std::string type = "spacer"; return type; }