Eneboo - Documentación para desarrolladores
src/qt/src/widgets/qwidgetresizehandler_p.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qwidgetresizehandler_p.h   3.3.8   edited Jan 11 14:39 $
00003 **
00004 ** Definition of the QWidgetResizeHandler class
00005 **
00006 ** Created : 001010
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the workspace module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition licenses may use this
00022 ** file in accordance with the Qt Commercial License Agreement provided
00023 ** with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QWIDGETRESIZEHANDLER_P_H
00039 #define QWIDGETRESIZEHANDLER_P_H
00040 
00041 //
00042 //  W A R N I N G
00043 //  -------------
00044 //
00045 // This file is not part of the Qt API.  This header file may
00046 // change from version to version without notice, or even be
00047 // removed.
00048 //
00049 // We mean it.
00050 //
00051 //
00052 
00053 #ifndef QT_H
00054 #include "qobject.h"
00055 #endif // QT_H
00056 #ifndef QT_NO_RESIZEHANDLER
00057 class QMouseEvent;
00058 class QKeyEvent;
00059 
00060 class Q_EXPORT QWidgetResizeHandler : public QObject
00061 {
00062     Q_OBJECT
00063 
00064 public:
00065     enum Action {
00066         Move    = 0x01,
00067         Resize  = 0x02,
00068         Any     = Move|Resize
00069     };
00070 
00071     QWidgetResizeHandler( QWidget *parent, QWidget *cw = 0, const char *name = 0 );
00072     void setActive( bool b ) { setActive( Any, b ); }
00073     void setActive( Action ac, bool b );
00074     bool isActive() const { return isActive( Any ); }
00075     bool isActive( Action ac ) const;
00076     void setMovingEnabled( bool b ) { moving = b; }
00077     bool isMovingEnabled() const { return moving; }
00078 
00079     bool isButtonDown() const { return buttonDown; }
00080 
00081     void setExtraHeight( int h ) { extrahei = h; }
00082     void setSizeProtection( bool b ) { sizeprotect = b; }
00083 
00084     void doResize();
00085     void doMove();
00086 
00087 signals:
00088     void activate();
00089 
00090 protected:
00091     bool eventFilter( QObject *o, QEvent *e );
00092     void mouseMoveEvent( QMouseEvent *e );
00093     void keyPressEvent( QKeyEvent *e );
00094 
00095 private:
00096     enum MousePosition {
00097         Nowhere,
00098         TopLeft, BottomRight, BottomLeft, TopRight,
00099         Top, Bottom, Left, Right,
00100         Center
00101     };
00102 
00103     QWidget *widget;
00104     QWidget *childWidget;
00105     QPoint moveOffset;
00106     QPoint invertedMoveOffset;
00107     MousePosition mode;
00108     int extrahei;
00109     int range;
00110     uint buttonDown         :1;
00111     uint moveResizeMode     :1;
00112     uint activeForResize    :1;
00113     uint sizeprotect        :1;
00114     uint moving             :1; 
00115     uint activeForMove      :1;
00116 
00117     void setMouseCursor( MousePosition m );
00118     bool isMove() const {
00119         return moveResizeMode && mode == Center;
00120     }
00121     bool isResize() const {
00122         return moveResizeMode && !isMove();
00123     }
00124 
00125 private:        // Disabled copy constructor and operator=
00126 #if defined(Q_DISABLE_COPY)
00127     QWidgetResizeHandler( const QWidgetResizeHandler & );
00128     QWidgetResizeHandler& operator=( const QWidgetResizeHandler & );
00129 #endif
00130 
00131 };
00132 
00133 #endif //QT_NO_RESIZEHANDLER
00134 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'