Sizing fixes
This commit is contained in:
parent
e9a4801d9e
commit
89d5a6d87c
4 changed files with 20 additions and 11 deletions
|
|
@ -27,22 +27,26 @@ public:
|
||||||
void setup1() {
|
void setup1() {
|
||||||
mRootWidget.setRootWidget(&mDockLayout);
|
mRootWidget.setRootWidget(&mDockLayout);
|
||||||
|
|
||||||
mDockLayout.addChild(&mFloatingMenu);
|
|
||||||
mDockLayout.addChild(&mFloatingMenu2);
|
mDockLayout.addChild(&mFloatingMenu2);
|
||||||
|
mDockLayout.addChild(&mFloatingMenu);
|
||||||
|
|
||||||
mDockLayout.setCenterWidget(&mButton4);
|
mDockLayout.setCenterWidget(&mButton5);
|
||||||
mDockLayout.dockWidget(&mButton3, DockLayoutWidget::RIGHT);
|
mDockLayout.dockWidget(&mButton6, DockLayoutWidget::RIGHT);
|
||||||
|
|
||||||
mFloatingMenu.addToMenu(&mButton);
|
mFloatingMenu.addToMenu(&mButton);
|
||||||
mFloatingMenu2.addToMenu(&mButton2);
|
mFloatingMenu2.addToMenu(&mButton2);
|
||||||
|
//mFloatingMenu2.addToMenu(&mFloatingMenu);
|
||||||
|
mFloatingMenu2.addToMenu(&mButton3);
|
||||||
|
mFloatingMenu2.addToMenu(&mButton4);
|
||||||
|
|
||||||
mButton.setAction([this]() { mButton2.setColor(RGBA::random()); });
|
mButton.setAction([this]() { mButton2.setColor(RGBA::random()); });
|
||||||
mButton2.setAction([this]() { mButton.setColor(RGBA::random()); });
|
mButton2.setAction([this]() { mButton.setColor(RGBA::random()); });
|
||||||
|
|
||||||
mButton3.setAction([this]() { mDockLayout.dockWidget(&mFloatingMenu, DockLayoutWidget::Side::LEFT); });
|
mButton5.setAction([this]() { mDockLayout.dockWidget(&mFloatingMenu, DockLayoutWidget::Side::LEFT); });
|
||||||
mButton3.setText("dock");
|
mButton6.setAction([this]() { mDockLayout.undockWidget(DockLayoutWidget::Side::LEFT); });
|
||||||
|
|
||||||
mButton4.setAction([this]() { mDockLayout.undockWidget(DockLayoutWidget::Side::LEFT); });
|
mButton5.setText("dock");
|
||||||
|
mButton6.setText("undock");
|
||||||
|
|
||||||
// mLayoutWidget.addChild(&mButton2);
|
// mLayoutWidget.addChild(&mButton2);
|
||||||
|
|
||||||
|
|
@ -53,8 +57,8 @@ public:
|
||||||
// mAnimationTestWidget.addChild(&mWidgetFloating);
|
// mAnimationTestWidget.addChild(&mWidgetFloating);
|
||||||
// mAnimationTestWidget.addChild(&mLayoutWidget);
|
// mAnimationTestWidget.addChild(&mLayoutWidget);
|
||||||
|
|
||||||
RootWidget::setWidgetArea(mFloatingMenu2, { 300, 100, 150, 200 });
|
RootWidget::setWidgetArea(mFloatingMenu2, { 300, 100, 150, 500 });
|
||||||
RootWidget::setWidgetArea(mFloatingMenu, { 100, 100, 150, 200 });
|
RootWidget::setWidgetArea(mFloatingMenu, { 100, 100, 150, 300 });
|
||||||
|
|
||||||
// mWidgetFloating.addChild(&mLayoutWidget);
|
// mWidgetFloating.addChild(&mLayoutWidget);
|
||||||
|
|
||||||
|
|
@ -120,6 +124,8 @@ private:
|
||||||
ButtonWidget mButton2;
|
ButtonWidget mButton2;
|
||||||
ButtonWidget mButton3;
|
ButtonWidget mButton3;
|
||||||
ButtonWidget mButton4;
|
ButtonWidget mButton4;
|
||||||
|
ButtonWidget mButton5;
|
||||||
|
ButtonWidget mButton6;
|
||||||
|
|
||||||
FloatingWidget mFloatingWidget;
|
FloatingWidget mFloatingWidget;
|
||||||
FloatingMenu mFloatingMenu;
|
FloatingMenu mFloatingMenu;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ void RootWidget::processFrame(EventHandler* events, const RectF& screenArea) {
|
||||||
|
|
||||||
if (mDebug) {
|
if (mDebug) {
|
||||||
mScreenArea.size -= { 400, 0 };
|
mScreenArea.size -= { 400, 0 };
|
||||||
|
events->setEnableKeyEvents(true);
|
||||||
if (events->isPressed(InputID::K)) mDebugStopProcessing = !mDebugStopProcessing;
|
if (events->isPressed(InputID::K)) mDebugStopProcessing = !mDebugStopProcessing;
|
||||||
if (mDebugStopProcessing) return;
|
if (mDebugStopProcessing) return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,10 @@ void Widget::adjustLayout(bool vertical) {
|
||||||
Vec2F availableSize = getRelativeAreaT().size;
|
Vec2F availableSize = getRelativeAreaT().size;
|
||||||
|
|
||||||
for (auto child : mChildren) {
|
for (auto child : mChildren) {
|
||||||
|
if (child->mSizePolicy[!vertical] != SizePolicy::Minimal) {
|
||||||
|
child->pickRect();
|
||||||
|
}
|
||||||
|
|
||||||
if (child->mSizePolicy[vertical] == SizePolicy::Expanding) {
|
if (child->mSizePolicy[vertical] == SizePolicy::Expanding) {
|
||||||
contributors.emplace_back( child, true );
|
contributors.emplace_back( child, true );
|
||||||
|
|
||||||
|
|
@ -217,8 +221,6 @@ void Widget::adjustLayout(bool vertical) {
|
||||||
child->setAreaCache(area);
|
child->setAreaCache(area);
|
||||||
child->clampRect();
|
child->clampRect();
|
||||||
|
|
||||||
} else {
|
|
||||||
// child->triggerWidgetUpdate("expand child in layout");
|
|
||||||
}
|
}
|
||||||
contentSize += child->getAreaCache().size;
|
contentSize += child->getAreaCache().size;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace tp {
|
||||||
FloatingWidget() {
|
FloatingWidget() {
|
||||||
setDebug("float", { 0.0, 0.9, 0.1, 1 });
|
setDebug("float", { 0.0, 0.9, 0.1, 1 });
|
||||||
|
|
||||||
// mSizePolicy = { SizePolicy::Contract, SizePolicy::Contract };
|
mSizePolicy = { SizePolicy::Fixed, SizePolicy::Fixed };
|
||||||
mLayoutPolicy = LayoutPolicy::Horizontally;
|
mLayoutPolicy = LayoutPolicy::Horizontally;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue