lib Library API Documentation

kformulaview.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
00003                   Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library 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 GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef KFORMULAVIEW_H
00022 #define KFORMULAVIEW_H
00023 
00024 #include <qevent.h>
00025 #include <qobject.h>
00026 #include <qrect.h>
00027 
00028 #include "kformuladefs.h"
00029 #include "contextstyle.h"
00030 
00031 class QColorGroup;
00032 
00033 KFORMULA_NAMESPACE_BEGIN
00034 
00035 class BasicElement;
00036 class FormulaCursor;
00037 class FormulaElement;
00038 class Container;
00039 
00040 
00050 class View : public QObject {
00051     Q_OBJECT
00052 
00053 public:
00054 
00055     View(Container*);
00056     virtual ~View();
00057 
00061     QPoint getCursorPoint() const;
00062 
00066     void setReadOnly(bool ro);
00067 
00068     void mousePressEvent(QMouseEvent* event);
00069     void mouseReleaseEvent(QMouseEvent* event);
00070     void mouseDoubleClickEvent(QMouseEvent* event);
00071     void mouseMoveEvent(QMouseEvent* event);
00072     void wheelEvent(QWheelEvent* event);
00073 
00074     // the mouse event happened at a certain point
00075     void mousePressEvent( QMouseEvent* event, const PtPoint& pos );
00076     void mouseReleaseEvent( QMouseEvent* event, const PtPoint& pos );
00077     void mouseDoubleClickEvent( QMouseEvent* event, const PtPoint& pos );
00078     void mouseMoveEvent( QMouseEvent* event, const PtPoint& pos );
00079     void wheelEvent( QWheelEvent* event, const PtPoint& pos );
00080 
00081     // the mouse event happened at a certain point
00082     void mousePressEvent( QMouseEvent* event, const LuPixelPoint& pos );
00083     void mouseReleaseEvent( QMouseEvent* event, const LuPixelPoint& pos );
00084     void mouseDoubleClickEvent( QMouseEvent* event, const LuPixelPoint& pos );
00085     void mouseMoveEvent( QMouseEvent* event, const LuPixelPoint& pos );
00086     void wheelEvent( QWheelEvent* event, const LuPixelPoint& pos );
00087 
00088     void keyPressEvent(QKeyEvent* event);
00089     virtual void focusInEvent(QFocusEvent* event);
00090     virtual void focusOutEvent(QFocusEvent* event);
00091 
00092     void calcCursor();
00093 
00094     void draw(QPainter& painter, const QRect& rect, const QColorGroup& cg);
00095     void draw(QPainter& painter, const QRect& rect);
00096 
00100     virtual Container* getDocument() const { return container(); }
00101 
00105     FormulaCursor* getCursor() const { return cursor(); }
00106 
00107     void setSmallCursor(bool small);
00108 
00109     // simple cursor movement.
00110 
00111     void moveLeft( int flag = NormalMovement );
00112     void moveRight( int flag = NormalMovement );
00113     void moveUp( int flag = NormalMovement );
00114     void moveDown( int flag = NormalMovement );
00115 
00116     void moveHome( int flag = NormalMovement );
00117     void moveEnd( int flag = NormalMovement );
00118 
00120     bool isHome() const;
00121 
00123     bool isEnd() const;
00124 
00125     void eraseSelection( Direction direction = beforeCursor );
00126     void addText( QString str );
00127 
00128 signals:
00129 
00133     void cursorChanged(bool visible, bool selecting);
00134 
00135 public slots:
00136 
00137     void slotSelectAll();
00138 
00139 protected slots:
00140 
00145     void slotCursorMoved(FormulaCursor* cursor);
00146 
00150     void slotFormulaLoaded(FormulaElement*);
00151 
00156     void slotElementWillVanish(BasicElement*);
00157 
00158 protected:
00159 
00160     virtual bool cursorVisible();
00161 
00162 private:
00163 
00167     void emitCursorChanged();
00168 
00169     bool& cursorHasChanged();
00170     bool& smallCursor();
00171     Container* container() const;
00172     const ContextStyle& contextStyle() const;
00173     FormulaCursor* cursor() const;
00174 
00175     struct View_Impl;
00176     View_Impl* impl;
00177 };
00178 
00179 KFORMULA_NAMESPACE_END
00180 
00181 #endif // KFORMULAVIEW_H
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:22 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003