widgets cleanups
This commit is contained in:
parent
b8f125b472
commit
559c91a144
2 changed files with 21 additions and 2 deletions
|
|
@ -21,7 +21,13 @@ void CollapsableMenu::eventDraw(Canvas& canvas) {
|
||||||
canvas.rect(this->mArea.shrink(mBorderSize), mMenuColor, rounding);
|
canvas.rect(this->mArea.shrink(mBorderSize), mMenuColor, rounding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollapsableMenu::addWidgetToMenu(Widget* widget) { mBody.addWidget(widget); }
|
void CollapsableMenu::addWidgetToMenu(Widget* widget) {
|
||||||
|
mBody.addWidget(widget);
|
||||||
|
|
||||||
|
EventHandler ev;
|
||||||
|
mBody.procWrapper(ev, this->mArea);
|
||||||
|
updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
void CollapsableMenu::setLabel(const std::string& string) { mHeader.mLabel = string; }
|
void CollapsableMenu::setLabel(const std::string& string) { mHeader.mLabel = string; }
|
||||||
|
|
||||||
|
|
@ -40,6 +46,7 @@ void CollapsableMenu::updateGeometry() {
|
||||||
mHeader.setArea(getHeaderRect());
|
mHeader.setArea(getHeaderRect());
|
||||||
|
|
||||||
mBody.mEnable = !mCollapsed;
|
mBody.mEnable = !mCollapsed;
|
||||||
|
|
||||||
if (mCollapsed) {
|
if (mCollapsed) {
|
||||||
this->mArea.size.y = headerHeight;
|
this->mArea.size.y = headerHeight;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,11 @@ ScrollableWindow::~ScrollableWindow() = default;
|
||||||
void ScrollableWindow::eventProcess(const Events& events) {
|
void ScrollableWindow::eventProcess(const Events& events) {
|
||||||
List<Widget*>& content = mContentWidget.mChildWidgets;
|
List<Widget*>& content = mContentWidget.mChildWidgets;
|
||||||
|
|
||||||
|
// to account all changed geometry of child widgets
|
||||||
|
for (auto widget : content) {
|
||||||
|
widget->procWrapper(events, this->mArea);
|
||||||
|
}
|
||||||
|
|
||||||
updateContents(content);
|
updateContents(content);
|
||||||
updateContentSize(content);
|
updateContentSize(content);
|
||||||
|
|
||||||
|
|
@ -119,7 +124,14 @@ void ScrollableWindow::eventProcess(const Events& events) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollableWindow::addWidget(Widget* widget) { mContentWidget.mChildWidgets.pushBack(widget); }
|
void ScrollableWindow::addWidget(Widget* widget) {
|
||||||
|
mContentWidget.mChildWidgets.pushBack(widget);
|
||||||
|
|
||||||
|
List<Widget*>& content = mContentWidget.mChildWidgets;
|
||||||
|
updateContents(content);
|
||||||
|
updateContentSize(content);
|
||||||
|
}
|
||||||
|
|
||||||
void ScrollableWindow::clearContent() { mContentWidget.mChildWidgets.removeAll(); }
|
void ScrollableWindow::clearContent() { mContentWidget.mChildWidgets.removeAll(); }
|
||||||
List<Widget*>& ScrollableWindow::getContent() { return mContentWidget.mChildWidgets; }
|
List<Widget*>& ScrollableWindow::getContent() { return mContentWidget.mChildWidgets; }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue