summaryrefslogtreecommitdiffabout
path: root/microkde/KDGanttMinimizeSplitter.cpp
Unidiff
Diffstat (limited to 'microkde/KDGanttMinimizeSplitter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index 60b8bc7..567ae54 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -15,50 +15,50 @@
15 ** Licensees holding valid commercial KDGantt licenses may use this file in 15 ** Licensees holding valid commercial KDGantt licenses may use this file in
16 ** accordance with the KDGantt Commercial License Agreement provided with 16 ** accordance with the KDGantt Commercial License Agreement provided with
17 ** the Software. 17 ** the Software.
18 ** 18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 ** 21 **
22 ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for 22 ** See http://www.klaralvdalens-datakonsult.se/Public/products/ for
23 ** information about KDGantt Commercial License Agreements. 23 ** information about KDGantt Commercial License Agreements.
24 ** 24 **
25 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this 25 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
26 ** licensing are not clear to you. 26 ** licensing are not clear to you.
27 ** 27 **
28 ** As a special exception, permission is given to link this program 28 ** As a special exception, permission is given to link this program
29 ** with any edition of Qt, and distribute the resulting executable, 29 ** with any edition of Qt, and distribute the resulting executable,
30 ** without including the source code for Qt in the source distribution. 30 ** without including the source code for Qt in the source distribution.
31 ** 31 **
32 **********************************************************************/ 32 **********************************************************************/
33 33
34#include "KDGanttMinimizeSplitter.h" 34#include "KDGanttMinimizeSplitter.h"
35#ifndef QT_NO_SPLITTER___ 35#ifndef QT_NO_SPLITTER___
36 36
37#include "qpainter.h" 37#include "qpainter.h"
38#include "qdrawutil.h" 38#include "qdrawutil.h"
39#include "qbitmap.h" 39#include "qbitmap.h"
40#if QT_VERSION >= 300 40#if QT_VERSION >= 0x030000
41#include "qptrlist.h" 41#include "qptrlist.h"
42#include "qmemarray.h" 42#include "qmemarray.h"
43#else 43#else
44#include <qlist.h> 44#include <qlist.h>
45#include <qarray.h> 45#include <qarray.h>
46#define QPtrList QList 46#define QPtrList QList
47#define QMemArray QArray 47#define QMemArray QArray
48#endif 48#endif
49#include "qlayoutengine_p.h" 49#include "qlayoutengine_p.h"
50#include "qobjectlist.h" 50#include "qobjectlist.h"
51#include "qstyle.h" 51#include "qstyle.h"
52#include "qapplication.h" //sendPostedEvents 52#include "qapplication.h" //sendPostedEvents
53#include <qvaluelist.h> 53#include <qvaluelist.h>
54#include <qcursor.h> 54#include <qcursor.h>
55#ifndef KDGANTT_MASTER_CVS 55#ifndef KDGANTT_MASTER_CVS
56//#include "KDGanttMinimizeSplitter.moc" 56//#include "KDGanttMinimizeSplitter.moc"
57#endif 57#endif
58 58
59 59
60 60
61#ifndef DOXYGEN_SKIP_INTERNAL 61#ifndef DOXYGEN_SKIP_INTERNAL
62 62
63#if QT_VERSION >= 232 63#if QT_VERSION >= 232
64static int mouseOffset; 64static int mouseOffset;
@@ -606,49 +606,49 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c )
606 } 606 }
607 recalcId(); 607 recalcId();
608 doResize(); 608 doResize();
609 return; 609 return;
610 } 610 }
611 p = s; 611 p = s;
612 s = data->list.next(); 612 s = data->list.next();
613 } 613 }
614 } 614 }
615} 615}
616 616
617 617
618/*! 618/*!
619 Shows a rubber band at position \a p. If \a p is negative, the 619 Shows a rubber band at position \a p. If \a p is negative, the
620 rubber band is removed. 620 rubber band is removed.
621*/ 621*/
622void KDGanttMinimizeSplitter::setRubberband( int p ) 622void KDGanttMinimizeSplitter::setRubberband( int p )
623{ 623{
624 QPainter paint( this ); 624 QPainter paint( this );
625 paint.setPen( gray ); 625 paint.setPen( gray );
626 paint.setBrush( gray ); 626 paint.setBrush( gray );
627 paint.setRasterOp( XorROP ); 627 paint.setRasterOp( XorROP );
628 QRect r = contentsRect(); 628 QRect r = contentsRect();
629 const int rBord = 3; //Themable???? 629 const int rBord = 3; //Themable????
630#if QT_VERSION >= 300 630#if QT_VERSION >= 0x030000
631 int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); 631 int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
632#else 632#else
633 int sw = style().splitterWidth(); 633 int sw = style().splitterWidth();
634#endif 634#endif
635 if ( orient == Horizontal ) { 635 if ( orient == Horizontal ) {
636 if ( opaqueOldPos >= 0 ) 636 if ( opaqueOldPos >= 0 )
637 paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), 637 paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(),
638 2*rBord, r.height() ); 638 2*rBord, r.height() );
639 if ( p >= 0 ) 639 if ( p >= 0 )
640 paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); 640 paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() );
641 } else { 641 } else {
642 if ( opaqueOldPos >= 0 ) 642 if ( opaqueOldPos >= 0 )
643 paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, 643 paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord,
644 r.width(), 2*rBord ); 644 r.width(), 2*rBord );
645 if ( p >= 0 ) 645 if ( p >= 0 )
646 paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); 646 paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
647 } 647 }
648 opaqueOldPos = p; 648 opaqueOldPos = p;
649} 649}
650 650
651 651
652/*! \reimp */ 652/*! \reimp */
653bool KDGanttMinimizeSplitter::event( QEvent *e ) 653bool KDGanttMinimizeSplitter::event( QEvent *e )
654{ 654{
@@ -888,49 +888,49 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max )
888 if ( s->wid->isHidden() ) { 888 if ( s->wid->isHidden() ) {
889 //ignore 889 //ignore
890 } else if ( s->isSplitter ) { 890 } else if ( s->isSplitter ) {
891 minB += s->sizer; 891 minB += s->sizer;
892 maxB += s->sizer; 892 maxB += s->sizer;
893 } else { 893 } else {
894 minB += pick( minSize(s->wid) ); 894 minB += pick( minSize(s->wid) );
895 maxB += pick( s->wid->maximumSize() ); 895 maxB += pick( s->wid->maximumSize() );
896 } 896 }
897 } 897 }
898 for ( i = id; i < n; i++ ) { 898 for ( i = id; i < n; i++ ) {
899 QSplitterLayoutStruct *s = data->list.at(i); 899 QSplitterLayoutStruct *s = data->list.at(i);
900 if ( s->wid->isHidden() ) { 900 if ( s->wid->isHidden() ) {
901 //ignore 901 //ignore
902 } else if ( s->isSplitter ) { 902 } else if ( s->isSplitter ) {
903 minA += s->sizer; 903 minA += s->sizer;
904 maxA += s->sizer; 904 maxA += s->sizer;
905 } else { 905 } else {
906 minA += pick( minSize(s->wid) ); 906 minA += pick( minSize(s->wid) );
907 maxA += pick( s->wid->maximumSize() ); 907 maxA += pick( s->wid->maximumSize() );
908 } 908 }
909 } 909 }
910 QRect r = contentsRect(); 910 QRect r = contentsRect();
911 if ( orient == Horizontal && false ) { 911 if ( orient == Horizontal && false ) {
912#if QT_VERSION >= 300 912#if QT_VERSION >= 0x030000
913 int splitterWidth = style().pixelMetric(QStyle::PM_SplitterWidth, this); 913 int splitterWidth = style().pixelMetric(QStyle::PM_SplitterWidth, this);
914#else 914#else
915 int splitterWidth = style().splitterWidth(); 915 int splitterWidth = style().splitterWidth();
916#endif 916#endif
917 917
918 if ( min ) 918 if ( min )
919 *min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth; 919 *min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth;
920 if ( max ) 920 if ( max )
921 *max = pick(r.topRight()) - QMAX( minB, pick(r.size())-maxA ) - splitterWidth; 921 *max = pick(r.topRight()) - QMAX( minB, pick(r.size())-maxA ) - splitterWidth;
922 } else { 922 } else {
923 if ( min ) 923 if ( min )
924 *min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA ); 924 *min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA );
925 if ( max ) 925 if ( max )
926 *max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA ); 926 *max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA );
927 } 927 }
928} 928}
929 929
930 930
931/*! 931/*!
932 Returns the closest legal position to \a p of the splitter with id \a id. 932 Returns the closest legal position to \a p of the splitter with id \a id.
933 933
934 \sa idAfter() 934 \sa idAfter()
935*/ 935*/
936 936
@@ -1366,49 +1366,49 @@ void KDGanttMinimizeSplitter::setSizes( QValueList<int> list )
1366 s = data->list.next(); 1366 s = data->list.next();
1367 } 1367 }
1368 doResize(); 1368 doResize();
1369} 1369}
1370 1370
1371 1371
1372/*! 1372/*!
1373 Gets all posted child events, ensuring that the internal state of 1373 Gets all posted child events, ensuring that the internal state of
1374 the splitter is consistent. 1374 the splitter is consistent.
1375*/ 1375*/
1376 1376
1377void KDGanttMinimizeSplitter::processChildEvents() 1377void KDGanttMinimizeSplitter::processChildEvents()
1378{ 1378{
1379 QApplication::sendPostedEvents( this, QEvent::ChildInserted ); 1379 QApplication::sendPostedEvents( this, QEvent::ChildInserted );
1380} 1380}
1381 1381
1382 1382
1383/*! 1383/*!
1384 \reimp 1384 \reimp
1385*/ 1385*/
1386 1386
1387void KDGanttMinimizeSplitter::styleChange( QStyle& old ) 1387void KDGanttMinimizeSplitter::styleChange( QStyle& old )
1388{ 1388{
1389 1389
1390#if QT_VERSION >= 300 1390#if QT_VERSION >= 0x030000
1391 int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); 1391 int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
1392#else 1392#else
1393 int sw = style().splitterWidth(); 1393 int sw = style().splitterWidth();
1394#endif 1394#endif
1395 QSplitterLayoutStruct *s = data->list.first(); 1395 QSplitterLayoutStruct *s = data->list.first();
1396 while ( s ) { 1396 while ( s ) {
1397 if ( s->isSplitter ) 1397 if ( s->isSplitter )
1398 s->sizer = sw; 1398 s->sizer = sw;
1399 s = data->list.next(); 1399 s = data->list.next();
1400 } 1400 }
1401 doResize(); 1401 doResize();
1402 QFrame::styleChange( old ); 1402 QFrame::styleChange( old );
1403} 1403}
1404 1404
1405#endif 1405#endif
1406 1406
1407/*! 1407/*!
1408 Specifies the direction of the minimize buttons. 1408 Specifies the direction of the minimize buttons.
1409 If the orientation of the splitter is horizontal then with 1409 If the orientation of the splitter is horizontal then with
1410 KDGanttMinimizeSplitter::Left or KDGanttMinimizeSplitter::Right should be used, 1410 KDGanttMinimizeSplitter::Left or KDGanttMinimizeSplitter::Right should be used,
1411 otherwise either KDGanttMinimizeSplitter::Up or KDGanttMinimizeSplitter::Down 1411 otherwise either KDGanttMinimizeSplitter::Up or KDGanttMinimizeSplitter::Down
1412 should be used. 1412 should be used.
1413*/ 1413*/
1414void KDGanttMinimizeSplitter::setMinimizeDirection( Direction direction ) 1414void KDGanttMinimizeSplitter::setMinimizeDirection( Direction direction )