14#include "core/Logging_p.h"
15#include "core/View_p.h"
16#include "core/layouting/Item_p.h"
17#include "../Window_p.h"
18#include "ViewWrapper_p.h"
27 : Core::
View(controller, type)
29 m_minSize = Core::Item::hardcodedMinimumSize;
30 m_maxSize = Core::Item::hardcodedMaximumSize;
31 m_geometry = Rect(0, 0, 400, 400);
50 if (geo != m_geometry) {
58 if (m_geometry.topLeft() != Point(
x,
y)) {
59 m_geometry.moveTopLeft(Point(
x,
y));
71 if (ev.isAccepted()) {
82 if (!m_visible.value_or(
false))
86 return !m_parentView || m_parentView->
isVisible();
91 if (!m_visible.has_value() ||
is != m_visible.value()) {
96 for (
auto child : std::as_const(m_childViews)) {
97 if (!child->isExplicitlyHidden()) {
98 child->setVisible(
true);
111 return m_visible.has_value() && !m_visible.value();
116 m_geometry.setSize(Size(w, h));
172 s = s.boundedTo(Core::Item::hardcodedMaximumSize);
173 if (s != m_maxSize) {
175 d->layoutInvalidated.emit();
181 if (m_geometry.width() != w) {
182 m_geometry.setWidth(w);
189 if (m_geometry.height() != h) {
190 m_geometry.setHeight(h);
227 if (parent == m_parentView)
230 auto oldParent = m_parentView;
231 m_parentView =
static_cast<View *
>(parent);
234 if (!oldParent->inDtor())
236 oldParent->m_childViews.erase(std::remove_if(oldParent->m_childViews.begin(), oldParent->m_childViews.end(),
238 return v->equals(this);
240 oldParent->m_childViews.end());
252 m_parentView->m_childViews.append(
this);
256 m_visible = std::nullopt;
287 return m_parentView ==
nullptr;
292 KDDW_WARN(
"View::mapToGlobal: Implemented in dart");
298 KDDW_WARN(
"View::mapFromGlobal: Implemented in dart");
357 return std::shared_ptr<Core::Window>(
window);
367 for (
auto child : m_childViews) {
372 if (
auto result = child->childViewAt(child->mapFromGlobal(globalPt))) {
377 if (
rect().contains(localPos))
394 return ViewWrapper::create(
this);
422 return focusedView && focusedView->equals(
this);
441 s = s.expandedTo(Core::Item::hardcodedMinimumSize);
442 if (s != m_minSize) {
444 d->layoutInvalidated.emit();
463 children.
reserve(m_childViews.size());
464 for (
auto child : m_childViews)
489 KDDW_ERROR(
"Derived class should be called instead");
496 KDDW_ERROR(
"Derived class should be called instead");
503 KDDW_ERROR(
"Derived class should be called instead");
509 KDDW_ERROR(
"Derived class should be called instead");
515 KDDW_ERROR(
"Derived class should be called instead");
521 KDDW_ERROR(
"Derived class should be called instead");
530 if (eventType == Event::MouseMove) {
535 auto me =
new MouseEvent(eventType, localPos, globalPos, globalPos, buttons, buttons, modifiers);
540 if (eventType == Event::Type::MouseButtonPress)
549 KDDW_WARN(
"View::isMounted: Implemented in dart instead");
556 KDDW_WARN(
"View::onRebuildRequested: Implemented in dart instead");
typedef KeyboardModifiers