|
|
|
@ -29,20 +29,20 @@ |
|
|
|
|
* \brief The constructor |
|
|
|
|
*/ |
|
|
|
|
UBDockPalette::UBDockPalette(eUBDockPaletteType paletteType, QWidget *parent, const char *name) |
|
|
|
|
:QWidget(parent, Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint) |
|
|
|
|
, mOrientation(eUBDockOrientation_Left) |
|
|
|
|
, mPreferredWidth(100) |
|
|
|
|
, mPreferredHeight(100) |
|
|
|
|
, mCanResize(false) |
|
|
|
|
, mResized(false) |
|
|
|
|
, mCollapseWidth(150) |
|
|
|
|
, mLastWidth(-1) |
|
|
|
|
, mHTab(0) |
|
|
|
|
, mpStackWidget(NULL) |
|
|
|
|
, mpLayout(NULL) |
|
|
|
|
, mCurrentTab(0) |
|
|
|
|
, mPaletteType(paletteType) |
|
|
|
|
, mTabPalette(new UBTabDockPalette(this, parent)) |
|
|
|
|
:QWidget(parent, Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint) |
|
|
|
|
, mOrientation(eUBDockOrientation_Left) |
|
|
|
|
, mPreferredWidth(100) |
|
|
|
|
, mPreferredHeight(100) |
|
|
|
|
, mCanResize(false) |
|
|
|
|
, mResized(false) |
|
|
|
|
, mCollapseWidth(150) |
|
|
|
|
, mLastWidth(-1) |
|
|
|
|
, mHTab(0) |
|
|
|
|
, mpStackWidget(NULL) |
|
|
|
|
, mpLayout(NULL) |
|
|
|
|
, mCurrentTab(0) |
|
|
|
|
, mPaletteType(paletteType) |
|
|
|
|
, mTabPalette(new UBTabDockPalette(this, parent)) |
|
|
|
|
{ |
|
|
|
|
setObjectName(name); |
|
|
|
|
|
|
|
|
@ -302,12 +302,6 @@ void UBDockPalette::showTabWidget(int tabIndex) |
|
|
|
|
mpStackWidget->setCurrentIndex(tabIndex); |
|
|
|
|
mCurrentTab = tabIndex; |
|
|
|
|
|
|
|
|
|
// Expand it if collapsed
|
|
|
|
|
if(mLastWidth != -1) |
|
|
|
|
{ |
|
|
|
|
toggleCollapseExpand(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Update the current tab index
|
|
|
|
|
if(NULL != (dynamic_cast<UBDockPaletteWidget*>(mpStackWidget->widget(tabIndex)))){ |
|
|
|
|
mCrntTabWidget = dynamic_cast<UBDockPaletteWidget*>(mpStackWidget->widget(tabIndex))->name(); |
|
|
|
@ -320,17 +314,11 @@ void UBDockPalette::showTabWidget(int tabIndex) |
|
|
|
|
*/ |
|
|
|
|
void UBDockPalette::toggleCollapseExpand() |
|
|
|
|
{ |
|
|
|
|
if(mLastWidth == -1) |
|
|
|
|
{ |
|
|
|
|
// The palette must be collapsed
|
|
|
|
|
if(width() < mCollapseWidth) |
|
|
|
|
resize(mLastWidth,height()); |
|
|
|
|
else{ |
|
|
|
|
mLastWidth = width(); |
|
|
|
|
resize(0, height()); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// The palette will be expanded
|
|
|
|
|
resize(mLastWidth, height()); |
|
|
|
|
mLastWidth = -1; |
|
|
|
|
resize(0,height()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -498,7 +486,7 @@ void UBDockPalette::moveTabs() |
|
|
|
|
} else { |
|
|
|
|
mHTab = height() - border() - mTabWidgets.size() * TABSIZE - (mTabWidgets.size() - 1) * tabSpacing(); |
|
|
|
|
} |
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
QPoint origin(width(), mHTab + mTabPalette->mVerticalOffset); |
|
|
|
|
|
|
|
|
@ -575,9 +563,9 @@ bool UBDockPalette::switchMode(eUBDockPaletteWidgetMode mode) |
|
|
|
|
|
|
|
|
|
UBTabDockPalette::UBTabDockPalette(UBDockPalette *dockPalette, QWidget *parent) : |
|
|
|
|
QWidget(parent) |
|
|
|
|
, dock(dockPalette) |
|
|
|
|
, mVerticalOffset(0) |
|
|
|
|
, mFlotable(false) |
|
|
|
|
, dock(dockPalette) |
|
|
|
|
, mVerticalOffset(0) |
|
|
|
|
, mFlotable(false) |
|
|
|
|
{ |
|
|
|
|
int numTabs = dock->mTabWidgets.size(); |
|
|
|
|
resize(2 * dock->border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * dock->tabSpacing()); |
|
|
|
@ -703,7 +691,7 @@ void UBTabDockPalette::mouseMoveEvent(QMouseEvent *event) |
|
|
|
|
p.setX(p.x() + dock->width()); |
|
|
|
|
if(p.x() < dock->collapseWidth() && p.x() >= dock->minimumWidth()) { |
|
|
|
|
dock->resize(0, dock->height()); |
|
|
|
|
dock->mLastWidth = dock->collapseWidth() + 1; |
|
|
|
|
//dock->mLastWidth = dock->collapseWidth() + 1;
|
|
|
|
|
dock->mResized = true; |
|
|
|
|
} else if (p.x() <= dock->maximumWidth() && p.x() >= dock->minimumWidth()) { |
|
|
|
|
dock->resize(p.x(), dock->height()); |
|
|
|
@ -715,7 +703,7 @@ void UBTabDockPalette::mouseMoveEvent(QMouseEvent *event) |
|
|
|
|
p.setX(p.x() - 2 * dock->border()); |
|
|
|
|
if((dock->x() + p.x() > dock->parentWidget()->width() - dock->collapseWidth()) && (dock->x() + p.x() < dock->parentWidget()->width())) { |
|
|
|
|
dock->resize(0, dock->height()); |
|
|
|
|
dock->mLastWidth = dock->collapseWidth() + 1; |
|
|
|
|
//dock->mLastWidth = dock->collapseWidth() + 1;
|
|
|
|
|
dock->mResized = true; |
|
|
|
|
} else if((dock->x() + p.x() >= dock->parentWidget()->width() - dock->maximumWidth()) && (dock->x() + p.x() <= dock->parentWidget()->width() - dock->minimumWidth())) { |
|
|
|
|
dock->resize(dock->parentWidget()->width() - (dock->x() + p.x()), dock->height()); |
|
|
|
|