F:/KPlato/koffice/libs/flake/KoTool.cpp

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 #include <QWidget>
00021 #include <QLabel>
00022 
00023 #include <klocale.h>
00024 #include <kdebug.h>
00025 
00026 #include "KoTool.h"
00027 #include "KoCanvasBase.h"
00028 #include "KoViewConverter.h"
00029 #include "KoPointerEvent.h"
00030 #include "KoCanvasResourceProvider.h"
00031 
00032 KoTool::KoTool(KoCanvasBase *canvas )
00033     : m_canvas(canvas)
00034     , m_optionWidget( 0 )
00035     , m_previousCursor(Qt::ArrowCursor)
00036 {
00037     if(m_canvas) {
00038         KoCanvasResourceProvider * crp = m_canvas->resourceProvider();
00039         Q_ASSERT_X(crp, "KoTool::KoTool", "No KoCanvasResourceProvider");
00040         if (crp)
00041             connect( m_canvas->resourceProvider(),
00042                  SIGNAL( sigResourceChanged(KoCanvasResource::EnumCanvasResource, const QVariant & ) ),
00043                  this,
00044                  SLOT( resourceChanged( KoCanvasResource::EnumCanvasResource, const QVariant &  ) ) );
00045     }
00046 }
00047 
00048 void KoTool::activate(bool temporary) {
00049     Q_UNUSED(temporary);
00050 }
00051 
00052 void KoTool::deactivate() {
00053 }
00054 
00055 void KoTool::resourceChanged( KoCanvasResource::EnumCanvasResource key, const QVariant & res )
00056 {
00057     Q_UNUSED( key );
00058     Q_UNUSED( res );
00059 }
00060 
00061 bool KoTool::wantsAutoScroll() {
00062     return true;
00063 }
00064 
00065 void KoTool::mouseDoubleClickEvent( KoPointerEvent *event ) {
00066     event->ignore();
00067 }
00068 
00069 void KoTool::keyPressEvent(QKeyEvent *e) {
00070     e->ignore();
00071 }
00072 
00073 void KoTool::keyReleaseEvent(QKeyEvent *e) {
00074     e->ignore();
00075 }
00076 
00077 void KoTool::wheelEvent( KoPointerEvent * e ) {
00078     e->ignore();
00079 }
00080 
00081 
00082 void KoTool::useCursor(QCursor cursor, bool force) {
00083     if(!force && cursor.shape() == m_previousCursor.shape())
00084         return;
00085     m_previousCursor = cursor;
00086     emit sigCursorChanged(m_previousCursor);
00087 }
00088 
00089 QWidget * KoTool::optionWidget() {
00090     // Create the optionwidget if it doesn't exist yet
00091     if (m_optionWidget == 0) {
00092         createOptionWidget();
00093     }
00094     return m_optionWidget;
00095 }
00096 
00097 #include "KoTool.moc"

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