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 84d3d8e..585298d 100644
--- a/microkde/KDGanttMinimizeSplitter.h
+++ b/microkde/KDGanttMinimizeSplitter.h
@@ -1,189 +1,191 @@
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 );
83 QFrame* rubberBand() { return mRubberBand ;}
83public slots: 84public slots:
84 void toggle(); 85 void toggle();
85protected: 86protected:
86 void childEvent( QChildEvent * ); 87 void childEvent( QChildEvent * );
87 88
88 bool event( QEvent * ); 89 bool event( QEvent * );
89 void resizeEvent( QResizeEvent * ); 90 void resizeEvent( QResizeEvent * );
90 91
91 int idAfter( QWidget* ) const; 92 int idAfter( QWidget* ) const;
92 93
93 void moveSplitter( QCOORD pos, int id ); 94 void moveSplitter( QCOORD pos, int id );
94 virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y, 95 virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
95 QCOORD w, QCOORD h ); 96 QCOORD w, QCOORD h );
96 void styleChange( QStyle& ); 97 void styleChange( QStyle& );
97 int adjustPos( int , int ); 98 int adjustPos( int , int );
98 virtual void setRubberband( int ); 99 virtual void setRubberband( int );
99 void getRange( int id, int*, int* ); 100 void getRange( int id, int*, int* );
100 101
101private: 102private:
103 QFrame* mRubberBand;
102 void init(); 104 void init();
103 void recalc( bool update = FALSE ); 105 void recalc( bool update = FALSE );
104 void doResize(); 106 void doResize();
105 void storeSizes(); 107 void storeSizes();
106 void processChildEvents(); 108 void processChildEvents();
107 QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); 109 QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE );
108 void recalcId(); 110 void recalcId();
109 void moveBefore( int pos, int id, bool upLeft ); 111 void moveBefore( int pos, int id, bool upLeft );
110 void moveAfter( int pos, int id, bool upLeft ); 112 void moveAfter( int pos, int id, bool upLeft );
111 void setG( QWidget *w, int p, int s, bool isSplitter = FALSE ); 113 void setG( QWidget *w, int p, int s, bool isSplitter = FALSE );
112 114
113 QCOORD pick( const QPoint &p ) const 115 QCOORD pick( const QPoint &p ) const
114 { return orient == Horizontal ? p.x() : p.y(); } 116 { return orient == Horizontal ? p.x() : p.y(); }
115 QCOORD pick( const QSize &s ) const 117 QCOORD pick( const QSize &s ) const
116 { return orient == Horizontal ? s.width() : s.height(); } 118 { return orient == Horizontal ? s.width() : s.height(); }
117 119
118 QCOORD trans( const QPoint &p ) const 120 QCOORD trans( const QPoint &p ) const
119 { return orient == Vertical ? p.x() : p.y(); } 121 { return orient == Vertical ? p.x() : p.y(); }
120 QCOORD trans( const QSize &s ) const 122 QCOORD trans( const QSize &s ) const
121 { return orient == Vertical ? s.width() : s.height(); } 123 { return orient == Vertical ? s.width() : s.height(); }
122 KDGanttSplitterHandle* mFirstHandle; 124 KDGanttSplitterHandle* mFirstHandle;
123 QSplitterData *data; 125 QSplitterData *data;
124#endif 126#endif
125 127
126private: 128private:
127 Orientation orient; 129 Orientation orient;
128 Direction _direction; 130 Direction _direction;
129#ifndef DOXYGEN_SKIP_INTERNAL 131#ifndef DOXYGEN_SKIP_INTERNAL
130 friend class KDGanttSplitterHandle; 132 friend class KDGanttSplitterHandle;
131#endif 133#endif
132 private:// Disabled copy constructor and operator= 134 private:// Disabled copy constructor and operator=
133#if defined(Q_DISABLE_COPY) 135#if defined(Q_DISABLE_COPY)
134 KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & ); 136 KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & );
135 KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & ); 137 KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & );
136#endif 138#endif
137}; 139};
138 140
139#ifndef DOXYGEN_SKIP_INTERNAL 141#ifndef DOXYGEN_SKIP_INTERNAL
140// This class was continued from a verbatim copy of the 142// This class was continued from a verbatim copy of the
141// QSplitterHandle pertaining to the Qt Enterprise License and the 143// QSplitterHandle pertaining to the Qt Enterprise License and the
142// GPL. It has only been renamed to KDGanttSplitterHandler in order to 144// GPL. It has only been renamed to KDGanttSplitterHandler in order to
143// avoid a symbol clash on some platforms. 145// avoid a symbol clash on some platforms.
144class KDGanttSplitterHandle : public QWidget 146class KDGanttSplitterHandle : public QWidget
145{ 147{
146 Q_OBJECT 148 Q_OBJECT
147#if QT_VERSION >= 232 149#if QT_VERSION >= 232
148public: 150public:
149 KDGanttSplitterHandle( Qt::Orientation o, 151 KDGanttSplitterHandle( Qt::Orientation o,
150 KDGanttMinimizeSplitter *parent, const char* name=0 ); 152 KDGanttMinimizeSplitter *parent, const char* name=0 );
151 void setOrientation( Qt::Orientation o ); 153 void setOrientation( Qt::Orientation o );
152 Qt::Orientation orientation() const { return orient; } 154 Qt::Orientation orientation() const { return orient; }
153 155
154 bool opaque() const { return s->opaqueResize(); } 156 bool opaque() const { return s->opaqueResize(); }
155 157
156 QSize sizeHint() const; 158 QSize sizeHint() const;
157 void toggle(); 159 void toggle();
158 160
159 int id() const { return myId; } // data->list.at(id())->wid == this 161 int id() const { return myId; } // data->list.at(id())->wid == this
160 void setId( int i ) { myId = i; } 162 void setId( int i ) { myId = i; }
161 163
162protected: 164protected:
163 QValueList<QPointArray> buttonRegions(); 165 QValueList<QPointArray> buttonRegions();
164 void paintEvent( QPaintEvent * ); 166 void paintEvent( QPaintEvent * );
165 void mouseMoveEvent( QMouseEvent * ); 167 void mouseMoveEvent( QMouseEvent * );
166 void mousePressEvent( QMouseEvent * ); 168 void mousePressEvent( QMouseEvent * );
167 void mouseReleaseEvent( QMouseEvent * ); 169 void mouseReleaseEvent( QMouseEvent * );
168 int onButton( const QPoint& p ); 170 int onButton( const QPoint& p );
169 void updateCursor( const QPoint& p ); 171 void updateCursor( const QPoint& p );
170 172
171private: 173private:
172 bool mMouseDown; 174 bool mMouseDown;
173 QSize mSizeHint; 175 QSize mSizeHint;
174 bool mUseOffset; 176 bool mUseOffset;
175 Qt::Orientation orient; 177 Qt::Orientation orient;
176 bool opaq; 178 bool opaq;
177 int myId; 179 int myId;
178 180
179 KDGanttMinimizeSplitter *s; 181 KDGanttMinimizeSplitter *s;
180 int _activeButton; 182 int _activeButton;
181 bool _collapsed; 183 bool _collapsed;
182 int _origPos; 184 int _origPos;
183#endif 185#endif
184}; 186};
185#endif 187#endif
186 188
187#endif // QT_NO_SPLITTER 189#endif // QT_NO_SPLITTER
188 190
189#endif // KDGANTTMINIMIZESPLITTER_H 191#endif // KDGANTTMINIMIZESPLITTER_H