Refactors directory structure and file naming.
This commit is contained in:
77
AdvancedDockingSystem/src/API.cpp
Normal file
77
AdvancedDockingSystem/src/API.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
#include "ads/API.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSplitter>
|
||||
|
||||
#include "ads/ContainerWidget.h"
|
||||
|
||||
const QString DragData::MIMETYPE = QString("qt/ads-dragdata");
|
||||
|
||||
ADS_NAMESPACE_BEGIN
|
||||
|
||||
ContainerWidget* findParentContainerWidget(QWidget* w)
|
||||
{
|
||||
ContainerWidget* cw = 0;
|
||||
QWidget* next = w;
|
||||
do
|
||||
{
|
||||
if ((cw = dynamic_cast<ContainerWidget*>(next)) != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
next = next->parentWidget();
|
||||
}
|
||||
while (next);
|
||||
return cw;
|
||||
}
|
||||
|
||||
SectionWidget* findParentSectionWidget(class QWidget* w)
|
||||
{
|
||||
SectionWidget* cw = 0;
|
||||
QWidget* next = w;
|
||||
do
|
||||
{
|
||||
if ((cw = dynamic_cast<SectionWidget*>(next)) != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
next = next->parentWidget();
|
||||
}
|
||||
while (next);
|
||||
return cw;
|
||||
}
|
||||
|
||||
QSplitter* findParentSplitter(class QWidget* w)
|
||||
{
|
||||
QSplitter* cw = 0;
|
||||
QWidget* next = w;
|
||||
do
|
||||
{
|
||||
if ((cw = dynamic_cast<QSplitter*>(next)) != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
next = next->parentWidget();
|
||||
}
|
||||
while (next);
|
||||
return cw;
|
||||
}
|
||||
|
||||
QSplitter* findImmediateSplitter(class QWidget* w)
|
||||
{
|
||||
QSplitter* sp = NULL;
|
||||
QLayout* l = w->layout();
|
||||
if (!l || l->count() <= 0)
|
||||
return sp;
|
||||
for (int i = 0; i < l->count(); ++i)
|
||||
{
|
||||
QLayoutItem* li = l->itemAt(0);
|
||||
if (!li->widget())
|
||||
continue;
|
||||
if ((sp = dynamic_cast<QSplitter*>(li->widget())) != NULL)
|
||||
break;
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
|
||||
ADS_NAMESPACE_END
|
||||
Reference in New Issue
Block a user