F:/KPlato/koffice/libs/flake/KoCanvasController.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 2006 Thomas Zander <zander@kde.org>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KOCANVASVIEW_H
00021 #define KOCANVASVIEW_H
00022 
00023 #include <koffice_export.h>
00024 
00025 #include "KoCanvasBase.h"
00026 
00027 #include <QWidget>
00028 #include <QScrollArea>
00029 
00030 class QGridLayout;
00031 class QPaintEvent;
00032 class QEvent;
00033 class KoShape;
00034 
00048 class FLAKE_EXPORT KoCanvasController : public QScrollArea {
00049     Q_OBJECT
00050 public:
00055     KoCanvasController(QWidget *parent);
00056     virtual ~KoCanvasController() {}
00057 
00065     void setCanvas(KoCanvasBase *canvas);
00070     KoCanvasBase* canvas() const;
00071 
00076     int visibleHeight() const;
00081     int visibleWidth() const;
00086     int canvasOffsetX() const;
00091     int canvasOffsetY() const;
00092 
00100     void centerCanvas(bool centered);
00105     bool isCanvasCentered() const;
00106 
00107     virtual bool eventFilter(QObject* watched, QEvent* event);
00108 
00117     void ensureVisible( const QRectF &rect );
00118 
00126     void ensureVisible( KoShape *shape );
00127 
00128 signals:
00133     void canvasRemoved(KoCanvasController* cv);
00138     void canvasSet(KoCanvasController* cv);
00139 
00144     void canvasOffsetXChanged(int offset);
00145 
00150     void canvasOffsetYChanged(int offset);
00151 
00152 protected slots:
00154     void updateCanvasOffsetX();
00156     void updateCanvasOffsetY();
00157 
00158 private:
00159     class Viewport : public QWidget {
00160       public:
00161         Viewport();
00162         ~Viewport() {};
00163         void setCanvas(QWidget *canvas);
00164         void removeCanvas(QWidget *canvas);
00165         void centerCanvas(bool centered);
00166       private:
00167         QGridLayout *m_layout;
00168     };
00169 
00170 private:
00171     KoCanvasBase *m_canvas;
00172     QWidget *m_canvasWidget;
00173     Viewport *m_viewport;
00174     bool m_centerCanvas;
00175 
00176 };
00177 
00178 #endif

Généré le Wed Nov 22 23:40:59 2006 pour KPlato par  doxygen 1.5.1-p1