kis_qpainter_canvas.h 2.73 KB
Newer Older
1 2
/* This file is part of the KDE project
 * Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2006
Lukáš Tvrdý's avatar
Lukáš Tvrdý committed
3
 * Copyright (C) Lukáš Tvrdý <lukast.dev@gmail.com>, (C) 2009
4
 *
5 6 7 8
 *  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 of the License, or
 *  (at your option) any later version.
9
 *
10 11 12 13
 *  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.
14
 *
15 16 17
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 19 20 21 22
 */
#ifndef KIS_QPAINTER_CANVAS_H
#define KIS_QPAINTER_CANVAS_H

#include <QWidget>
23

24
#include "kis_canvas_widget_base.h"
25
#include "kis_ui_types.h"
26 27 28 29

class QImage;
class QPaintEvent;
class KisCanvas2;
30
class KisDisplayColorConverter;
31

32 33 34 35
/**
 *
 * KisQPainterCanvas is the widget that shows the actual image using arthur.
 *
36 37 38
 * NOTE: if you change something in the event handling here, also change it
 * in the opengl canvas.
 *
39 40
 * @author Boudewijn Rempt <boud@valdyas.org>
*/
41
class KisQPainterCanvas : public QWidget, public KisCanvasWidgetBase
42
{
43 44 45

    Q_OBJECT

46
public:
47

48
    KisQPainterCanvas(KisCanvas2 * canvas, KisCoordinatesConverter *coordinatesConverter, QWidget * parent);
49 50 51

    virtual ~KisQPainterCanvas();

Boudewijn Rempt's avatar
Boudewijn Rempt committed
52 53
    void setPrescaledProjection(KisPrescaledProjectionSP prescaledProjection);

54
public: // QWidget overrides
Boudewijn Rempt's avatar
Boudewijn Rempt committed
55

56 57
    void paintEvent(QPaintEvent * ev);

Boudewijn Rempt's avatar
Boudewijn Rempt committed
58
    void resizeEvent(QResizeEvent *e);
59

60 61 62 63
    virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;

    virtual void inputMethodEvent(QInputMethodEvent *event);

64 65 66 67 68 69 70 71 72
public: // Implement kis_abstract_canvas_widget interface
    void setDisplayFilter(KisDisplayFilter* displayFilter);
    void setWrapAroundViewingMode(bool value);
    void channelSelectionChanged(QBitArray channelFlags);
    void setDisplayProfile(KisDisplayColorConverter *colorConverter);
    void disconnectCurrentCanvas();
    void finishResizingImage(qint32 w, qint32 h);
    KisUpdateInfoSP startUpdateCanvasProjection(const QRect & rc, QBitArray channelFlags);
    QRect updateCanvasProjection(KisUpdateInfoSP info);
73

Boudewijn Rempt's avatar
Boudewijn Rempt committed
74 75 76
    QWidget * widget() {
        return this;
    }
77

78 79 80 81
    bool isBusy() const {
        return false;
    }

82 83 84
protected: // KisCanvasWidgetBase

    virtual bool callFocusNextPrevChild(bool next);
Lukáš Tvrdý's avatar
Lukáš Tvrdý committed
85

86
private Q_SLOTS:
87
    void slotConfigChanged();
88

89
private:
90
    QImage m_buffer;
91

92
    class Private;
Boudewijn Rempt's avatar
Boudewijn Rempt committed
93
    Private * const m_d;
94 95 96
};

#endif