Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qaquastyle_p.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of Aqua-style guidelines functions 00005 ** 00006 ** Created : 001129 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the style module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed and/or modified under the terms of the 00013 ** GNU General Public License version 2 as published by the Free Software 00014 ** Foundation and appearing in the file LICENSE.GPL included in the 00015 ** packaging of this file. 00016 ** 00017 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00018 ** licenses for Macintosh may use this file in accordance with the Qt Commercial 00019 ** License Agreement provided with the Software. 00020 ** 00021 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00022 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00023 ** 00024 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00025 ** information about Qt Commercial License Agreements. 00026 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00027 ** 00028 ** Contact info@trolltech.com if any conditions of this licensing are 00029 ** not clear to you. 00030 ** 00031 **********************************************************************/ 00032 00033 #ifndef QAQUASTYLE_P_H 00034 #define QAQUASTYLE_P_H 00035 00036 // 00037 // W A R N I N G 00038 // ------------- 00039 // 00040 // This file is not part of the Qt API. It exists for the convenience 00041 // of a number of Qt sources files. This header file may change from 00042 // version to version without notice, or even be removed. 00043 // 00044 // We mean it. 00045 // 00046 // 00047 00048 #ifndef QT_H 00049 # include "qstyle.h" 00050 # include "qwidget.h" 00051 #endif // QT_H 00052 00053 class QAquaFocusWidget : public QWidget 00054 { 00055 Q_OBJECT 00056 public: 00057 QAquaFocusWidget(bool noerase=TRUE, QWidget *w=NULL); 00058 ~QAquaFocusWidget() {} 00059 void setFocusWidget( QWidget * widget ); 00060 QWidget* widget() { return d; } 00061 QSize sizeHint() { return QSize( 0, 0 ); } 00062 00063 protected: 00064 bool eventFilter( QObject * o, QEvent * e ); 00065 00066 protected: 00067 virtual void paintEvent( QPaintEvent * ) = 0; 00068 virtual int focusOutset() { return 3; } 00069 virtual QRegion focusRegion() { return QRegion( focusOutset() + 2, focusOutset() + 2, 00070 width() - ((focusOutset() + 2) * 2), 00071 height() - ((focusOutset() + 2) * 2)); } 00072 00073 private: 00074 QWidget *d; 00075 }; 00076 00077 struct QAquaAnimatePrivate; 00078 class QAquaAnimate : public QObject 00079 { 00080 Q_OBJECT 00081 QAquaAnimatePrivate *d; 00082 public: 00083 QAquaAnimate(); 00084 ~QAquaAnimate(); 00085 00086 //give the widget over 00087 virtual bool addWidget(QWidget *); 00088 virtual void removeWidget(QWidget *); 00089 00090 //animation things 00091 enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen }; 00092 bool animatable(Animates, QWidget *); 00093 bool animatable(Animates, QListViewItem *); 00094 void stopAnimate(Animates, QWidget *); 00095 void stopAnimate(Animates, QListViewItem *); 00096 00097 //focus things 00098 static bool focusable(QWidget *); 00099 QWidget *focusWidget() const; 00100 00101 protected: 00102 //finally do the animate.. 00103 virtual bool doAnimate(Animates) = 0; 00104 //finally set the focus 00105 void setFocusWidget(QWidget *); 00106 virtual void doFocus(QWidget *w) = 0; 00107 00108 protected: 00109 bool eventFilter(QObject *, QEvent *); 00110 void timerEvent( QTimerEvent * ); 00111 00112 private slots: 00113 void objDestroyed(QObject *o); 00114 void lvi(QListViewItem *); 00115 }; 00116 00117 /* 00118 Hackish method of finding out whether the window is active or not 00119 */ 00120 static inline bool qAquaActive( const QColorGroup & g ) 00121 { 00122 if( g.link() == QColor( 148,148,148 ) ) 00123 return FALSE; 00124 else 00125 return TRUE; 00126 } 00127 00128 /* 00129 Detects sizes to comply with Aqua Style Guidelines 00130 */ 00131 enum QAquaWidgetSize { QAquaSizeLarge, QAquaSizeSmall, QAquaSizeUnknown }; 00132 QAquaWidgetSize qt_aqua_size_constrain(const QWidget *widg, 00133 QStyle::ContentsType ct=QStyle::CT_CustomBase, 00134 QSize szHint=QSize(-1, -1), QSize *insz=NULL); 00135 00136 #endif /* QAQUASTYLE_P_H */