dockspce widget initial
This commit is contained in:
parent
559c91a144
commit
7158be5890
8 changed files with 72 additions and 12 deletions
34
Widgets/private/DockspaceWidget.cpp
Normal file
34
Widgets/private/DockspaceWidget.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "DockspaceWidget.hpp"
|
||||
|
||||
using namespace tp;
|
||||
|
||||
void DockSpaceWidget::eventProcess(const tp::Events& events) {
|
||||
|
||||
if (this->mChildWidgets.size() > 1 && events.isPressed(InputID::MOUSE1)) {
|
||||
|
||||
Widget* activeChild = nullptr;
|
||||
|
||||
for (auto childNode = this->mChildWidgets.firstNode(); childNode; childNode = childNode->next) {
|
||||
auto child = childNode->data;
|
||||
if (child->mArea.isInside(events.getPointer())) {
|
||||
|
||||
mChildWidgets.detach(childNode);
|
||||
mChildWidgets.pushFront(childNode);
|
||||
|
||||
child->mHandlesEvents = true;
|
||||
activeChild = child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (activeChild) {
|
||||
for (auto child : this->mChildWidgets) {
|
||||
if (activeChild != child.data()) child->mHandlesEvents = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DockSpaceWidget::eventDraw(Canvas& canvas) {
|
||||
canvas.rect(this->mArea, RGBA(0, 0, 0, 1), 0);
|
||||
}
|
||||
|
|
@ -9,11 +9,11 @@ FloatingWidget::FloatingWidget() {
|
|||
}
|
||||
|
||||
void FloatingWidget::eventProcess(const Events& events) {
|
||||
mActionStartRelativePos = events.getPointerPrev() - this->mArea.pos;
|
||||
|
||||
checkFloating(events);
|
||||
checkResizing(events);
|
||||
|
||||
mActionStartRelativePos = events.getPointer() - this->mArea.pos;
|
||||
|
||||
CollapsableMenu::eventProcess(events);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,10 +17,13 @@ void Widget::procWrapper(const Events& events, const RectF& parentArea) {
|
|||
|
||||
checkClicked(events);
|
||||
|
||||
eventProcess(events);
|
||||
if (mHandlesEvents) {
|
||||
|
||||
for (auto child : mChildWidgets) {
|
||||
child->procWrapper(events, getArea());
|
||||
eventProcess(events);
|
||||
|
||||
for (auto child : mChildWidgets) {
|
||||
child->procWrapper(events, getArea());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -31,8 +34,8 @@ void Widget::drawWrapper(Canvas& canvas) {
|
|||
|
||||
// draw child widgets
|
||||
canvas.pushClamp(this->mArea);
|
||||
for (auto child : mChildWidgets) {
|
||||
child->drawWrapper(canvas);
|
||||
for (auto child = mChildWidgets.lastNode(); child; child = child->prev) {
|
||||
child->data->drawWrapper(canvas);
|
||||
}
|
||||
canvas.popClamp();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue