kaddressbook Library API Documentation

kabentrypainter.h

00001 /* -*- C++ -*-
00002    This file declares printing classes to paint entries on QPainters.
00003 
00004    the KDE addressbook
00005 
00006    $ Author: Mirko Boehm $
00007    $ Copyright: (C) 1996-2002, Mirko Boehm $
00008    $ Contact: mirko@kde.org
00009          http://www.kde.org $
00010    $ License: GPL with the following explicit clarification:
00011          This code may be linked against any version of the Qt toolkit
00012          from Troll Tech, Norway. $
00013 
00014    $Revision: 1.1 $
00015 */
00016 
00017 #ifndef KAB_PRINTMETHODS_H
00018 #define KAB_PRINTMETHODS_H
00019 
00020 #include <qfont.h>
00021 #include <qcolor.h>
00022 #include <qvaluelist.h>
00023 #include <qrect.h>
00024 #include <kabc/addressbook.h>
00025 
00026 typedef QValueList<QRect> QRectList;
00027 
00028 class KABEntryPainter
00029 {
00030 public:
00031   KABEntryPainter(
00032       QColor foreColor_=Qt::black,
00033       QColor headerColor_=Qt::white, bool useHeaderColor=true,
00034       QColor backColor_=Qt::black,
00035       QFont header_=QFont("Helvetica", 12, QFont::Normal, true),
00036       QFont headlines_=QFont("Helvetica", 12, QFont::Normal, true),
00037       QFont body_=QFont("Helvetica", 12, QFont::Normal, true),
00038       QFont fixed_=QFont("Courier", 12, QFont::Normal, true),
00039       QFont comment_=QFont("Helvetica", 10, QFont::Normal, true),
00040       bool showAddresses_=true,
00041       bool showEmails_=true,
00042       bool showTelephones_=true,
00043       bool showURLs_=true);
00044   ~KABEntryPainter();
00059   bool printEntry(const KABC::Addressee&, const QRect& window,
00060                   QPainter *,
00061                   int top=0,
00062                   bool fake=false,
00063                   QRect *rect=0);
00064   void setShowAddresses(bool);
00065   void setShowEmails(bool);
00066   void setShowTelephones(bool);
00067   void setShowURLs(bool);
00072   int hitsEmail(QPoint p);
00075   int hitsTelephones(QPoint p);
00078   int hitsTalkAddresses(QPoint p);
00081   int hitsURLs(QPoint p);
00082 protected:
00083   // helper for the public hitsSomething methods
00084   int hits(const QRectList& rects, QPoint p);
00085   // the text color:
00086   QColor foreColor;
00087   // the text color in the header:
00088   QColor headerColor;
00089     // color headlines background
00090     bool useHeaderColor;
00091   // the background color (only) for filled areas etc:
00092   QColor backColor;
00093   // ----- the fonts:
00094   // the upper header:
00095   QFont header;
00096   // the headlines of the different sections:
00097   QFont headlines;
00098   // the body text:
00099   QFont body;
00100   // a fixed font to use:
00101   QFont fixed;
00102   // the comment font, usually a smaller scale of the body font:
00103   QFont comment;
00104   // ----- general options:
00105   // print the postal addresses?:
00106   bool showAddresses;
00107   // print the email addresses?:
00108   bool showEmails;
00109   // print the telephone numbers?:
00110   bool showTelephones;
00111   // print the URLs?:
00112   bool showURLs;
00113   // bounding rectangles of the email addresses printed on the painter
00114   // in the order they appear in the entry data
00115   QRectList emails;
00116   // bounding rectangles of the telephone numbers printed on the painter
00117   // in the order they appear in the entry data
00118   QRectList telephones;
00119   // bounding rectangles of the URLs printed on the painter
00120   // in the order they appear in the entry data
00121   QRectList URLs;
00122   // bounding rectangles of the talk addresses printed on the painter
00123   // in the order they appear in the entry data
00124   QRectList talk;
00125 };
00126 
00127 #endif // KAB_PRINTMETHODS_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:09 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001