summaryrefslogtreecommitdiffabout
path: root/microkde/KDGanttMinimizeSplitter.h
Unidiff
Diffstat (limited to 'microkde/KDGanttMinimizeSplitter.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/KDGanttMinimizeSplitter.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h
index 75e0443..8120d14 100644
--- a/microkde/KDGanttMinimizeSplitter.h
+++ b/microkde/KDGanttMinimizeSplitter.h
@@ -1,186 +1,188 @@
1/* -*- Mode: C++ -*- 1/* -*- Mode: C++ -*-
2 $Id$ 2 $Id$
3*/ 3*/
4 4
5/**************************************************************************** 5/****************************************************************************
6 ** Copyright (C) 2001-2004 Klarälvdalens Datakonsult AB. All rights reserved. 6 ** Copyright (C) 2001-2004 Klarälvdalens Datakonsult AB. All rights reserved.
7 ** 7 **
8 ** This file is part of the KDGantt library. 8 ** This file is part of the KDGantt library.
9 ** 9 **
10 ** This file may be distributed and/or modified under the terms of the 10 ** This file may be distributed and/or modified under the terms of the
11 ** GNU General Public License version 2 as published by the Free Software 11 ** GNU General Public License version 2 as published by the Free Software
12 ** Foundation and appearing in the file LICENSE.GPL included in the 12 ** Foundation and appearing in the file LICENSE.GPL included in the
13 ** packaging of this file. 13 ** packaging of this file.
14 ** 14 **
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#ifndef KDGANTTMINIMIZESPLITTER_H 34#ifndef KDGANTTMINIMIZESPLITTER_H
35#define KDGANTTMINIMIZESPLITTER_H 35#define KDGANTTMINIMIZESPLITTER_H
36 36
37#ifndef QT_H 37#ifndef QT_H
38#include "qframe.h" 38#include "qframe.h"
39#include "qvaluelist.h" 39#include "qvaluelist.h"
40#endif // QT_H 40#endif // QT_H
41 41
42#ifndef QT_NO_SPLITTER___ 42#ifndef QT_NO_SPLITTER___
43class QSplitterData; 43class QSplitterData;
44class QSplitterLayoutStruct; 44class QSplitterLayoutStruct;
45class KDGanttSplitterHandle; 45class KDGanttSplitterHandle;
46class KDGanttMinimizeSplitter : public QFrame 46class KDGanttMinimizeSplitter : public QFrame
47{ 47{
48 Q_OBJECT 48 Q_OBJECT
49 // Q_ENUMS( Direction ) 49 // Q_ENUMS( Direction )
50 // Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) 50 // Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
51 // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection ) 51 // Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection )
52 52
53public: 53public:
54 enum ResizeMode { Stretch, KeepSize, FollowSizeHint }; 54 enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
55 enum Direction { Left, Right, Up, Down }; 55 enum Direction { Left, Right, Up, Down };
56 56
57 KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 ); 57 KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 );
58 KDGanttMinimizeSplitter( Orientation, QWidget* parent=0, const char* name=0 ); 58 KDGanttMinimizeSplitter( Orientation, QWidget* parent=0, const char* name=0 );
59 ~KDGanttMinimizeSplitter(); 59 ~KDGanttMinimizeSplitter();
60 60
61 virtual void setOrientation( Orientation ); 61 virtual void setOrientation( Orientation );
62 Orientation orientation() const { return orient; } 62 Orientation orientation() const { return orient; }
63 63
64 void setMinimizeDirection( Direction ); 64 void setMinimizeDirection( Direction );
65 Direction minimizeDirection() const; 65 Direction minimizeDirection() const;
66 66
67#if QT_VERSION >= 232 67#if QT_VERSION >= 232
68 virtual void setResizeMode( QWidget *w, ResizeMode ); 68 virtual void setResizeMode( QWidget *w, ResizeMode );
69 virtual void setOpaqueResize( bool = TRUE ); 69 virtual void setOpaqueResize( bool = TRUE );
70 bool opaqueResize() const; 70 bool opaqueResize() const;
71 71
72 void moveToFirst( QWidget * ); 72 void moveToFirst( QWidget * );
73 void moveToLast( QWidget * ); 73 void moveToLast( QWidget * );
74 74
75 void refresh() { recalc( TRUE ); } 75 void refresh() { recalc( TRUE ); }
76 QSize sizeHint() const; 76 QSize sizeHint() const;
77 QSize minimumSizeHint() const; 77 QSize minimumSizeHint() const;
78 78
79 QValueList<int> sizes() const; 79 QValueList<int> sizes() const;
80 void setSizes( QValueList<int> ); 80 void setSizes( QValueList<int> );
81 KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} 81 KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;}
82 void expandPos( int id, int* min, int* max ); 82 void expandPos( int id, int* min, int* max );
83public slots:
84 void toggle();
83protected: 85protected:
84 void childEvent( QChildEvent * ); 86 void childEvent( QChildEvent * );
85 87
86 bool event( QEvent * ); 88 bool event( QEvent * );
87 void resizeEvent( QResizeEvent * ); 89 void resizeEvent( QResizeEvent * );
88 90
89 int idAfter( QWidget* ) const; 91 int idAfter( QWidget* ) const;
90 92
91 void moveSplitter( QCOORD pos, int id ); 93 void moveSplitter( QCOORD pos, int id );
92 virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, 94 virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
93 QCOORD w, QCOORD h ); 95 QCOORD w, QCOORD h );
94 void styleChange( QStyle& ); 96 void styleChange( QStyle& );
95 int adjustPos( int , int ); 97 int adjustPos( int , int );
96 virtual void setRubberband( int ); 98 virtual void setRubberband( int );
97 void getRange( int id, int*, int* ); 99 void getRange( int id, int*, int* );
98 100
99private: 101private:
100 void init(); 102 void init();
101 void recalc( bool update = FALSE ); 103 void recalc( bool update = FALSE );
102 void doResize(); 104 void doResize();
103 void storeSizes(); 105 void storeSizes();
104 void processChildEvents(); 106 void processChildEvents();
105 QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); 107 QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE );
106 void recalcId(); 108 void recalcId();
107 void moveBefore( int pos, int id, bool upLeft ); 109 void moveBefore( int pos, int id, bool upLeft );
108 void moveAfter( int pos, int id, bool upLeft ); 110 void moveAfter( int pos, int id, bool upLeft );
109 void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); 111 void setG( QWidget *w, int p, int s, bool isSplitter = FALSE );
110 112
111 QCOORD pick( const QPoint &p ) const 113 QCOORD pick( const QPoint &p ) const
112 { return orient == Horizontal ? p.x() : p.y(); } 114 { return orient == Horizontal ? p.x() : p.y(); }
113 QCOORD pick( const QSize &s ) const 115 QCOORD pick( const QSize &s ) const
114 { return orient == Horizontal ? s.width() : s.height(); } 116 { return orient == Horizontal ? s.width() : s.height(); }
115 117
116 QCOORD trans( const QPoint &p ) const 118 QCOORD trans( const QPoint &p ) const
117 { return orient == Vertical ? p.x() : p.y(); } 119 { return orient == Vertical ? p.x() : p.y(); }
118 QCOORD trans( const QSize &s ) const 120 QCOORD trans( const QSize &s ) const
119 { return orient == Vertical ? s.width() : s.height(); } 121 { return orient == Vertical ? s.width() : s.height(); }
120 KDGanttSplitterHandle* mFirstHandle; 122 KDGanttSplitterHandle* mFirstHandle;
121 QSplitterData *data; 123 QSplitterData *data;
122#endif 124#endif
123 125
124private: 126private:
125 Orientation orient; 127 Orientation orient;
126 Direction _direction; 128 Direction _direction;
127#ifndef DOXYGEN_SKIP_INTERNAL 129#ifndef DOXYGEN_SKIP_INTERNAL
128 friend class KDGanttSplitterHandle; 130 friend class KDGanttSplitterHandle;
129#endif 131#endif
130 private:// Disabled copy constructor and operator= 132 private:// Disabled copy constructor and operator=
131#if defined(Q_DISABLE_COPY) 133#if defined(Q_DISABLE_COPY)
132 KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & ); 134 KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & );
133 KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & ); 135 KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & );
134#endif 136#endif
135}; 137};
136 138
137#ifndef DOXYGEN_SKIP_INTERNAL 139#ifndef DOXYGEN_SKIP_INTERNAL
138// This class was continued from a verbatim copy of the 140// This class was continued from a verbatim copy of the
139// QSplitterHandle pertaining to the Qt Enterprise License and the 141// QSplitterHandle pertaining to the Qt Enterprise License and the
140// GPL. It has only been renamed to KDGanttSplitterHandler in order to 142// GPL. It has only been renamed to KDGanttSplitterHandler in order to
141// avoid a symbol clash on some platforms. 143// avoid a symbol clash on some platforms.
142class KDGanttSplitterHandle : public QWidget 144class KDGanttSplitterHandle : public QWidget
143{ 145{
144 Q_OBJECT 146 Q_OBJECT
145#if QT_VERSION >= 232 147#if QT_VERSION >= 232
146public: 148public:
147 KDGanttSplitterHandle( Qt::Orientation o, 149 KDGanttSplitterHandle( Qt::Orientation o,
148 KDGanttMinimizeSplitter *parent, const char* name=0 ); 150 KDGanttMinimizeSplitter *parent, const char* name=0 );
149 void setOrientation( Qt::Orientation o ); 151 void setOrientation( Qt::Orientation o );
150 Qt::Orientation orientation() const { return orient; } 152 Qt::Orientation orientation() const { return orient; }
151 153
152 bool opaque() const { return s->opaqueResize(); } 154 bool opaque() const { return s->opaqueResize(); }
153 155
154 QSize sizeHint() const; 156 QSize sizeHint() const;
155 void toggle(); 157 void toggle();
156 158
157 int id() const { return myId; } // data->list.at(id())->wid == this 159 int id() const { return myId; } // data->list.at(id())->wid == this
158 void setId( int i ) { myId = i; } 160 void setId( int i ) { myId = i; }
159 161
160protected: 162protected:
161 QValueList<QPointArray> buttonRegions(); 163 QValueList<QPointArray> buttonRegions();
162 void paintEvent( QPaintEvent * ); 164 void paintEvent( QPaintEvent * );
163 void mouseMoveEvent( QMouseEvent * ); 165 void mouseMoveEvent( QMouseEvent * );
164 void mousePressEvent( QMouseEvent * ); 166 void mousePressEvent( QMouseEvent * );
165 void mouseReleaseEvent( QMouseEvent * ); 167 void mouseReleaseEvent( QMouseEvent * );
166 int onButton( const QPoint& p ); 168 int onButton( const QPoint& p );
167 void updateCursor( const QPoint& p ); 169 void updateCursor( const QPoint& p );
168 170
169private: 171private:
170 QSize mSizeHint; 172 QSize mSizeHint;
171 bool mUseOffset; 173 bool mUseOffset;
172 Qt::Orientation orient; 174 Qt::Orientation orient;
173 bool opaq; 175 bool opaq;
174 int myId; 176 int myId;
175 177
176 KDGanttMinimizeSplitter *s; 178 KDGanttMinimizeSplitter *s;
177 int _activeButton; 179 int _activeButton;
178 bool _collapsed; 180 bool _collapsed;
179 int _origPos; 181 int _origPos;
180#endif 182#endif
181}; 183};
182#endif 184#endif
183 185
184#endif // QT_NO_SPLITTER 186#endif // QT_NO_SPLITTER
185 187
186#endif // KDGANTTMINIMIZESPLITTER_H 188#endif // KDGANTTMINIMIZESPLITTER_H