Allow changing GenericBox later.

This commit is contained in:
John Preston 2021-04-07 15:42:12 +04:00
parent 876f0f06dc
commit a51db55ef2
2 changed files with 6 additions and 4 deletions

View file

@ -16,7 +16,7 @@ namespace Ui {
void GenericBox::prepare() {
_init(this);
auto wrap = object_ptr<Ui::OverrideMargins>(this, std::move(_content));
auto wrap = object_ptr<Ui::OverrideMargins>(this, std::move(_owned));
setDimensionsToContent(_width ? _width : st::boxWidth, wrap.data());
setInnerWidget(std::move(wrap));
}
@ -26,7 +26,7 @@ void GenericBox::addSkip(int height) {
}
not_null<Ui::VerticalLayout*> GenericBox::verticalLayout() {
return _content.data();
return _content;
}
} // namespace Ui

View file

@ -120,7 +120,8 @@ private:
FnMut<void(not_null<GenericBox*>)> _init;
Fn<void()> _focus;
Fn<void()> _showFinished;
object_ptr<Ui::VerticalLayout> _content;
object_ptr<Ui::VerticalLayout> _owned;
not_null<Ui::VerticalLayout*> _content;
int _width = 0;
};
@ -166,7 +167,8 @@ inline GenericBox::GenericBox(
MakeIniter(
std::forward<InitMethod>(init),
std::forward<InitArgs>(args)...))
, _content(this) {
, _owned(this)
, _content(_owned.data()) {
}
} // namespace Ui