summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/calendar/calpainter.h
blob: 3d0a89ae0010d156545d8455a825b9166b96bfe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* ============================================================
 * File  : calpainter.h
 * Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
 * Date  : 2003-11-02
 * Description :
 *
 * Copyright 2003 by Renchi Raju <renchi@pooh.tam.uiuc.edu>

 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * ============================================================ */

#ifndef CALPAINTER_H
#define CALPAINTER_H

// Qt includes.

#include <qobject.h>
#include <qvaluelist.h>

// KDE includes.

#include <kurl.h>

// Local includes

#include "calformatter.h"


class QPaintDevice;
class QPainter;
class QString;
class QTimer;
class QImage;

namespace KIPICalendarPlugin
{

class CalPainter
{
public:

    CalPainter(QPaintDevice *pd);
    ~CalPainter();

    void setYearMonth(int year, int month);
    void paint(bool useDeviceMetrics=false);

private:

    QPaintDevice *pd_;
    int           year_;
    int           month_;
};

class CalBlockPainter : public QObject
{
    Q_OBJECT

public:

    CalBlockPainter(QObject *parent, int year, int month,
                    const KURL& imagePath, int angle, CalFormatter* formatter, QPainter *painter);
    ~CalBlockPainter();

signals:

    void signalCompleted();
    void signalProgress(int progress, int total);

private:

    struct Block {
        int x, y;
        int sx, sy;
        int w, h;
    };

    struct Block      *blocks_;
    int                numBlocks_;
    int                currBlock_;
    QTimer            *timer_;
    QPainter          *painter_;
    QImage            *image_;

private slots:

    void slotPaintNextBlock();

};

}  // NameSpace KIPICalendarPlugin

#endif /* CALPAINTER_H */