kpresenter

KPrPBPreview.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Thorsten Zachmann <zachmann@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef PBPREVIEW_H
21#define PBPREVIEW_H
22
23#include "global.h"
24
25#include <tqframe.h>
26
27#include "KPrGradient.h"
28#include <KoBrush.h>
29#include <KoPen.h>
30
31class KoTextZoomHandler;
32
33/******************************************************************/
34/* class Pen and Brush preview */
35/******************************************************************/
36
37class KPrPBPreview : public TQFrame
38{
39 TQ_OBJECT
40
41
42public:
43 enum PaintType {
44 Pen,
45 Brush,
46 Gradient
47 };
48
49 KPrPBPreview( TQWidget* parent, const char* name, PaintType _paintType = Pen );
50 ~KPrPBPreview();
51 void setPen( const KoPen &_pen ) { pen = _pen; repaint( true ); }
52 void setBrush( const TQBrush &_brush ) { brush = _brush; repaint( true ); }
53 void setLineBegin( LineEnd lb ) { lineBegin = lb; repaint( true ); }
54 void setLineEnd( LineEnd le ) { lineEnd = le; repaint( true ); }
55 void setGradient( KPrGradient *g ) { if ( g ) { gradient = g; } repaint( true ); }
56 void setPaintType( PaintType pt ) { paintType = pt; repaint(true); }
57
58 void setGradient( const TQColor &_c1, const TQColor &_c2, BCType _t,
59 bool _unbalanced, int _xfactor, int _yfactor );
60 void setColor1( const TQColor &_color ) { gradient->setColor1( _color ); repaint( false ); }
61 void setColor2( const TQColor &_color ) { gradient->setColor2( _color ); repaint( false ); }
62 void setBackColorType( BCType _type ) { gradient->setBackColorType( _type ); repaint( false ); }
63 void setUnbalanced( bool b ) { gradient->setUnbalanced( b ); repaint( false ); }
64 void setXFactor( int i ) { gradient->setXFactor( i ); repaint( false ); }
65 void setYFactor( int i ) { gradient->setYFactor( i ); repaint( false ); }
66
67protected:
68 void drawContents( TQPainter *p );
69 void resizeEvent( TQResizeEvent *e );
70
71private:
72 PaintType paintType;
73 KoPen pen;
74 TQBrush brush;
75 LineEnd lineBegin, lineEnd;
76 KPrGradient *gradient;
77 KPrGradient *savedGradient;
78 KoTextZoomHandler *_zoomHandler;
79};
80
81
82#endif /* PBPREVIEW_H */
Class: KPrGradient.
Definition KPrGradient.h:40