diff --git a/pui/container.cpp b/pui/container.cpp index c79deb3..95d8041 100644 --- a/pui/container.cpp +++ b/pui/container.cpp @@ -138,6 +138,7 @@ void HBox::Pack(Widget *widget) widget->y = this->y; widget->h = this->h; if (widget->w < 0) widget->w = this->w - (widget->x - this->x); + if (this->x + this->w < widget->x + widget->w) this->w = widget->x + widget->w - this->x; Container::Pack(widget); } @@ -148,5 +149,6 @@ void VBox::Pack(Widget *widget) widget->y = (last == NULL) ? this->y : (last->y + last->h + this->padding); widget->w = this->w; if (widget->h < 0) widget->h = this->h - (widget->y - this->y); + if (this->y + this->h < widget->y + widget->h) this->h = widget->y + widget->h - this->y; Container::Pack(widget); } diff --git a/pui/slider.cpp b/pui/slider.cpp index df5eff4..6769719 100644 --- a/pui/slider.cpp +++ b/pui/slider.cpp @@ -47,6 +47,18 @@ enum SliderPart { SP_HRIGHT, }; +HSlider::HSlider(bool big, int h) +{ + this->h = h; + this->big = big; +} + +VSlider::VSlider(bool big, int w) +{ + this->w = w; + this->big = big; +} + float HSlider::GetNewValue(int x, int y) { int x2 = this->x + pad; diff --git a/pui/slider.h b/pui/slider.h index bf434cb..6e0d8be 100644 --- a/pui/slider.h +++ b/pui/slider.h @@ -22,12 +22,16 @@ struct Slider : Widget { }; struct HSlider : Slider { + HSlider(bool big = false, int h = 24); + /* virtual */ float GetNewValue(int x, int y); /* virtual */ void OnPaint(const PUi *pui) const; }; struct VSlider : Slider { + VSlider(bool big = false, int w = 24); + /* virtual */ float GetNewValue(int x, int y); /* virtual */ void OnPaint(const PUi *pui) const;