KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
flutter/views/ViewWrapper.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: SĂ©rgio Martins <sergio.martins@kdab.com>
6
7 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
12#include "ViewWrapper_p.h"
13#include "core/View_p.h"
14#include "core/layouting/Item_p.h"
15#include "../Window_p.h"
16#include "View.h"
17
18using namespace KDDockWidgets;
19using namespace KDDockWidgets::flutter;
20
21ViewWrapper::ViewWrapper(flutter::View *wrapped)
22 : View(wrapped->controller(), Core::ViewType::ViewWrapper)
23 , m_wrappedView(wrapped)
24{
25 assert(wrapped);
26}
27
28ViewWrapper::~ViewWrapper()
29{
30}
31
32void ViewWrapper::setGeometry(Rect geo)
33{
34 m_wrappedView->setGeometry(geo);
35}
36
37void ViewWrapper::move(int x, int y)
38{
39 m_wrappedView->move(x, y);
40}
41
42bool ViewWrapper::close()
43{
44 return m_wrappedView->close();
45}
46
47bool ViewWrapper::isVisible() const
48{
49 return m_wrappedView->isVisible();
50}
51
52void ViewWrapper::setVisible(bool is)
53{
54 m_wrappedView->setVisible(is);
55}
56
57bool ViewWrapper::isExplicitlyHidden() const
58{
59 return m_wrappedView->isExplicitlyHidden();
60}
61
62void ViewWrapper::setSize(int w, int h)
63{
64 m_wrappedView->setSize(w, h);
65}
66
67std::shared_ptr<Core::View> ViewWrapper::rootView() const
68{
69 return m_wrappedView->rootView();
70}
71
72void ViewWrapper::enableAttribute(Qt::WidgetAttribute attr, bool enabled)
73{
74 m_wrappedView->enableAttribute(attr, enabled);
75}
76
77bool ViewWrapper::hasAttribute(Qt::WidgetAttribute attr) const
78{
79 return m_wrappedView->hasAttribute(attr);
80}
81
82void ViewWrapper::setFlag(Qt::WindowType flag, bool enabled)
83{
84 m_wrappedView->setFlag(flag, enabled);
85}
86
87Qt::WindowFlags ViewWrapper::flags() const
88{
89 return m_wrappedView->flags();
90}
91
92Size ViewWrapper::minSize() const
93{
94 return m_wrappedView->minSize();
95}
96
97Size ViewWrapper::maxSizeHint() const
98{
99 return m_wrappedView->maxSizeHint();
100}
101
102Rect ViewWrapper::geometry() const
103{
104 return m_wrappedView->geometry();
105}
106
107Rect ViewWrapper::normalGeometry() const
108{
109 return m_wrappedView->normalGeometry();
110}
111
112void ViewWrapper::setNormalGeometry(Rect geo)
113{
114 m_wrappedView->setNormalGeometry(geo);
115}
116
117void ViewWrapper::setMaximumSize(Size size)
118{
119 m_wrappedView->setMaximumSize(size);
120}
121
122void ViewWrapper::setWidth(int w)
123{
124 m_wrappedView->setWidth(w);
125}
126
127void ViewWrapper::setHeight(int h)
128{
129 m_wrappedView->setHeight(h);
130}
131
132void ViewWrapper::setFixedWidth(int w)
133{
134 m_wrappedView->setFixedWidth(w);
135}
136
137void ViewWrapper::setFixedHeight(int h)
138{
139 m_wrappedView->setFixedHeight(h);
140}
141
142void ViewWrapper::show()
143{
144 m_wrappedView->show();
145}
146
147void ViewWrapper::hide()
148{
149 m_wrappedView->hide();
150}
151
152void ViewWrapper::updateGeometry()
153{
154 m_wrappedView->updateGeometry();
155}
156
157void ViewWrapper::update()
158{
159 m_wrappedView->update();
160}
161
162void ViewWrapper::setParent(View *parent)
163{
164 m_wrappedView->setParent(parent);
165}
166
167void ViewWrapper::raiseAndActivate()
168{
169 m_wrappedView->raiseAndActivate();
170}
171
172void ViewWrapper::activateWindow()
173{
174 m_wrappedView->activateWindow();
175}
176
177void ViewWrapper::raise()
178{
179 m_wrappedView->raise();
180}
181
182bool ViewWrapper::isRootView() const
183{
184 return m_wrappedView->isRootView();
185}
186
187Point ViewWrapper::mapToGlobal(Point local) const
188{
189 return m_wrappedView->mapToGlobal(local);
190}
191
192Point ViewWrapper::mapFromGlobal(Point global) const
193{
194 return m_wrappedView->mapFromGlobal(global);
195}
196
197Point ViewWrapper::mapTo(View *view, Point pos) const
198{
199 return m_wrappedView->mapTo(view, pos);
200}
201
202void ViewWrapper::setWindowOpacity(double opacity)
203{
204 m_wrappedView->setWindowOpacity(opacity);
205}
206
207void ViewWrapper::setWindowTitle(const QString &title)
208{
209 m_wrappedView->setWindowTitle(title);
210}
211
212void ViewWrapper::setWindowIcon(const Icon &icon)
213{
214 m_wrappedView->setWindowIcon(icon);
215}
216
217bool ViewWrapper::isActiveWindow() const
218{
219 return m_wrappedView->isActiveWindow();
220}
221
222void ViewWrapper::showNormal()
223{
224 m_wrappedView->showNormal();
225}
226
227void ViewWrapper::showMinimized()
228{
229 m_wrappedView->showMinimized();
230}
231
232void ViewWrapper::showMaximized()
233{
234 m_wrappedView->showMaximized();
235}
236
237bool ViewWrapper::isMinimized() const
238{
239 return m_wrappedView->isMinimized();
240}
241
242bool ViewWrapper::isMaximized() const
243{
244 return m_wrappedView->isMaximized();
245}
246
247std::shared_ptr<Core::Window> ViewWrapper::window() const
248{
249 return m_wrappedView->window();
250}
251
252std::shared_ptr<Core::View> ViewWrapper::childViewAt(Point pos) const
253{
254 return m_wrappedView->childViewAt(pos);
255}
256
257std::shared_ptr<Core::View> ViewWrapper::parentView() const
258{
259 return m_wrappedView->parentView();
260}
261
262std::shared_ptr<Core::View> ViewWrapper::asWrapper()
263{
264 return m_thisWeakPtr.lock();
265}
266
267void ViewWrapper::setViewName(const QString &name)
268{
269 m_wrappedView->setViewName(name);
270}
271
272void ViewWrapper::grabMouse()
273{
274 m_wrappedView->grabMouse();
275}
276
277void ViewWrapper::releaseMouse()
278{
279 m_wrappedView->releaseMouse();
280}
281
282void ViewWrapper::releaseKeyboard()
283{
284 m_wrappedView->releaseKeyboard();
285}
286
287void ViewWrapper::setFocus(Qt::FocusReason reason)
288{
289 m_wrappedView->setFocus(reason);
290}
291
292bool ViewWrapper::hasFocus() const
293{
294 return m_wrappedView->hasFocus();
295}
296
297Qt::FocusPolicy ViewWrapper::focusPolicy() const
298{
299 return m_wrappedView->focusPolicy();
300}
301
302void ViewWrapper::setFocusPolicy(Qt::FocusPolicy policy)
303{
304 m_wrappedView->setFocusPolicy(policy);
305}
306
307QString ViewWrapper::viewName() const
308{
309 return m_wrappedView->viewName();
310}
311
312void ViewWrapper::setMinimumSize(Size size)
313{
314 m_wrappedView->setMinimumSize(size);
315}
316
317void ViewWrapper::render(QPainter *render)
318{
319 m_wrappedView->render(render);
320}
321
322void ViewWrapper::setCursor(Qt::CursorShape shape)
323{
324 m_wrappedView->setCursor(shape);
325}
326
327void ViewWrapper::setMouseTracking(bool tracking)
328{
329 m_wrappedView->setMouseTracking(tracking);
330}
331
332Vector<std::shared_ptr<Core::View>> ViewWrapper::childViews() const
333{
334 return m_wrappedView->childViews();
335}
336
337void ViewWrapper::setZOrder(int z)
338{
339 m_wrappedView->setZOrder(z);
340}
341
342Core::HANDLE ViewWrapper::handle() const
343{
344 return m_wrappedView->handle();
345}
346
347bool ViewWrapper::is(Core::ViewType type) const
348{
349 if (m_wrappedView)
350 return m_wrappedView->d->type() == type;
351
352 return type == Core::ViewType::ViewWrapper;
353}
354
355bool ViewWrapper::onResize(int w, int h)
356{
357 // Indirection so Dartagnan generates it, while we don't do bindings for View.cpp
358 return View::onResize(w, h);
359}
360
361/*static*/ std::shared_ptr<Core::View> ViewWrapper::create(flutter::View *wrapped)
362{
363 auto wrapper = new ViewWrapper(wrapped);
364 auto ptr = std::shared_ptr<ViewWrapper>(wrapper);
365 wrapper->setWeakPtr(ptr);
366
367 return ptr;
368}
369
370void ViewWrapper::setWeakPtr(std::weak_ptr<ViewWrapper> thisPtr)
371{
372 m_thisWeakPtr = thisPtr;
373}
ViewType
Each View type also has a specific Controller associated with, except for ViewType::None.
Definition Controller.h:26
const void * HANDLE
Definition core/View.h:28
Class to abstract QAction, so code still works with QtQuick and Flutter.
CursorShape
FocusPolicy
FocusReason
WidgetAttribute
WindowType

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated by doxygen 1.9.8