KDDockWidgets API Documentation 2.1
Loading...
Searching...
No Matches
KDDWBindingsCore/MainWindow_c.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2019 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#include "MainWindow_c.h"
12
13
14#include <iostream>
15
16#include <cassert>
17
18
19namespace Dartagnan {
20
21typedef int (*CleanupCallback)(void *thisPtr);
23
24template<typename T>
25struct ValueWrapper
26{
27 T value;
28};
29
30}
32namespace KDDWBindingsCore {
34 : ::KDDockWidgets::Core::MainWindow(view, uniqueName, options)
35{
36}
50{
51 return ::KDDockWidgets::Core::MainWindow::anySideBarIsVisible();
52}
53KDDockWidgets::Margins MainWindow_wrapper::centerWidgetMargins() const
54{
55 return ::KDDockWidgets::Core::MainWindow::centerWidgetMargins();
56}
57KDDockWidgets::Rect MainWindow_wrapper::centralAreaGeometry() const
58{
59 return ::KDDockWidgets::Core::MainWindow::centralAreaGeometry();
60}
66{
67 return ::KDDockWidgets::Core::MainWindow::closeDockWidgets(force);
68}
70{
71 return ::KDDockWidgets::Core::MainWindow::dropArea();
72}
78{
79 return ::KDDockWidgets::Core::MainWindow::isMDI();
80}
82{
83 return ::KDDockWidgets::Core::MainWindow::layout();
84}
98{
99 return ::KDDockWidgets::Core::MainWindow::multiSplitter();
100}
102{
103 return ::KDDockWidgets::Core::MainWindow::options();
104}
106{
107 return ::KDDockWidgets::Core::MainWindow::overlayMargin();
108}
114{
115 return ::KDDockWidgets::Core::MainWindow::overlayedDockWidget();
116}
130{
132 const void *thisPtr = this;
133 m_setParentView_implCallback(const_cast<void *>(thisPtr), parent);
134 } else {
136 }
137}
147{
148 return ::KDDockWidgets::Core::MainWindow::sideBarForDockWidget(dw);
149}
155{
156 return ::KDDockWidgets::Core::MainWindow::uniqueName();
157}
161
162}
163}
165{
166 return reinterpret_cast<KDDockWidgets::Core::MainWindow *>(ptr);
167}
172extern "C" {
177void *c_KDDockWidgets__Core__MainWindow__constructor_View_QString_MainWindowOptions(void *view_, const char *uniqueName_, int options_)
178{
179 auto view = reinterpret_cast<KDDockWidgets::Core::View *>(view_);
180 const auto uniqueName = QString::fromUtf8(uniqueName_);
181 auto options = static_cast<QFlags<KDDockWidgets::MainWindowOption>>(options_);
182 auto ptr = new KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::MainWindow_wrapper(view, uniqueName, options);
183 return reinterpret_cast<void *>(ptr);
184}
185// addDockWidget(KDDockWidgets::Core::DockWidget * dockWidget, KDDockWidgets::Location location, KDDockWidgets::Core::DockWidget * relativeTo, KDDockWidgets::InitialOption initialOption)
186void c_KDDockWidgets__Core__MainWindow__addDockWidget_DockWidget_Location_DockWidget_InitialOption(void *thisObj, void *dockWidget_, int location, void *relativeTo_, void *initialOption_)
187{
188 auto dockWidget = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(dockWidget_);
189 auto relativeTo = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(relativeTo_);
190 assert(initialOption_);
191 auto &initialOption = *reinterpret_cast<KDDockWidgets::InitialOption *>(initialOption_);
192 fromPtr(thisObj)->addDockWidget(dockWidget, static_cast<KDDockWidgets::Location>(location), relativeTo, initialOption);
193}
194// addDockWidgetAsTab(KDDockWidgets::Core::DockWidget * dockwidget)
196{
197 auto dockwidget = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(dockwidget_);
198 fromPtr(thisObj)->addDockWidgetAsTab(dockwidget);
199}
200// addDockWidgetToSide(KDDockWidgets::Core::DockWidget * dockWidget, KDDockWidgets::Location location, KDDockWidgets::InitialOption initialOption)
201void c_KDDockWidgets__Core__MainWindow__addDockWidgetToSide_DockWidget_Location_InitialOption(void *thisObj, void *dockWidget_, int location, void *initialOption_)
202{
203 auto dockWidget = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(dockWidget_);
204 assert(initialOption_);
205 auto &initialOption = *reinterpret_cast<KDDockWidgets::InitialOption *>(initialOption_);
206 fromPtr(thisObj)->addDockWidgetToSide(dockWidget, static_cast<KDDockWidgets::Location>(location), initialOption);
207}
208// anySideBarIsVisible() const
210{
211 const auto &result = fromPtr(thisObj)->anySideBarIsVisible();
212 return result;
213}
214// centerWidgetMargins() const
216{
217 const auto &result = new Dartagnan::ValueWrapper<KDDockWidgets::Margins> { fromPtr(thisObj)->centerWidgetMargins() };
218 return result;
219}
220// centralAreaGeometry() const
222{
223 const auto &result = new Dartagnan::ValueWrapper<KDDockWidgets::Rect> { fromWrapperPtr(thisObj)->centralAreaGeometry() };
224 return result;
225}
226// clearSideBarOverlay(bool deleteGroup)
228{
229 fromPtr(thisObj)->clearSideBarOverlay(deleteGroup);
230}
231// closeDockWidgets(bool force)
233{
234 const auto &result = fromPtr(thisObj)->closeDockWidgets(force);
235 return result;
236}
237// dropArea() const
239{
240 const auto &result = fromPtr(thisObj)->dropArea();
241 return result;
242}
243// init(const QString & name)
244void c_KDDockWidgets__Core__MainWindow__init_QString(void *thisObj, const char *name_)
245{
246 const auto name = QString::fromUtf8(name_);
247 fromPtr(thisObj)->init(name);
248 free(( char * )name_);
249}
250// isMDI() const
252{
253 const auto &result = fromPtr(thisObj)->isMDI();
254 return result;
255}
256// layout() const
258{
259 const auto &result = fromPtr(thisObj)->layout();
260 return result;
261}
262// layoutEqually()
264{
265 fromPtr(thisObj)->layoutEqually();
266}
267// layoutParentContainerEqually(KDDockWidgets::Core::DockWidget * dockWidget)
269{
270 auto dockWidget = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(dockWidget_);
271 fromPtr(thisObj)->layoutParentContainerEqually(dockWidget);
272}
273// moveToSideBar(KDDockWidgets::Core::DockWidget * dw)
275{
276 auto dw = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(dw_);
277 fromPtr(thisObj)->moveToSideBar(dw);
278}
279// multiSplitter() const
281{
282 const auto &result = fromPtr(thisObj)->multiSplitter();
283 return result;
284}
285// options() const
287{
288 const auto &result = fromPtr(thisObj)->options();
289 return result;
290}
291// overlayMargin() const
293{
294 const auto &result = fromPtr(thisObj)->overlayMargin();
295 return result;
296}
297// overlayOnSideBar(KDDockWidgets::Core::DockWidget * dw)
299{
300 auto dw = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(dw_);
301 fromPtr(thisObj)->overlayOnSideBar(dw);
302}
303// overlayedDockWidget() const
305{
306 const auto &result = fromPtr(thisObj)->overlayedDockWidget();
307 return result;
308}
309// restoreFromSideBar(KDDockWidgets::Core::DockWidget * dw)
311{
312 auto dw = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(dw_);
313 fromPtr(thisObj)->restoreFromSideBar(dw);
314}
315// setContentsMargins(int l, int t, int r, int b)
317{
318 fromPtr(thisObj)->setContentsMargins(l, t, r, b);
319}
320// setOverlayMargin(int margin)
322{
323 fromPtr(thisObj)->setOverlayMargin(margin);
324}
325// setParentView_impl(KDDockWidgets::Core::View * parent)
327{
328 auto parent = reinterpret_cast<KDDockWidgets::Core::View *>(parent_);
330}
331// setUniqueName(const QString & uniqueName)
332void c_KDDockWidgets__Core__MainWindow__setUniqueName_QString(void *thisObj, const char *uniqueName_)
333{
334 const auto uniqueName = QString::fromUtf8(uniqueName_);
335 fromWrapperPtr(thisObj)->setUniqueName(uniqueName);
336 free(( char * )uniqueName_);
337}
338// sideBarForDockWidget(const KDDockWidgets::Core::DockWidget * dw) const
340{
341 auto dw = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(dw_);
342 const auto &result = fromPtr(thisObj)->sideBarForDockWidget(dw);
343 return result;
344}
345// toggleOverlayOnSideBar(KDDockWidgets::Core::DockWidget * dw)
347{
348 auto dw = reinterpret_cast<KDDockWidgets::Core::DockWidget *>(dw_);
349 fromPtr(thisObj)->toggleOverlayOnSideBar(dw);
350}
351// uniqueName() const
353{
354 const auto &result = new Dartagnan::ValueWrapper<QString> { fromPtr(thisObj)->uniqueName() };
355 return result;
356}
358{
359 delete fromPtr(thisObj);
360}
361void c_KDDockWidgets__Core__MainWindow__registerVirtualMethodCallback(void *ptr, void *callback, int methodId)
362{
363 auto wrapper = fromWrapperPtr(ptr);
364 switch (methodId) {
365 case 331:
366 wrapper->m_setParentView_implCallback = reinterpret_cast<KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::MainWindow_wrapper::Callback_setParentView_impl>(callback);
367 break;
368 }
369}
370}
void c_KDDockWidgets__Core__MainWindow__moveToSideBar_DockWidget(void *thisObj, void *dw_)
void c_KDDockWidgets__Core__MainWindow__layoutParentContainerEqually_DockWidget(void *thisObj, void *dockWidget_)
int c_KDDockWidgets__Core__MainWindow__options(void *thisObj)
void c_KDDockWidgets__Core__MainWindow__setOverlayMargin_int(void *thisObj, int margin)
void c_KDDockWidgets__Core__MainWindow__registerVirtualMethodCallback(void *ptr, void *callback, int methodId)
void c_KDDockWidgets__Core__MainWindow__destructor(void *thisObj)
bool c_KDDockWidgets__Core__MainWindow__anySideBarIsVisible(void *thisObj)
static KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::MainWindow_wrapper * fromWrapperPtr(void *ptr)
void c_KDDockWidgets__Core__MainWindow__addDockWidgetToSide_DockWidget_Location_InitialOption(void *thisObj, void *dockWidget_, int location, void *initialOption_)
void * c_KDDockWidgets__Core__MainWindow__overlayedDockWidget(void *thisObj)
void c_KDDockWidgets__Core__MainWindow__overlayOnSideBar_DockWidget(void *thisObj, void *dw_)
void * c_KDDockWidgets__Core__MainWindow__sideBarForDockWidget_DockWidget(void *thisObj, void *dw_)
void * c_KDDockWidgets__Core__MainWindow__centralAreaGeometry(void *thisObj)
void c_KDDockWidgets__Core__MainWindow__setContentsMargins_int_int_int_int(void *thisObj, int l, int t, int r, int b)
static KDDockWidgets::Core::MainWindow * fromPtr(void *ptr)
bool c_KDDockWidgets__Core__MainWindow__isMDI(void *thisObj)
void c_KDDockWidgets__Core__MainWindow__layoutEqually(void *thisObj)
void c_KDDockWidgets__Core__MainWindow__toggleOverlayOnSideBar_DockWidget(void *thisObj, void *dw_)
void * c_KDDockWidgets__Core__MainWindow__layout(void *thisObj)
void * c_KDDockWidgets__Core__MainWindow__multiSplitter(void *thisObj)
void c_KDDockWidgets__Core__MainWindow__restoreFromSideBar_DockWidget(void *thisObj, void *dw_)
void * c_KDDockWidgets__Core__MainWindow__dropArea(void *thisObj)
void c_KDDockWidgets__Core__MainWindow__setParentView_impl_View(void *thisObj, void *parent_)
bool c_KDDockWidgets__Core__MainWindow__closeDockWidgets_bool(void *thisObj, bool force)
void c_KDDockWidgets__Core__MainWindow__clearSideBarOverlay_bool(void *thisObj, bool deleteGroup)
void * c_KDDockWidgets__Core__MainWindow__uniqueName(void *thisObj)
void * c_KDDockWidgets__Core__MainWindow__constructor_View_QString_MainWindowOptions(void *view_, const char *uniqueName_, int options_)
void * c_KDDockWidgets__Core__MainWindow__centerWidgetMargins(void *thisObj)
void c_KDDockWidgets__Core__MainWindow_Finalizer(void *cppObj)
int c_KDDockWidgets__Core__MainWindow__overlayMargin(void *thisObj)
void c_KDDockWidgets__Core__MainWindow__init_QString(void *thisObj, const char *name_)
void c_KDDockWidgets__Core__MainWindow__addDockWidgetAsTab_DockWidget(void *thisObj, void *dockwidget_)
void c_KDDockWidgets__Core__MainWindow__setUniqueName_QString(void *thisObj, const char *uniqueName_)
void c_KDDockWidgets__Core__MainWindow__addDockWidget_DockWidget_Location_DockWidget_InitialOption(void *thisObj, void *dockWidget_, int location, void *relativeTo_, void *initialOption_)
void(* Callback_setParentView_impl)(void *, KDDockWidgets::Core::View *parent)
void addDockWidgetToSide(KDDockWidgets::Core::DockWidget *dockWidget, KDDockWidgets::Location location, KDDockWidgets::InitialOption initialOption={})
KDDockWidgets::Core::SideBar * sideBarForDockWidget(const KDDockWidgets::Core::DockWidget *dw) const
void addDockWidget(KDDockWidgets::Core::DockWidget *dockWidget, KDDockWidgets::Location location, KDDockWidgets::Core::DockWidget *relativeTo=nullptr, KDDockWidgets::InitialOption initialOption={})
MainWindow_wrapper(KDDockWidgets::Core::View *view, const QString &uniqueName, QFlags< KDDockWidgets::MainWindowOption > options)
virtual void setParentView_impl(View *parent)
The DockWidget base-class. DockWidget and Core::DockWidget are only split in two so we can share some...
The widget (QWidget or QQuickItem) which holds a layout of dock widgets.
Definition Layout.h:57
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
QString uniqueName() const
Returns the unique name that was passed via constructor. Used internally by the save/restore mechanis...
void setOverlayMargin(int margin)
Sets the margin used by overlay docks. Does not modify currently overlayed docks.
void addDockWidgetAsTab(KDDockWidgets::Core::DockWidget *dockwidget)
Docks a DockWidget into the central group, tabbed.
void overlayOnSideBar(KDDockWidgets::Core::DockWidget *dw)
Shows the dock widget overlayed on top of the main window, placed next to the sidebar.
KDDockWidgets::Core::SideBar * sideBarForDockWidget(const KDDockWidgets::Core::DockWidget *dw) const
Returns the sidebar this dockwidget is in. nullptr if not in any.
void toggleOverlayOnSideBar(KDDockWidgets::Core::DockWidget *dw)
Shows or hides an overlay. It's assumed the dock widget is already in a side-bar.
void layoutParentContainerEqually(KDDockWidgets::Core::DockWidget *dockWidget)
like layoutEqually() but starts with the container that has dockWidget. While layoutEqually() starts ...
Margins centerWidgetMargins() const
bool anySideBarIsVisible() const
Returns whether any side bar is visible.
int overlayMargin() const
Returns the margin used by overlay docks. Default: 1.
void setContentsMargins(int l, int t, int r, int b)
Sets the content's margins.
void layoutEqually()
layouts all the widgets so they have an equal size within their parent container
DropArea * multiSplitter() const
void clearSideBarOverlay(bool deleteGroup=true)
closes any overlayed dock widget. The sidebar still displays them as button.
MainWindowOptions options() const
Returns the main window options that were passed via constructor.
Core::DockWidget * overlayedDockWidget() const
returns the dock widget which is currently overlayed. nullptr if none. This is only relevant when usi...
void moveToSideBar(KDDockWidgets::Core::DockWidget *dw)
Moves the dock widget into one of the MainWindow's sidebar. Means the dock widget is removed from the...
bool closeDockWidgets(bool force=false)
Closes all dock widgets which are docked into this main window This is convenience to calling DockWid...
void init(const QString &name)
bool isMDI() const
Returns whether this main window is using an MDI layout. In other words, returns true if MainWindowOp...
void addDockWidgetToSide(KDDockWidgets::Core::DockWidget *dockWidget, KDDockWidgets::Location location, const KDDockWidgets::InitialOption &initialOption={})
void restoreFromSideBar(KDDockWidgets::Core::DockWidget *dw)
Removes the dock widget from the sidebar and docks it into the main window again.
void addDockWidget(KDDockWidgets::Core::DockWidget *dockWidget, KDDockWidgets::Location location, KDDockWidgets::Core::DockWidget *relativeTo=nullptr, const KDDockWidgets::InitialOption &initialOption={})
Docks a DockWidget into this main window.
void setUniqueName(const QString &uniqueName)
int(* CleanupCallback)(void *thisPtr)
Definition Config_c.cpp:21
static CleanupCallback s_cleanupCallback
Definition Config_c.cpp:22
Class to abstract QAction, so code still works with QtQuick and Flutter.
QString fromUtf8(const char *str, int size)
Struct describing the preferred dock widget size and visibility when adding it to a layout.

© 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