Qt-Advanced-Docking-System/sip/DockManager.sip

236 lines
7.0 KiB
Plaintext
Raw Normal View History

2019-10-09 20:15:53 +08:00
%Import QtWidgets/QtWidgetsmod.sip
%If (Qt_5_0_0 -)
%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
virtual void showEvent(QShowEvent *event);
2019-10-09 20:15:53 +08:00
public:
enum eViewMenuInsertionOrder
{
MenuSortedByInsertion,
MenuAlphabeticallySorted
};
enum eConfigFlag
{
ActiveTabHasCloseButton,
2019-10-09 20:15:53 +08:00
DockAreaHasCloseButton,
DockAreaCloseButtonClosesTab,
OpaqueSplitterResize,
XmlAutoFormattingEnabled,
XmlCompressionEnabled,
TabCloseButtonIsToolButton,
AllTabsHaveCloseButton,
RetainTabSizeWhenCloseButtonHidden,
OpaqueUndocking,
DragPreviewIsDynamic,
DragPreviewShowsContentPixmap,
DragPreviewHasWindowFrame,
AlwaysShowTabs,
DockAreaHasUndockButton,
DockAreaHasTabsMenuButton,
DockAreaHideDisabledButtons,
DockAreaDynamicTabsMenuButtonVisibility,
FloatingContainerHasWidgetTitle,
FloatingContainerHasWidgetIcon,
HideSingleCentralWidgetTitleBar,
2020-06-10 21:08:31 +08:00
FocusHighlighting,
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);
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;
unsigned int zOrderIndex() const;
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);
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);
void floatingWidgetCreated(CFloatingDockContainer* FloatingWidget);
2019-12-19 06:21:34 +08:00
void dockAreaCreated(ads::CDockAreaWidget* DockArea);
void dockWidgetAboutToBeRemoved(ads::CDockWidget* DockWidget);
void dockWidgetRemoved(ads::CDockWidget* DockWidget);
2020-06-10 21:08:31 +08:00
void focusedDockWidgetChanged(ads::CDockWidget* old, ads::CDockWidget* now);
2019-10-09 20:15:53 +08:00
};
};
2019-12-19 06:21:34 +08:00
%End