kformula

kformulawidget.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., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KFORMULAWIDGET_H
00022 #define KFORMULAWIDGET_H
00023 
00024 #include <qdom.h>
00025 #include <qpixmap.h>
00026 #include <qpoint.h>
00027 #include <qwidget.h>
00028 
00029 #include <kformuladefs.h>
00030 #include <kformulaview.h>
00031 
00032 KFORMULA_NAMESPACE_BEGIN
00033 
00034 class FormulaCursor;
00035 class Container;
00036 
00037 KFORMULA_NAMESPACE_END
00038 
00039 
00044 class KFormulaWidget : public QWidget {
00045     Q_OBJECT
00046 
00047 public:
00048     KFormulaWidget(KFormula::Container*, QWidget* parent=0, const char* name=0, WFlags f=0);
00049     ~KFormulaWidget();
00050 
00051 
00055     QPoint getCursorPoint() const;
00056 
00060     void setReadOnly(bool ro);
00061 
00062     const KFormula::View* view() const { return &formulaView; }
00063     KFormula::View* view() { return &formulaView; }
00064 
00065 public slots:
00066 
00067     void slotSelectAll();
00068 
00069 signals:
00070 
00074     void cursorChanged(bool visible, bool selecting);
00075 
00076 protected slots:
00077 
00081     void slotFormulaChanged(int width, int height);
00082 
00083     void slotCursorChanged(bool visible, bool selecting);
00084 
00085 protected:
00086 
00087     virtual void mousePressEvent(QMouseEvent* event);
00088     virtual void mouseReleaseEvent(QMouseEvent* event);
00089     virtual void mouseDoubleClickEvent(QMouseEvent* event);
00090     virtual void mouseMoveEvent(QMouseEvent* event);
00091 
00092     virtual void paintEvent(QPaintEvent* event);
00093     virtual void keyPressEvent(QKeyEvent* event);
00094     virtual void focusInEvent(QFocusEvent* event);
00095     virtual void focusOutEvent(QFocusEvent* event);
00096 
00100     KFormula::Container* getDocument();
00101 
00105     KFormula::FormulaCursor* getCursor();
00106 
00107 private:
00108 
00112     KFormula::View formulaView;
00113 
00114     QPixmap buffer;
00115 };
00116 
00117 #endif // KFORMULAWIDGET_H
KDE Home | KDE Accessibility Home | Description of Access Keys