Support retrieving buttons from spinbox
This commit is contained in:
parent
3f9275b2ad
commit
59de6682ba
2 changed files with 13 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ namespace psemek::ui
|
||||||
{
|
{
|
||||||
|
|
||||||
struct label;
|
struct label;
|
||||||
|
struct button;
|
||||||
|
|
||||||
struct spinbox
|
struct spinbox
|
||||||
: element
|
: element
|
||||||
|
|
@ -28,7 +29,9 @@ namespace psemek::ui
|
||||||
|
|
||||||
virtual void on_value_changed(on_value_changed_callback callback, bool notify = true);
|
virtual void on_value_changed(on_value_changed_callback callback, bool notify = true);
|
||||||
|
|
||||||
virtual struct label * label() { return nullptr; }
|
virtual struct label * label() const { return nullptr; }
|
||||||
|
virtual button * dec_button() const { return nullptr; }
|
||||||
|
virtual button * inc_button() const { return nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void post_value_changed();
|
virtual void post_value_changed();
|
||||||
|
|
|
||||||
|
|
@ -692,6 +692,9 @@ namespace psemek::ui
|
||||||
child_ = layout;
|
child_ = layout;
|
||||||
children_range_[0] = child_.get();
|
children_range_[0] = child_.get();
|
||||||
child_->set_parent(this);
|
child_->set_parent(this);
|
||||||
|
|
||||||
|
inc_button_ = inc_button.get();
|
||||||
|
dec_button_ = dec_button.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
geom::box<float, 2> size_constraints() const override
|
geom::box<float, 2> size_constraints() const override
|
||||||
|
|
@ -717,6 +720,9 @@ namespace psemek::ui
|
||||||
void draw(painter &) const override
|
void draw(painter &) const override
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
button * dec_button() const override { return dec_button_; }
|
||||||
|
button * inc_button() const override { return inc_button_; }
|
||||||
|
|
||||||
~spinbox_impl()
|
~spinbox_impl()
|
||||||
{
|
{
|
||||||
release_children();
|
release_children();
|
||||||
|
|
@ -725,6 +731,9 @@ namespace psemek::ui
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<element> child_;
|
std::shared_ptr<element> child_;
|
||||||
element * children_range_[1] {nullptr};
|
element * children_range_[1] {nullptr};
|
||||||
|
|
||||||
|
button * inc_button_;
|
||||||
|
button * dec_button_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue