kaddressbook

kabentrypainter.h
1/*
2 This file is part of KAddressBook.
3 Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of TQt, and distribute the resulting executable,
21 without including the source code for TQt in the source distribution.
22*/
23
24#ifndef KABENTRYPAINTER_H
25#define KABENTRYPAINTER_H
26
27#include <tdeabc/addressbook.h>
28
29#include <tqcolor.h>
30#include <tqfont.h>
31#include <tqrect.h>
32#include <tqvaluelist.h>
33
34typedef TQValueList<TQRect> TQRectList;
35
36class KABEntryPainter
37{
38 public:
39 KABEntryPainter();
40 ~KABEntryPainter();
41
61 bool printAddressee( const TDEABC::Addressee &addr, const TQRect &window,
62 TQPainter *p, int top = 0, bool fake = false,
63 TQRect *rect = 0 );
64
65 void setForegroundColor( const TQColor &color = TQt::black );
66 void setBackgroundColor( const TQColor &color = TQt::black );
67 void setHeaderColor( const TQColor &color = TQt::white );
68
69 void setHeaderFont( const TQFont &font = TQFont( "Helvetica", 12, TQFont::Normal, true ) );
70 void setHeadLineFont( const TQFont &font = TQFont( "Helvetica", 12, TQFont::Normal, true ) );
71 void setBodyFont( const TQFont &font = TQFont( "Helvetica", 12, TQFont::Normal, true ) );
72 void setFixedFont( const TQFont &font = TQFont( "Courier", 12, TQFont::Normal, true ) );
73 void setCommentFont( const TQFont &font = TQFont( "Helvetica", 10, TQFont::Normal, true ) );
74
75 void setUseHeaderColor( bool value = true );
76
77 void setShowAddresses( bool value = true );
78 void setShowEmails( bool value = true );
79 void setShowPhones( bool value = true );
80 void setShowURLs( bool value = true );
81
88 int hitsEmail( const TQPoint &p );
89
94 int hitsPhone( const TQPoint &p );
95
100 int hitsTalk( const TQPoint &p );
101
106 int hitsURL( const TQPoint &p );
107
108 private:
109 int hits( const TQRectList& rects, const TQPoint &p );
110
111 TQColor mForegroundColor;
112 TQColor mBackgroundColor;
113 TQColor mHeaderColor;
114
115 TQFont mHeaderFont;
116 TQFont mHeadLineFont;
117 TQFont mBodyFont;
118 TQFont mFixedFont;
119 TQFont mCommentFont;
120
121 bool mUseHeaderColor;
122 bool mShowAddresses;
123 bool mShowEmails;
124 bool mShowPhones;
125 bool mShowURLs;
126
127 TQRectList mEmailRects;
128 TQRectList mPhoneRects;
129 TQRectList mURLRects;
130 TQRectList mTalkRects;
131};
132
133#endif