• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kdgantt1

KDGanttMinimizeSplitter.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002    $Id: KDGanttMinimizeSplitter.h,v 1.8 2005/10/11 13:59:02 lutz Exp $
00003 */
00004 
00005 /****************************************************************************
00006  ** Copyright (C)  2001-2004 Klarälvdalens Datakonsult AB.  All rights reserved.
00007  **
00008  ** This file is part of the KDGantt library.
00009  **
00010  ** This file may be used under the terms of the GNU General Public
00011  ** License versions 2.0 or 3.0 as published by the Free Software
00012  ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
00013  ** included in the packaging of this file.  Alternatively you may (at
00014  ** your option) use any later version of the GNU General Public
00015  ** License if such license has been publicly approved by
00016  ** Klarälvdalens Datakonsult AB (or its successors, if any).
00017  ** 
00018  ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
00019  ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
00020  ** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
00021  ** not expressly granted herein.
00022  ** 
00023  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00024  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00025  **
00026  ** As a special exception, permission is given to link this program
00027  ** with any edition of Qt, and distribute the resulting executable,
00028  ** without including the source code for Qt in the source distribution.
00029  **
00030  **********************************************************************/
00031 
00032 #ifndef KDGANTTMINIMIZESPLITTER_H
00033 #define KDGANTTMINIMIZESPLITTER_H
00034 
00035 
00036 #ifndef QT_H
00037 #include "qframe.h"
00038 #endif // QT_H
00039 
00040 #include "kdgantt_qt3_compat.h"
00041 
00042 #ifndef QT_NO_SPLITTER
00043 
00044 #if QT_VERSION < 0x040000 
00045 
00046 #include "qvaluelist.h"
00047 
00048 class QSplitterData;
00049 class QSplitterLayoutStruct;
00050 
00051 class KDGanttMinimizeSplitter : public QFrame
00052 {
00053     Q_OBJECT
00054     Q_ENUMS( Direction )
00055     Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
00056     Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection )
00057 
00058 public:
00059     enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
00060     enum Direction { Left, Right, Up, Down };
00061 
00062     KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 );
00063     KDGanttMinimizeSplitter( Qt::Orientation, QWidget* parent=0, const char* name=0 );
00064     ~KDGanttMinimizeSplitter();
00065 
00066     virtual void setOrientation( Orientation );
00067     Orientation orientation() const { return orient; }
00068 
00069     void setMinimizeDirection( Direction );
00070     Direction minimizeDirection() const;
00071 
00072 #if QT_VERSION >= 300
00073     virtual void setResizeMode( QWidget *w, ResizeMode );
00074     virtual void setOpaqueResize( bool = true );
00075     bool opaqueResize() const;
00076 
00077     void moveToFirst( QWidget * );
00078     void moveToLast( QWidget * );
00079 
00080     void refresh() { recalc( true ); }
00081     virtual QSize sizeHint() const;
00082     virtual QSize minimumSizeHint() const;
00083 
00084     QValueList<int> sizes() const;
00085     void setSizes( QValueList<int> );
00086 
00087     void expandPos( int id, int* min, int* max );
00088 protected:
00089     void childEvent( QChildEvent * );
00090 
00091     bool event( QEvent * );
00092     void resizeEvent( QResizeEvent * );
00093 
00094     int idAfter( QWidget* ) const;
00095 
00096     void moveSplitter( QCOORD pos, int id );
00097     virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
00098                    QCOORD w, QCOORD h );
00099     void styleChange( QStyle& );
00100     int adjustPos( int , int );
00101     virtual void setRubberband( int );
00102     void getRange( int id, int*, int* );
00103 
00104 private:
00105     void init();
00106     void recalc( bool update = false );
00107     void doResize();
00108     void storeSizes();
00109     void processChildEvents();
00110     QSplitterLayoutStruct *addWidget( QWidget*, bool first = false );
00111     void recalcId();
00112     void moveBefore( int pos, int id, bool upLeft );
00113     void moveAfter( int pos, int id, bool upLeft );
00114     void setG( QWidget *w, int p, int s, bool isSplitter = false );
00115 
00116     QCOORD pick( const QPoint &p ) const
00117     { return orient == Qt::Horizontal ? p.x() : p.y(); }
00118     QCOORD pick( const QSize &s ) const
00119     { return orient == Qt::Horizontal ? s.width() : s.height(); }
00120 
00121     QCOORD trans( const QPoint &p ) const
00122     { return orient == Qt::Vertical ? p.x() : p.y(); }
00123     QCOORD trans( const QSize &s ) const
00124     { return orient == Qt::Vertical ? s.width() : s.height(); }
00125 
00126     QSplitterData *data;
00127 #endif
00128 
00129 private:
00130     Qt::Orientation orient;
00131     Direction _direction;
00132 #ifndef DOXYGEN_SKIP_INTERNAL
00133     friend class KDGanttSplitterHandle;
00134 #endif
00135 private:    // Disabled copy constructor and operator=
00136 #if defined(Q_DISABLE_COPY)
00137     KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & );
00138     KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & );
00139 #endif
00140 };
00141 
00142 #ifndef DOXYGEN_SKIP_INTERNAL
00143 // This class was continued from a verbatim copy of the
00144 // QSplitterHandle pertaining to the Qt Enterprise License and the
00145 // GPL. It has only been renamed to KDGanttSplitterHandler in order to
00146 // avoid a symbol clash on some platforms.
00147 class KDGanttSplitterHandle : public QWidget
00148 {
00149     Q_OBJECT
00150 #if QT_VERSION >= 300
00151 public:
00152     KDGanttSplitterHandle( Qt::Orientation o,
00153                KDGanttMinimizeSplitter *parent, const char* name=0 );
00154     void setOrientation( Qt::Orientation o );
00155     Qt::Orientation orientation() const { return orient; }
00156 
00157     bool opaque() const { return s->opaqueResize(); }
00158 
00159     QSize sizeHint() const;
00160 
00161     int id() const { return myId; } // data->list.at(id())->wid == this
00162     void setId( int i ) { myId = i; }
00163 
00164 protected:
00165     QValueList<QPointArray> buttonRegions();
00166     void paintEvent( QPaintEvent * );
00167     void mouseMoveEvent( QMouseEvent * );
00168     void mousePressEvent( QMouseEvent * );
00169     void mouseReleaseEvent( QMouseEvent * );
00170     int onButton( const QPoint& p );
00171     void updateCursor( const QPoint& p );
00172 
00173 private:
00174     Qt::Orientation orient;
00175     bool opaq;
00176     int myId;
00177 
00178     KDGanttMinimizeSplitter *s;
00179     int _activeButton;
00180     bool _collapsed;
00181     int _origPos;
00182 #endif
00183 };
00184 #endif
00185 
00186 #else  //QT_VERSION < 0x040000
00187 
00188 #include <QSplitter>
00189 
00190 #define KDGanttMinimizeSplitter QSplitter
00191 
00192 
00193 #endif // QT_VERSION < 0x040000
00194 
00195 #endif // QT_NO_SPLITTER
00196 
00197 #endif // KDGANTTMINIMIZESPLITTER_H

kdgantt1

Skip menu "kdgantt1"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal