Added support of min height to Ui::GenericBox.

This commit is contained in:
23rd 2022-12-12 18:16:56 +03:00
parent 49d9a020a3
commit f339dd3771
2 changed files with 8 additions and 1 deletions

View file

@ -32,7 +32,10 @@ void GenericBox::prepare() {
const auto desired = top + height;
setDimensions(
currentWidth,
_maxHeight ? std::min(desired, _maxHeight) : desired,
std::clamp(
desired,
_minHeight ? _minHeight : desired,
_maxHeight ? _maxHeight : desired),
true);
}, wrap->lifetime());

View file

@ -74,6 +74,9 @@ public:
void setMaxHeight(int maxHeight) {
_maxHeight = maxHeight;
}
void setMinHeight(int minHeight) {
_minHeight = minHeight;
}
void setScrollStyle(const style::ScrollArea &st) {
_scrollSt = &st;
}
@ -137,6 +140,7 @@ private:
not_null<Ui::VerticalLayout*> _content;
const style::ScrollArea *_scrollSt = nullptr;
int _width = 0;
int _minHeight = 0;
int _maxHeight = 0;
object_ptr<Ui::RpWidget> _pinnedToTopContent = { nullptr };