Debug Tools and Scrollable widget

This commit is contained in:
IlyaShurupov 2024-10-18 15:18:50 +03:00
parent f68f91f7d5
commit 458e56fb4c
27 changed files with 274 additions and 103 deletions

View file

@ -80,9 +80,11 @@ void DockWidget::process(const EventHandler& events) {
if (events.isPressed(InputID::MOUSE1)) {
if (layout()->startResize(events.getPointer())) {
triggerWidgetUpdate("dock layout resizing");
lockFocus();
}
} else if (events.isReleased(InputID::MOUSE1)) {
layout()->endResize();
freeFocus();
}
if (layout()->isResizing()) {

View file

@ -1,4 +1,6 @@
#include "ScrollableWidget.hpp"
#include "ScrollableLayout.hpp"
#include "BasicLayout.hpp"
using namespace tp;
@ -84,4 +86,21 @@ void ScrollableBarWidget::updateHandleRect() {
const RectF& ScrollableBarWidget::getHandleRect() const {
return mHandleRect;
}
}
ScrollableWidget::ScrollableWidget() {
addChild(&mScroller);
addChild(&mContent);
setLayout(new ScrollableLayout(this));
mContent.setSizePolicy(SizePolicy::Minimal, SizePolicy::Minimal);
}
void ScrollableWidget::setDirection(bool direction) {
if (auto lay = dynamic_cast<BasicLayout*>(mContent.getLayout())) {
lay->setLayoutPolicy(direction ? LayoutPolicy::Vertical : LayoutPolicy::Horizontal);
}
mScroller.setDirection(direction);
}