2019-10-09 20:15:53 +08:00
|
|
|
%Import QtWidgets/QtWidgetsmod.sip
|
|
|
|
|
|
|
|
%If (Qt_5_0_0 -)
|
2020-07-30 19:44:05 +08:00
|
|
|
|
2019-10-09 20:15:53 +08:00
|
|
|
%MappedType QMap<QString, ads::CDockWidget*>
|
|
|
|
/TypeHint="Dict[QString, CDockWidget*]", TypeHintValue="{}"/
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qmap.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
%ConvertFromTypeCode
|
|
|
|
PyObject *d = PyDict_New();
|
|
|
|
|
|
|
|
if (!d)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
QMap<QString, ads::CDockWidget*>::const_iterator it = sipCpp->constBegin();
|
|
|
|
QMap<QString, ads::CDockWidget*>::const_iterator end = sipCpp->constEnd();
|
|
|
|
|
|
|
|
while (it != end)
|
|
|
|
{
|
|
|
|
QString *k = new QString(it.key());
|
|
|
|
PyObject *kobj = sipConvertFromType(k, sipType_QString,
|
|
|
|
sipTransferObj);
|
|
|
|
|
|
|
|
if (!kobj)
|
|
|
|
{
|
|
|
|
delete k;
|
|
|
|
Py_DECREF(d);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyObject *vobj = sipConvertFromType(it.value(), sipType_ads_CDockWidget,
|
|
|
|
sipTransferObj);
|
|
|
|
|
|
|
|
if (!vobj)
|
|
|
|
{
|
|
|
|
Py_DECREF(kobj);
|
|
|
|
Py_DECREF(d);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rc = PyDict_SetItem(d, kobj, vobj);
|
|
|
|
|
|
|
|
Py_DECREF(vobj);
|
|
|
|
Py_DECREF(kobj);
|
|
|
|
|
|
|
|
if (rc < 0)
|
|
|
|
{
|
|
|
|
Py_DECREF(d);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
|
|
|
|
return d;
|
|
|
|
%End
|
|
|
|
|
|
|
|
%ConvertToTypeCode
|
|
|
|
if (!sipIsErr)
|
|
|
|
return PyDict_Check(sipPy);
|
|
|
|
|
|
|
|
QMap<QString, ads::CDockWidget*> *qm = new QMap<QString, ads::CDockWidget*>;
|
|
|
|
|
|
|
|
Py_ssize_t pos = 0;
|
|
|
|
PyObject *kobj, *vobj;
|
|
|
|
while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
|
|
|
|
{
|
|
|
|
int kstate;
|
|
|
|
QString *k = reinterpret_cast<QString *>(
|
|
|
|
sipForceConvertToType(kobj, sipType_QString, sipTransferObj,
|
|
|
|
SIP_NOT_NONE, &kstate, sipIsErr));
|
|
|
|
|
|
|
|
if (*sipIsErr)
|
|
|
|
{
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
"a dict key has type '%s' but '_TYPE1_' is expected",
|
|
|
|
sipPyTypeName(Py_TYPE(kobj)));
|
|
|
|
|
|
|
|
delete qm;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int vstate;
|
|
|
|
ads::CDockWidget *v = reinterpret_cast<ads::CDockWidget *>(
|
|
|
|
sipForceConvertToType(vobj, sipType_ads_CDockWidget, sipTransferObj,
|
|
|
|
SIP_NOT_NONE, &vstate, sipIsErr));
|
|
|
|
|
|
|
|
if (*sipIsErr)
|
|
|
|
{
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
"a dict value has type '%s' but '_TYPE2_' is expected",
|
|
|
|
sipPyTypeName(Py_TYPE(vobj)));
|
|
|
|
|
|
|
|
sipReleaseType(k, sipType_QString, kstate);
|
|
|
|
delete qm;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
qm->insert(*k, v);
|
|
|
|
|
|
|
|
sipReleaseType(v, sipType_ads_CDockWidget, vstate);
|
|
|
|
sipReleaseType(k, sipType_QString, kstate);
|
|
|
|
}
|
|
|
|
|
|
|
|
*sipCppPtr = qm;
|
|
|
|
|
|
|
|
return sipGetState(sipTransferObj);
|
|
|
|
%End
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace ads
|
|
|
|
{
|
|
|
|
|
|
|
|
class CDockManager : ads::CDockContainerWidget
|
|
|
|
{
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <DockManager.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void registerFloatingWidget(ads::CFloatingDockContainer* FloatingWidget /Transfer/);
|
|
|
|
void removeFloatingWidget(ads::CFloatingDockContainer* FloatingWidget) /TransferBack/;
|
|
|
|
void registerDockContainer(ads::CDockContainerWidget* DockContainer /Transfer/);
|
|
|
|
void removeDockContainer(ads::CDockContainerWidget* DockContainer /TransferBack/);
|
|
|
|
ads::CDockOverlay* containerOverlay() const;
|
|
|
|
ads::CDockOverlay* dockAreaOverlay() const;
|
2020-06-10 21:08:31 +08:00
|
|
|
void notifyWidgetOrAreaRelocation(QWidget* RelocatedWidget);
|
|
|
|
void notifyFloatingWidgetDrop(ads::CFloatingDockContainer* FloatingWidget);
|
2019-10-09 20:15:53 +08:00
|
|
|
|
2020-02-25 14:22:51 +08:00
|
|
|
virtual void showEvent(QShowEvent *event);
|
|
|
|
|
2019-10-09 20:15:53 +08:00
|
|
|
public:
|
|
|
|
enum eViewMenuInsertionOrder
|
|
|
|
{
|
|
|
|
MenuSortedByInsertion,
|
|
|
|
MenuAlphabeticallySorted
|
|
|
|
};
|
|
|
|
|
|
|
|
enum eConfigFlag
|
|
|
|
{
|
2020-02-22 05:47:09 +08:00
|
|
|
ActiveTabHasCloseButton,
|
2019-10-09 20:15:53 +08:00
|
|
|
DockAreaHasCloseButton,
|
|
|
|
DockAreaCloseButtonClosesTab,
|
|
|
|
OpaqueSplitterResize,
|
|
|
|
XmlAutoFormattingEnabled,
|
|
|
|
XmlCompressionEnabled,
|
|
|
|
TabCloseButtonIsToolButton,
|
|
|
|
AllTabsHaveCloseButton,
|
|
|
|
RetainTabSizeWhenCloseButtonHidden,
|
2020-02-22 05:47:09 +08:00
|
|
|
OpaqueUndocking,
|
|
|
|
DragPreviewIsDynamic,
|
|
|
|
DragPreviewShowsContentPixmap,
|
|
|
|
DragPreviewHasWindowFrame,
|
|
|
|
AlwaysShowTabs,
|
|
|
|
DockAreaHasUndockButton,
|
|
|
|
DockAreaHasTabsMenuButton,
|
|
|
|
DockAreaHideDisabledButtons,
|
|
|
|
DockAreaDynamicTabsMenuButtonVisibility,
|
|
|
|
FloatingContainerHasWidgetTitle,
|
|
|
|
FloatingContainerHasWidgetIcon,
|
2020-05-13 22:05:00 +08:00
|
|
|
HideSingleCentralWidgetTitleBar,
|
2020-06-10 21:08:31 +08:00
|
|
|
FocusHighlighting,
|
2020-07-04 23:07:48 +08:00
|
|
|
EqualSplitOnInsertion,
|
2020-09-01 22:06:43 +08:00
|
|
|
FloatingContainerForceNativeTitleBar,
|
|
|
|
FloatingContainerForceQWidgetTitleBar,
|
2020-02-22 05:47:09 +08:00
|
|
|
DefaultDockAreaButtons,
|
|
|
|
DefaultBaseConfig,
|
|
|
|
DefaultOpaqueConfig,
|
|
|
|
DefaultNonOpaqueConfig,
|
|
|
|
NonOpaqueWithWindowFrame,
|
2019-10-09 20:15:53 +08:00
|
|
|
};
|
|
|
|
typedef QFlags<ads::CDockManager::eConfigFlag> ConfigFlags;
|
|
|
|
|
|
|
|
CDockManager(QWidget* parent /TransferThis/ = 0);
|
|
|
|
virtual ~CDockManager();
|
|
|
|
static ads::CDockManager::ConfigFlags configFlags();
|
|
|
|
static void setConfigFlags(const ads::CDockManager::ConfigFlags Flags);
|
|
|
|
static void setConfigFlag(ads::CDockManager::eConfigFlag Flag, bool On = true);
|
2020-02-22 05:47:09 +08:00
|
|
|
static bool testConfigFlag(eConfigFlag Flag);
|
2019-12-19 06:21:34 +08:00
|
|
|
static ads::CIconProvider& iconProvider();
|
2019-10-09 20:15:53 +08:00
|
|
|
ads::CDockAreaWidget* addDockWidget(ads::DockWidgetArea area, ads::CDockWidget* Dockwidget /Transfer/,
|
|
|
|
ads::CDockAreaWidget* DockAreaWidget /Transfer/ = 0);
|
|
|
|
ads::CDockAreaWidget* addDockWidgetTab(ads::DockWidgetArea area,
|
|
|
|
ads::CDockWidget* Dockwidget /Transfer/);
|
|
|
|
ads::CDockAreaWidget* addDockWidgetTabToArea(ads::CDockWidget* Dockwidget /Transfer/,
|
|
|
|
ads::CDockAreaWidget* DockAreaWidget /Transfer/);
|
2019-12-19 06:21:34 +08:00
|
|
|
ads::CFloatingDockContainer* addDockWidgetFloating(ads::CDockWidget* DockWidget /Transfer/);
|
2019-10-09 20:15:53 +08:00
|
|
|
ads::CDockWidget* findDockWidget(const QString& ObjectName) const;
|
|
|
|
void removeDockWidget(ads::CDockWidget* Dockwidget) /TransferBack/;
|
|
|
|
QMap<QString, ads::CDockWidget*> dockWidgetsMap() const;
|
|
|
|
const QList<ads::CDockContainerWidget*> dockContainers() const;
|
|
|
|
const QList<ads::CFloatingDockContainer*> floatingWidgets() const;
|
2020-02-22 05:47:09 +08:00
|
|
|
unsigned int zOrderIndex() const;
|
2020-06-05 05:55:02 +08:00
|
|
|
QByteArray saveState(int version = 0) const;
|
|
|
|
bool restoreState(const QByteArray &state, int version = 0);
|
2019-10-09 20:15:53 +08:00
|
|
|
void addPerspective(const QString& UniquePrespectiveName);
|
|
|
|
void removePerspective(const QString& Name);
|
|
|
|
void removePerspectives(const QStringList& Names);
|
|
|
|
QStringList perspectiveNames() const;
|
|
|
|
void savePerspectives(QSettings& Settings) const;
|
|
|
|
void loadPerspectives(QSettings& Settings);
|
2020-09-01 22:06:43 +08:00
|
|
|
CDockWidget* centralWidget() const;
|
|
|
|
CDockAreaWidget* setCentralWidget(CDockWidget* widget /Transfer/);
|
2019-10-09 20:15:53 +08:00
|
|
|
QAction* addToggleViewActionToMenu(QAction* ToggleViewAction /Transfer/,
|
|
|
|
const QString& Group = QString(), const QIcon& GroupIcon = QIcon());
|
|
|
|
QMenu* viewMenu() const;
|
|
|
|
void setViewMenuInsertionOrder(ads::CDockManager::eViewMenuInsertionOrder Order);
|
|
|
|
bool isRestoringState() const;
|
|
|
|
static int startDragDistance();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void openPerspective(const QString& PerspectiveName);
|
2020-06-10 21:08:31 +08:00
|
|
|
void setDockWidgetFocused(ads::CDockWidget* DockWidget);
|
2019-10-09 20:15:53 +08:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void perspectiveListChanged();
|
|
|
|
void perspectivesRemoved();
|
|
|
|
void restoringState();
|
|
|
|
void stateRestored();
|
|
|
|
void openingPerspective(const QString& PerspectiveName);
|
|
|
|
void perspectiveOpened(const QString& PerspectiveName);
|
2020-07-30 19:44:05 +08:00
|
|
|
void floatingWidgetCreated(ads::CFloatingDockContainer*);
|
|
|
|
void dockAreaCreated(ads::CDockAreaWidget*);
|
|
|
|
void dockWidgetAboutToBeRemoved(ads::CDockWidget*);
|
|
|
|
void dockWidgetRemoved(ads::CDockWidget*);
|
|
|
|
void focusedDockWidgetChanged(ads::CDockWidget*, ads::CDockWidget*);
|
2019-10-09 20:15:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-12-19 06:21:34 +08:00
|
|
|
%End
|