|
|
@ -26,7 +26,7 @@
|
|
|
|
#include <tqtimer.h>
|
|
|
|
#include <tqtimer.h>
|
|
|
|
#include <tqapplication.h>
|
|
|
|
#include <tqapplication.h>
|
|
|
|
|
|
|
|
|
|
|
|
KDockSplitter::KDockSplitter(TQWidget *parent, const char *name, Qt::Orientation orient, int pos, bool highResolution)
|
|
|
|
KDockSplitter::KDockSplitter(TQWidget *parent, const char *name, TQt::Orientation orient, int pos, bool highResolution)
|
|
|
|
: TQWidget(parent, name)
|
|
|
|
: TQWidget(parent, name)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_dontRecalc=false;
|
|
|
|
m_dontRecalc=false;
|
|
|
@ -59,7 +59,7 @@ void KDockSplitter::activate(TQWidget *c0, TQWidget *c1)
|
|
|
|
divider->setLineWidth(1);
|
|
|
|
divider->setLineWidth(1);
|
|
|
|
divider->raise();
|
|
|
|
divider->raise();
|
|
|
|
|
|
|
|
|
|
|
|
if (m_orientation ==Qt::Horizontal)
|
|
|
|
if (m_orientation ==TQt::Horizontal)
|
|
|
|
divider->setCursor(TQCursor(sizeVerCursor));
|
|
|
|
divider->setCursor(TQCursor(sizeVerCursor));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
divider->setCursor(TQCursor(sizeHorCursor));
|
|
|
|
divider->setCursor(TQCursor(sizeHorCursor));
|
|
|
@ -179,7 +179,7 @@ void KDockSplitter::setupMinMaxSize()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Set the minimum and maximum sizes
|
|
|
|
// Set the minimum and maximum sizes
|
|
|
|
int minx, maxx, miny, maxy;
|
|
|
|
int minx, maxx, miny, maxy;
|
|
|
|
if (m_orientation ==Qt::Horizontal) {
|
|
|
|
if (m_orientation ==TQt::Horizontal) {
|
|
|
|
miny = child0->minimumSize().height() + child1->minimumSize().height()+4;
|
|
|
|
miny = child0->minimumSize().height() + child1->minimumSize().height()+4;
|
|
|
|
maxy = child0->maximumSize().height() + child1->maximumSize().height()+4;
|
|
|
|
maxy = child0->maximumSize().height() + child1->maximumSize().height()+4;
|
|
|
|
minx = (child0->minimumSize().width() > child1->minimumSize().width()) ? child0->minimumSize().width() : child1->minimumSize().width();
|
|
|
|
minx = (child0->minimumSize().width() > child1->minimumSize().width()) ? child0->minimumSize().width() : child1->minimumSize().width();
|
|
|
@ -238,11 +238,11 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev)
|
|
|
|
double factor = (mHighResolution)? 10000.0:100.0;
|
|
|
|
double factor = (mHighResolution)? 10000.0:100.0;
|
|
|
|
// real resize event, recalculate xpos
|
|
|
|
// real resize event, recalculate xpos
|
|
|
|
if (ev && mKeepSize && isVisible()) {
|
|
|
|
if (ev && mKeepSize && isVisible()) {
|
|
|
|
// kdDebug(282)<<"mKeepSize : "<< ((m_orientation ==Qt::Horizontal) ? "Horizontal":"Vertical") <<endl;
|
|
|
|
// kdDebug(282)<<"mKeepSize : "<< ((m_orientation ==TQt::Horizontal) ? "Horizontal":"Vertical") <<endl;
|
|
|
|
|
|
|
|
|
|
|
|
if (ev->oldSize().width() != ev->size().width())
|
|
|
|
if (ev->oldSize().width() != ev->size().width())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (m_orientation ==Qt::Horizontal) {
|
|
|
|
if (m_orientation ==TQt::Horizontal) {
|
|
|
|
xpos = tqRound(factor * checkValue( child0->height()+1 ) / height());
|
|
|
|
xpos = tqRound(factor * checkValue( child0->height()+1 ) / height());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
xpos = tqRound(factor * checkValue( child0->width()+1 ) / width());
|
|
|
|
xpos = tqRound(factor * checkValue( child0->width()+1 ) / width());
|
|
|
@ -252,9 +252,9 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// kdDebug(282)<<"!mKeepSize : "<< ((m_orientation ==Qt::Horizontal) ? "Horizontal":"Vertical") <<endl;
|
|
|
|
// kdDebug(282)<<"!mKeepSize : "<< ((m_orientation ==TQt::Horizontal) ? "Horizontal":"Vertical") <<endl;
|
|
|
|
if (/*ev &&*/ isVisible()) {
|
|
|
|
if (/*ev &&*/ isVisible()) {
|
|
|
|
if (m_orientation ==Qt::Horizontal) {
|
|
|
|
if (m_orientation ==TQt::Horizontal) {
|
|
|
|
/* if (ev->oldSize().height() != ev->size().height())*/
|
|
|
|
/* if (ev->oldSize().height() != ev->size().height())*/
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (fixedHeight0!=-1)
|
|
|
|
if (fixedHeight0!=-1)
|
|
|
@ -287,15 +287,15 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev)
|
|
|
|
KDockWidget *c0=(KDockWidget*)child0;
|
|
|
|
KDockWidget *c0=(KDockWidget*)child0;
|
|
|
|
KDockWidget *c1=(KDockWidget*)child1;
|
|
|
|
KDockWidget *c1=(KDockWidget*)child1;
|
|
|
|
bool stdHandling=false;
|
|
|
|
bool stdHandling=false;
|
|
|
|
if ( ( (m_orientation==Qt::Vertical) &&((fixedWidth0==-1) && (fixedWidth1==-1)) ) ||
|
|
|
|
if ( ( (m_orientation==TQt::Vertical) &&((fixedWidth0==-1) && (fixedWidth1==-1)) ) ||
|
|
|
|
( (m_orientation==Qt::Horizontal) &&((fixedHeight0==-1) && (fixedHeight1==-1)) ) ) {
|
|
|
|
( (m_orientation==TQt::Horizontal) &&((fixedHeight0==-1) && (fixedHeight1==-1)) ) ) {
|
|
|
|
if ((c0->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c0->getWidget()))
|
|
|
|
if ((c0->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c0->getWidget()))
|
|
|
|
&& (dc->m_overlapMode)) {
|
|
|
|
&& (dc->m_overlapMode)) {
|
|
|
|
int position= tqRound((m_orientation ==Qt::Vertical ? width() : height()) * xpos/factor);
|
|
|
|
int position= tqRound((m_orientation ==TQt::Vertical ? width() : height()) * xpos/factor);
|
|
|
|
position=checkValueOverlapped(position,child0);
|
|
|
|
position=checkValueOverlapped(position,child0);
|
|
|
|
child0->raise();
|
|
|
|
child0->raise();
|
|
|
|
divider->raise();
|
|
|
|
divider->raise();
|
|
|
|
if (m_orientation ==Qt::Horizontal){
|
|
|
|
if (m_orientation ==TQt::Horizontal){
|
|
|
|
child0->setGeometry(0, 0, width(), position);
|
|
|
|
child0->setGeometry(0, 0, width(), position);
|
|
|
|
child1->setGeometry(0, dc->m_nonOverlapSize+4, width(),
|
|
|
|
child1->setGeometry(0, dc->m_nonOverlapSize+4, width(),
|
|
|
|
height()-dc->m_nonOverlapSize-4);
|
|
|
|
height()-dc->m_nonOverlapSize-4);
|
|
|
@ -309,11 +309,11 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if ((c1->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c1->getWidget()))
|
|
|
|
if ((c1->getWidget()) && (dc=dynamic_cast<KDockContainer*>(c1->getWidget()))
|
|
|
|
&& (dc->m_overlapMode)) {
|
|
|
|
&& (dc->m_overlapMode)) {
|
|
|
|
int position= tqRound((m_orientation ==Qt::Vertical ? width() : height()) * xpos/factor);
|
|
|
|
int position= tqRound((m_orientation ==TQt::Vertical ? width() : height()) * xpos/factor);
|
|
|
|
position=checkValueOverlapped(position,child1);
|
|
|
|
position=checkValueOverlapped(position,child1);
|
|
|
|
child1->raise();
|
|
|
|
child1->raise();
|
|
|
|
divider->raise();
|
|
|
|
divider->raise();
|
|
|
|
if (m_orientation ==Qt::Horizontal){
|
|
|
|
if (m_orientation ==TQt::Horizontal){
|
|
|
|
child0->setGeometry(0, 0, width(), height()-dc->m_nonOverlapSize-4);
|
|
|
|
child0->setGeometry(0, 0, width(), height()-dc->m_nonOverlapSize-4);
|
|
|
|
child1->setGeometry(0, position+4, width(),
|
|
|
|
child1->setGeometry(0, position+4, width(),
|
|
|
|
height()-position-4);
|
|
|
|
height()-position-4);
|
|
|
@ -331,8 +331,8 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev)
|
|
|
|
else stdHandling=true;
|
|
|
|
else stdHandling=true;
|
|
|
|
|
|
|
|
|
|
|
|
if (stdHandling) {
|
|
|
|
if (stdHandling) {
|
|
|
|
int position = checkValue( tqRound((m_orientation ==Qt::Vertical ? width() : height()) * xpos/factor) );
|
|
|
|
int position = checkValue( tqRound((m_orientation ==TQt::Vertical ? width() : height()) * xpos/factor) );
|
|
|
|
if (m_orientation ==Qt::Horizontal){
|
|
|
|
if (m_orientation ==TQt::Horizontal){
|
|
|
|
child0->setGeometry(0, 0, width(), position);
|
|
|
|
child0->setGeometry(0, 0, width(), position);
|
|
|
|
child1->setGeometry(0, position+4, width(), height()-position-4);
|
|
|
|
child1->setGeometry(0, position+4, width(), height()-position-4);
|
|
|
|
divider->setGeometry(0, position, width(), 4);
|
|
|
|
divider->setGeometry(0, position, width(), 4);
|
|
|
@ -349,7 +349,7 @@ void KDockSplitter::resizeEvent(TQResizeEvent *ev)
|
|
|
|
|
|
|
|
|
|
|
|
int KDockSplitter::checkValueOverlapped(int position, TQWidget *overlappingWidget) const {
|
|
|
|
int KDockSplitter::checkValueOverlapped(int position, TQWidget *overlappingWidget) const {
|
|
|
|
if (initialised) {
|
|
|
|
if (initialised) {
|
|
|
|
if (m_orientation ==Qt::Vertical) {
|
|
|
|
if (m_orientation ==TQt::Vertical) {
|
|
|
|
if (child0==overlappingWidget) {
|
|
|
|
if (child0==overlappingWidget) {
|
|
|
|
if (position<(child0->minimumSize().width()))
|
|
|
|
if (position<(child0->minimumSize().width()))
|
|
|
|
position=child0->minimumSize().width();
|
|
|
|
position=child0->minimumSize().width();
|
|
|
@ -358,7 +358,7 @@ int KDockSplitter::checkValueOverlapped(int position, TQWidget *overlappingWidge
|
|
|
|
position=width()-(child1->minimumSize().width())-4;
|
|
|
|
position=width()-(child1->minimumSize().width())-4;
|
|
|
|
if (position<0) position=0;
|
|
|
|
if (position<0) position=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {// orientation ==Qt::Horizontal
|
|
|
|
} else {// orientation ==TQt::Horizontal
|
|
|
|
if (child0==overlappingWidget) {
|
|
|
|
if (child0==overlappingWidget) {
|
|
|
|
if (position<(child0->minimumSize().height()))
|
|
|
|
if (position<(child0->minimumSize().height()))
|
|
|
|
position=child0->minimumSize().height();
|
|
|
|
position=child0->minimumSize().height();
|
|
|
@ -377,7 +377,7 @@ int KDockSplitter::checkValueOverlapped(int position, TQWidget *overlappingWidge
|
|
|
|
int KDockSplitter::checkValue( int position ) const
|
|
|
|
int KDockSplitter::checkValue( int position ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (initialised){
|
|
|
|
if (initialised){
|
|
|
|
if (m_orientation ==Qt::Vertical){
|
|
|
|
if (m_orientation ==TQt::Vertical){
|
|
|
|
if (position < (child0->minimumSize().width()))
|
|
|
|
if (position < (child0->minimumSize().width()))
|
|
|
|
position = child0->minimumSize().width();
|
|
|
|
position = child0->minimumSize().width();
|
|
|
|
if ((width()-4-position) < (child1->minimumSize().width()))
|
|
|
|
if ((width()-4-position) < (child1->minimumSize().width()))
|
|
|
@ -392,9 +392,9 @@ int KDockSplitter::checkValue( int position ) const
|
|
|
|
|
|
|
|
|
|
|
|
if (position < 0) position = 0;
|
|
|
|
if (position < 0) position = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ((m_orientation ==Qt::Vertical) && (position > width()))
|
|
|
|
if ((m_orientation ==TQt::Vertical) && (position > width()))
|
|
|
|
position = width();
|
|
|
|
position = width();
|
|
|
|
if ((m_orientation ==Qt::Horizontal) && (position > height()))
|
|
|
|
if ((m_orientation ==TQt::Horizontal) && (position > height()))
|
|
|
|
position = height();
|
|
|
|
position = height();
|
|
|
|
|
|
|
|
|
|
|
|
return position;
|
|
|
|
return position;
|
|
|
@ -411,7 +411,7 @@ bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e)
|
|
|
|
mev= (TQMouseEvent*)e;
|
|
|
|
mev= (TQMouseEvent*)e;
|
|
|
|
child0->setUpdatesEnabled(mOpaqueResize);
|
|
|
|
child0->setUpdatesEnabled(mOpaqueResize);
|
|
|
|
child1->setUpdatesEnabled(mOpaqueResize);
|
|
|
|
child1->setUpdatesEnabled(mOpaqueResize);
|
|
|
|
if (m_orientation ==Qt::Horizontal) {
|
|
|
|
if (m_orientation ==TQt::Horizontal) {
|
|
|
|
if ((fixedHeight0!=-1) || (fixedHeight1!=-1))
|
|
|
|
if ((fixedHeight0!=-1) || (fixedHeight1!=-1))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
handled=true; break;
|
|
|
|
handled=true; break;
|
|
|
@ -445,7 +445,7 @@ bool KDockSplitter::eventFilter(TQObject *o, TQEvent *e)
|
|
|
|
child0->setUpdatesEnabled(true);
|
|
|
|
child0->setUpdatesEnabled(true);
|
|
|
|
child1->setUpdatesEnabled(true);
|
|
|
|
child1->setUpdatesEnabled(true);
|
|
|
|
mev= (TQMouseEvent*)e;
|
|
|
|
mev= (TQMouseEvent*)e;
|
|
|
|
if (m_orientation ==Qt::Horizontal){
|
|
|
|
if (m_orientation ==TQt::Horizontal){
|
|
|
|
if ((fixedHeight0!=-1) || (fixedHeight1!=-1))
|
|
|
|
if ((fixedHeight0!=-1) || (fixedHeight1!=-1))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
handled=true; break;
|
|
|
|
handled=true; break;
|
|
|
|