lib

KoFontDiaPreview.h
1/* This file is part of the KDE project
2 Copyright (C) 2001,2002,2003 Montel Laurent <lmontel@mandrakesoft.com>
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 __kofontdiapreview_h__
21#define __kofontdiapreview_h__
22
23#include <tqframe.h>
24#include <tqstring.h>
25#include <tqcolor.h>
26#include <tqfont.h>
27#include <tqpainter.h>
28
32class KoFontDiaPreview : public TQFrame
33{
34 TQ_OBJECT
35
36public:
40 KoFontDiaPreview( TQWidget* parent =0, const char* name = 0, WFlags fl = 0 );
42
43 void setText( const TQString &text );
44 void setFont( const TQFont &font );
45 void setFontColor( const TQColor &textColor );
46 void setBackgroundColor( const TQColor &backgroundColor );
47 void setShadow( double sdx, double sdy, TQColor shadowColor );
48 void setUnderlining( int underlining, int underliningStyle, const TQColor underliningColor, bool wordByWord );
49 void setWordByWord( bool wordByWord );
50 void setStrikethrough( int strikethrough, int strikethroughStylestrikethrough, bool wordByWord );
51 void setCapitalisation( int capitalisation );
52 void setSubSuperscript( int subSuper, int offset, double relativeSize );
53
54
55private:
56 void drawContents( TQPainter* );
57
58 TQString m_text;
59 TQString displayText;
60 TQFont m_font;
61 TQFont displayFont;
62 int m_fontSize;
63 TQColor m_textColor;
64 TQColor m_backgroundColor;
65 double m_shadowDistanceX;
66 double m_shadowDistanceY;
67 TQColor m_shadowColor;
68 int m_underlining;
69 int m_underliningStyle;
70 TQColor m_underliningColor;
71 bool m_wordByWord;
72 int m_strikethrough;
73 int m_strikethroughStyle;
74 int m_capitalisation;
75 int m_subSuper;
76 int m_offset;
77 double m_relativeSize;
78
79 TQString formatCapitalisation( const TQString &string );
80 void drawUnderline( int x, int y, int width, int thickness, TQColor & color, TQPainter *p );
81 void drawUnderlineWave( int x, int y, int width, int thickness, TQColor & color, TQPainter *p );
82 void drawStrikethrough( int x, int y, int width, int thickness, TQPainter *p );
83};
84
85#endif
The font dialog Preview.