Eneboo - Documentación para desarrolladores
src/qt/include/qpalette.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qpalette.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QColorGroup and QPalette classes
00005 **
00006 ** Created : 950323
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the kernel 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 or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided 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 QPALETTE_H
00039 #define QPALETTE_H
00040 
00041 #ifndef QT_H
00042 #include "qwindowdefs.h"
00043 #include "qcolor.h"
00044 #include "qshared.h"
00045 #include "qbrush.h" // QColor->QBrush conversion
00046 #endif // QT_H
00047 
00048 #ifndef QT_NO_PALETTE
00049 
00050 class QColorGroupPrivate;
00051 
00052 class Q_EXPORT QColorGroup
00053 {
00054 public:
00055     QColorGroup();
00056     QColorGroup( const QColor &foreground, const QColor &button,
00057                  const QColor &light, const QColor &dark, const QColor &mid,
00058                  const QColor &text, const QColor &base );
00059     QColorGroup( const QBrush &foreground, const QBrush &button,
00060                  const QBrush &light, const QBrush &dark, const QBrush &mid,
00061                  const QBrush &text, const QBrush &bright_text,
00062                  const QBrush &base, const QBrush &background);
00063     QColorGroup( const QColorGroup & );
00064 
00065    ~QColorGroup();
00066 
00067     QColorGroup& operator =(const QColorGroup&);
00068 
00069     // Do not change the order, the serialization format depends on it
00070     enum ColorRole { Foreground, Button, Light, Midlight, Dark, Mid,
00071                      Text, BrightText, ButtonText, Base, Background, Shadow,
00072                      Highlight, HighlightedText, Link, LinkVisited,
00073                      NColorRoles };
00074 
00075     const QColor &color( ColorRole ) const;
00076     const QBrush &brush( ColorRole ) const;
00077     void setColor( ColorRole, const QColor & );
00078     void setBrush( ColorRole, const QBrush & );
00079 
00080     const QColor &foreground()  const   { return br[Foreground].color(); }
00081     const QColor &button()      const   { return br[Button].color(); }
00082     const QColor &light()       const   { return br[Light].color(); }
00083     const QColor &dark()        const   { return br[Dark].color(); }
00084     const QColor &mid()         const   { return br[Mid].color(); }
00085     const QColor &text()        const   { return br[Text].color(); }
00086     const QColor &base()        const   { return br[Base].color(); }
00087     const QColor &background()  const   { return br[Background].color(); }
00088 
00089     const QColor &midlight()    const   { return br[Midlight].color(); }
00090     const QColor &brightText()  const   { return br[BrightText].color(); }
00091     const QColor &buttonText()  const   { return br[ButtonText].color(); }
00092     const QColor &shadow()      const   { return br[Shadow].color(); }
00093     const QColor &highlight()   const   { return br[Highlight].color(); }
00094     const QColor &highlightedText() const{return br[HighlightedText].color(); }
00095     const QColor &link()        const   { return br[Link].color(); }
00096     const QColor &linkVisited() const   { return br[LinkVisited].color(); }
00097 
00098     bool        operator==( const QColorGroup &g ) const;
00099     bool        operator!=( const QColorGroup &g ) const
00100         { return !(operator==(g)); }
00101 
00102 private:
00103     QBrush *br;
00104     QColorGroupPrivate * d;
00105 
00106     friend class QPalette;
00107 };
00108 
00109 
00110 class Q_EXPORT QPalette
00111 {
00112 public:
00113     QPalette();
00114     QPalette( const QColor &button );
00115     QPalette( const QColor &button, const QColor &background );
00116     QPalette( const QColorGroup &active, const QColorGroup &disabled,
00117               const QColorGroup &inactive );
00118     QPalette( const QPalette & );
00119     ~QPalette();
00120     QPalette &operator=( const QPalette & );
00121 
00122     enum ColorGroup { Disabled, Active, Inactive, NColorGroups, Normal=Active };
00123 
00124     const QColor &color( ColorGroup, QColorGroup::ColorRole ) const;
00125     const QBrush &brush( ColorGroup, QColorGroup::ColorRole ) const;
00126     void setColor( ColorGroup, QColorGroup::ColorRole, const QColor & );
00127     void setBrush( ColorGroup, QColorGroup::ColorRole, const QBrush & );
00128 
00129     void setColor( QColorGroup::ColorRole, const QColor & );
00130     void setBrush( QColorGroup::ColorRole, const QBrush & );
00131 
00132     QPalette    copy() const;
00133 
00134     const QColorGroup &active() const { return data->active; }
00135     const QColorGroup &disabled() const { return data->disabled; }
00136     const QColorGroup &inactive() const { return data->inactive; }
00137 #ifndef QT_NO_COMPAT
00138     const QColorGroup &normal() const { return active(); }
00139 #endif
00140 
00141     void        setActive( const QColorGroup & );
00142     void        setDisabled( const QColorGroup & );
00143     void        setInactive( const QColorGroup & );
00144 #ifndef QT_NO_COMPAT
00145     void        setNormal( const QColorGroup & cg ) { setActive(cg); }
00146 #endif
00147 
00148     bool        operator==( const QPalette &p ) const;
00149     bool        operator!=( const QPalette &p ) const
00150               { return !(operator==(p)); }
00151     bool        isCopyOf( const QPalette & );
00152 
00153     int         serialNumber() const    { return data->ser_no; }
00154     
00155     
00156     static QColorGroup::ColorRole foregroundRoleFromMode( Qt::BackgroundMode mode );
00157     static QColorGroup::ColorRole backgroundRoleFromMode( Qt::BackgroundMode mode);
00158 
00159 private:
00160     void        detach();
00161     const QBrush &directBrush( ColorGroup, QColorGroup::ColorRole ) const;
00162     void directSetBrush( ColorGroup, QColorGroup::ColorRole, const QBrush& );
00163 
00164     struct QPalData : public QShared {
00165         QColorGroup disabled;
00166         QColorGroup active;
00167         int         ser_no;
00168         QColorGroup inactive;
00169     } *data;
00170 };
00171 
00172 
00173 /*****************************************************************************
00174   QColorGroup/QPalette stream functions
00175  *****************************************************************************/
00176 
00177 #ifndef QT_NO_DATASTREAM
00178 Q_EXPORT QDataStream &operator<<( QDataStream &, const QColorGroup & );
00179 Q_EXPORT QDataStream &operator>>( QDataStream &, QColorGroup & );
00180 
00181 Q_EXPORT QDataStream &operator<<( QDataStream &, const QPalette & );
00182 Q_EXPORT QDataStream &operator>>( QDataStream &, QPalette & );
00183 #endif // QT_NO_DATASTREAM
00184 
00185 #endif // QT_NO_PALETTE
00186 #endif // QPALETTE_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'