mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 10:38:13 +00:00
Allow a sizer to be fixed size,
...this is only available for C++ and not yetfor WML.
This commit is contained in:
parent
51f8b73e4b
commit
b51e63abd1
@ -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; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user