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