korganizer Library API Documentation

calprinter.h

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 1998 Preston Brown
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., 675 Mass Ave, Cambridge, MA 02139, 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 #ifndef _CALPRINTER_H
00024 #define _CALPRINTER_H
00025 
00026 #include <unistd.h>
00027 
00028 #include <qfile.h>
00029 #include <qdialog.h>
00030 
00031 #include <kprinter.h>
00032 #include <kprocess.h>
00033 
00034 #include <libkcal/calendar.h>
00035 
00036 class KDateEdit;
00037 class QButtonGroup;
00038 class CalPrintDialog;
00039 class KTempFile;
00040 
00041 using namespace KCal;
00042 
00048 class CalPrinter : public QObject
00049 {
00050     Q_OBJECT
00051   public:
00052     enum PrintType { Day, Week, Month, Todolist, TimeTable };
00053     CalPrinter(QWidget *par, Calendar *cal);
00054     virtual ~CalPrinter();
00055 
00056     void setupPrinter();
00057     void preview(PrintType pt, const QDate &fd, const QDate &td);
00058     void print(PrintType pt, const QDate &fd, const QDate &td);
00059 
00060   public slots:
00061     void updateConfig();
00062     void printDay(const QDate &fd, const QDate &td);
00063     void printWeek(const QDate &fd, const QDate &td);
00064     void printMonth(const QDate &fd, const QDate &td);
00065     void printTodo(const QDate &fd, const QDate &td);
00066     void printTimeTable(const QDate &fd, const QDate &td);
00067 
00068   private slots:
00069     void doPreview(int, QDate, QDate);
00070     void doPrint(int, QDate, QDate);
00071 
00072   private:
00073     void drawHeader(QPainter &p, const QDate &fd, const QDate &td,
00074                     const QDate &cd,
00075                     int width, int height, PrintType pt = Month);
00076     void drawDayBox(QPainter &p, const QDate &qd,
00077                     int x, int y, int width, int height,
00078                     bool fullDate = FALSE);
00079     void drawTTDayBox(QPainter &p, const QDate &qd,
00080                     int x, int y, int width, int height,
00081                     bool fullDate = FALSE);
00082     void drawDay(QPainter &p, const QDate &qd, int width, int height);
00083     void drawWeek(QPainter &p, const QDate &qd, int width, int height);
00084     void drawTimeTable(QPainter &p, const QDate &qd, int width, int height);
00085     void drawMonth(QPainter &p, const QDate &qd, int width, int height);
00086     void drawSmallMonth(QPainter &p, const QDate &qd,
00087                         int x, int y, int width, int height);
00088     void drawDaysOfWeekBox(QPainter &p, const QDate &qd,
00089                            int x, int y, int width, int height);
00090     void drawDaysOfWeek(QPainter &p, const QDate &qd, int width, int height);
00091     void drawTodo(int count, Todo *item,QPainter &p,int level=0, QRect *r=0);
00092 
00093     KPrinter *mPrinter;
00094     Calendar *mCalendar;
00095     QWidget *mParent;
00096     int mHeaderHeight;
00097     int mSubHeaderHeight;
00098     int mStartHour;
00099     int mCurrentLinePos;
00100     CalPrintDialog *mPrintDialog;
00101 };
00102 
00103 class CalPrintDialog : public QDialog
00104 {
00105     Q_OBJECT
00106   public:
00107     CalPrintDialog(KPrinter *p, QWidget *parent=0, const char *name=0);
00108     virtual ~CalPrintDialog();
00109 
00110     QDate fromDate() const;
00111     QDate toDate() const;
00112     CalPrinter::PrintType printType() const;
00113 
00114     void setRange(const QDate &from, const QDate &to);
00115     void setPreview(bool);
00116 
00117   public slots:
00118     void setPrintDay();
00119     void setPrintWeek();
00120     void setPrintMonth();
00121     void setPrintTodo();
00122     void setPrintTimeTable();
00123 
00124   private:
00125     KPrinter *mPrinter;
00126 
00127     QPushButton *mOkButton;
00128     QButtonGroup *mTypeGroup;
00129     KDateEdit *mFromDateEdit;
00130     KDateEdit *mToDateEdit;
00131     CalPrinter::PrintType mPrintType;
00132 };
00133 
00134 #endif // _CALPRINTER_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:41:08 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001