| 1 | /**************************************************************************** | 
|---|
| 2 | ** $Id: qbrush.h 2 2005-11-16 15:49:26Z dmik $ | 
|---|
| 3 | ** | 
|---|
| 4 | ** Definition of QBrush class | 
|---|
| 5 | ** | 
|---|
| 6 | ** Created : 940112 | 
|---|
| 7 | ** | 
|---|
| 8 | ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved. | 
|---|
| 9 | ** | 
|---|
| 10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 
|---|
| 11 | ** | 
|---|
| 12 | ** This file may be distributed under the terms of the Q Public License | 
|---|
| 13 | ** as defined by Trolltech AS of Norway and appearing in the file | 
|---|
| 14 | ** LICENSE.QPL included in the packaging of this file. | 
|---|
| 15 | ** | 
|---|
| 16 | ** This file may be distributed and/or modified under the terms of the | 
|---|
| 17 | ** GNU General Public License version 2 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 19 | ** packaging of this file. | 
|---|
| 20 | ** | 
|---|
| 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 
|---|
| 22 | ** licenses may use this file in accordance with the Qt Commercial License | 
|---|
| 23 | ** Agreement provided with the Software. | 
|---|
| 24 | ** | 
|---|
| 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 
|---|
| 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 
|---|
| 27 | ** | 
|---|
| 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 
|---|
| 29 | **   information about Qt Commercial License Agreements. | 
|---|
| 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 
|---|
| 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 
|---|
| 32 | ** | 
|---|
| 33 | ** Contact info@trolltech.com if any conditions of this licensing are | 
|---|
| 34 | ** not clear to you. | 
|---|
| 35 | ** | 
|---|
| 36 | **********************************************************************/ | 
|---|
| 37 |  | 
|---|
| 38 | #ifndef QBRUSH_H | 
|---|
| 39 | #define QBRUSH_H | 
|---|
| 40 |  | 
|---|
| 41 | #ifndef QT_H | 
|---|
| 42 | #include "qcolor.h" | 
|---|
| 43 | #include "qshared.h" | 
|---|
| 44 | #endif // QT_H | 
|---|
| 45 |  | 
|---|
| 46 |  | 
|---|
| 47 | class Q_EXPORT QBrush: public Qt | 
|---|
| 48 | { | 
|---|
| 49 | friend class QPainter; | 
|---|
| 50 | public: | 
|---|
| 51 | QBrush(); | 
|---|
| 52 | QBrush( BrushStyle ); | 
|---|
| 53 | QBrush( const QColor &, BrushStyle=SolidPattern ); | 
|---|
| 54 | QBrush( const QColor &, const QPixmap & ); | 
|---|
| 55 | QBrush( const QBrush & ); | 
|---|
| 56 | ~QBrush(); | 
|---|
| 57 | QBrush &operator=( const QBrush & ); | 
|---|
| 58 |  | 
|---|
| 59 | BrushStyle  style()  const          { return data->style; } | 
|---|
| 60 | void        setStyle( BrushStyle ); | 
|---|
| 61 | const QColor &color()const          { return data->color; } | 
|---|
| 62 | void        setColor( const QColor & ); | 
|---|
| 63 | QPixmap    *pixmap() const          { return data->pixmap; } | 
|---|
| 64 | void        setPixmap( const QPixmap & ); | 
|---|
| 65 |  | 
|---|
| 66 | bool        operator==( const QBrush &p ) const; | 
|---|
| 67 | bool        operator!=( const QBrush &b ) const | 
|---|
| 68 | { return !(operator==(b)); } | 
|---|
| 69 |  | 
|---|
| 70 | private: | 
|---|
| 71 | QBrush      copy()  const; | 
|---|
| 72 | void        detach(); | 
|---|
| 73 | void        init( const QColor &, BrushStyle ); | 
|---|
| 74 | struct QBrushData : public QShared {        // brush data | 
|---|
| 75 | BrushStyle style; | 
|---|
| 76 | QColor    color; | 
|---|
| 77 | QPixmap  *pixmap; | 
|---|
| 78 | } *data; | 
|---|
| 79 | }; | 
|---|
| 80 |  | 
|---|
| 81 |  | 
|---|
| 82 | /***************************************************************************** | 
|---|
| 83 | QBrush stream functions | 
|---|
| 84 | *****************************************************************************/ | 
|---|
| 85 |  | 
|---|
| 86 | #ifndef QT_NO_DATASTREAM | 
|---|
| 87 | Q_EXPORT QDataStream &operator<<( QDataStream &, const QBrush & ); | 
|---|
| 88 | Q_EXPORT QDataStream &operator>>( QDataStream &, QBrush & ); | 
|---|
| 89 | #endif | 
|---|
| 90 |  | 
|---|
| 91 | #endif // QBRUSH_H | 
|---|