kaddressbook Library API Documentation

kabentrypainter.h

00001 /*                                                                      
00002     This file is part of KAddressBook.
00003     Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
00004                                                                         
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or   
00008     (at your option) any later version.                                 
00009                                                                         
00010     This program is distributed in the hope that it will be useful,     
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of      
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the        
00013     GNU General Public License for more details.                        
00014                                                                         
00015     You should have received a copy of the GNU General Public License   
00016     along with this program; if not, write to the Free Software         
00017     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           
00018                                                                         
00019     As a special exception, permission is given to link this program    
00020     with any edition of Qt, and distribute the resulting executable,    
00021     without including the source code for Qt in the source distribution.
00022 */                                                                      
00023 
00024 #ifndef KABENTRYPAINTER_H
00025 #define KABENTRYPAINTER_H
00026 
00027 #include <kabc/addressbook.h>
00028 
00029 #include <qcolor.h>
00030 #include <qfont.h>
00031 #include <qrect.h>
00032 #include <qvaluelist.h>
00033 
00034 typedef QValueList<QRect> QRectList;
00035 
00036 class KABEntryPainter
00037 {
00038   public:
00039     KABEntryPainter();
00040     ~KABEntryPainter();
00041 
00061     bool printAddressee( const KABC::Addressee &addr, const QRect &window,
00062                          QPainter *p, int top = 0, bool fake = false,
00063                          QRect *rect = 0 );
00064 
00065     void setForegroundColor( const QColor &color = Qt::black );
00066     void setBackgroundColor( const QColor &color = Qt::black );
00067     void setHeaderColor( const QColor &color = Qt::white );
00068                      
00069     void setHeaderFont( const QFont &font = QFont( "Helvetica", 12, QFont::Normal, true ) );
00070     void setHeadLineFont( const QFont &font = QFont( "Helvetica", 12, QFont::Normal, true ) );
00071     void setBodyFont( const QFont &font = QFont( "Helvetica", 12, QFont::Normal, true ) );
00072     void setFixedFont( const QFont &font = QFont( "Courier", 12, QFont::Normal, true ) );
00073     void setCommentFont( const QFont &font = QFont( "Helvetica", 10, QFont::Normal, true ) );
00074 
00075     void setUseHeaderColor( bool value = true );
00076 
00077     void setShowAddresses( bool value = true );
00078     void setShowEmails( bool value = true );
00079     void setShowPhones( bool value = true );
00080     void setShowURLs( bool value = true );
00081 
00088     int hitsEmail( QPoint p );
00089 
00094     int hitsPhone( QPoint p );
00095 
00100     int hitsTalk( QPoint p );
00101 
00106     int hitsURL( QPoint p );
00107 
00108   private:
00109     int hits( const QRectList& rects, QPoint p );
00110 
00111     QColor mForegroundColor;
00112     QColor mBackgroundColor;
00113     QColor mHeaderColor;
00114 
00115     QFont mHeaderFont;
00116     QFont mHeadLineFont;
00117     QFont mBodyFont;
00118     QFont mFixedFont;
00119     QFont mCommentFont;
00120 
00121     bool mUseHeaderColor;
00122     bool mShowAddresses;
00123     bool mShowEmails;
00124     bool mShowPhones;
00125     bool mShowURLs;
00126 
00127     QRectList mEmailRects;
00128     QRectList mPhoneRects;
00129     QRectList mURLRects;
00130     QRectList mTalkRects;
00131 };
00132 
00133 #endif
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:52 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003