Scrolling layout

This commit is contained in:
IlyaShurupov 2024-10-17 16:46:49 +03:00
parent 03b2b5d038
commit 047d67c4fa
14 changed files with 288 additions and 35 deletions

View file

@ -14,6 +14,9 @@ DebugManager tp::gDebugWidget;
bool DebugManager::update(RootWidget* rootWidget, EventHandler& events) {
mRootWidget = rootWidget;
events.setEnableKeyEvents(true);
if (events.isPressed(InputID::D)) mDebug = !mDebug;
if (mDebug) {
auto area = rootWidget->mRoot.getAreaT();
area.size -= { 400, 0 };
@ -53,12 +56,12 @@ bool DebugManager::update(RootWidget* rootWidget, EventHandler& events) {
void DebugManager::drawDebug(RootWidget* rootWidget, Canvas& canvas) {
mRootWidget = rootWidget;
ImGui::Checkbox("Draw debug", &mDebug);
if (!mDebug) {
return;
}
// ImGui::Checkbox("Draw debug", &mDebug);
ImGui::SameLine(); ImGui::Text("To Toggle processing press k");
auto& upd = rootWidget->mUpdateManager;

View file

@ -2,6 +2,7 @@
#include "DebugManager.hpp"
#include "DockLayout.hpp"
#include "ScrollableLayout.hpp"
#include <algorithm>
@ -91,6 +92,7 @@ int LayoutManager::getLayoutOrder(WidgetLayout* parent, WidgetLayout* child) con
auto policyChild = parent->getSizePolicy()[mVertical];
if (dynamic_cast<DockLayout*>(parent)) return -1;
// if (dynamic_cast<ScrollableLayout*>(parent)) return -1;
return sizePolicyDep[int(policyParent)][int(policyChild)];
}

View file

@ -206,6 +206,6 @@ void UpdateManager::lockFocus(tp::Widget* widget) {
}
void UpdateManager::freeFocus(tp::Widget* widget) {
DEBUG_ASSERT(mFocusLockWidget == widget)
// DEBUG_ASSERT(mFocusLockWidget == widget)
mFocusLockWidget = nullptr;
}