kformula

kformulawidget.h
1/* This file is part of the KDE project
2 Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
3 Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KFORMULAWIDGET_H
22#define KFORMULAWIDGET_H
23
24#include <tqdom.h>
25#include <tqpixmap.h>
26#include <tqpoint.h>
27#include <tqwidget.h>
28
29#include <kformuladefs.h>
30#include <kformulaview.h>
31
32KFORMULA_NAMESPACE_BEGIN
33
34class FormulaCursor;
35class Container;
36
37KFORMULA_NAMESPACE_END
38
39
44class KFormulaWidget : public TQWidget {
45 TQ_OBJECT
46
47
48public:
49 KFormulaWidget(KFormula::Container*, TQWidget* parent=0, const char* name=0, WFlags f=0);
51
52
56 TQPoint getCursorPoint() const;
57
61 void setReadOnly(bool ro);
62
63 const KFormula::View* view() const { return &formulaView; }
64 KFormula::View* view() { return &formulaView; }
65
66public slots:
67
68 void slotSelectAll();
69
70signals:
71
75 void cursorChanged(bool visible, bool selecting);
76
77protected slots:
78
82 void slotFormulaChanged(int width, int height);
83
84 void slotCursorChanged(bool visible, bool selecting);
85
86protected:
87
88 virtual void mousePressEvent(TQMouseEvent* event);
89 virtual void mouseReleaseEvent(TQMouseEvent* event);
90 virtual void mouseDoubleClickEvent(TQMouseEvent* event);
91 virtual void mouseMoveEvent(TQMouseEvent* event);
92
93 virtual void paintEvent(TQPaintEvent* event);
94 virtual void keyPressEvent(TQKeyEvent* event);
95 virtual void focusInEvent(TQFocusEvent* event);
96 virtual void focusOutEvent(TQFocusEvent* event);
97
101 KFormula::Container* getDocument();
102
106 KFormula::FormulaCursor* getCursor();
107
108private:
109
113 KFormula::View formulaView;
114
115 TQPixmap buffer;
116};
117
118#endif // KFORMULAWIDGET_H
void setReadOnly(bool ro)
Puts the widget in read only mode.
TQPoint getCursorPoint() const
void cursorChanged(bool visible, bool selecting)
Is emitted every time the cursor might have changed.
void slotFormulaChanged(int width, int height)
The formula has changed and needs to be redrawn.
KFormula::FormulaCursor * getCursor()
Our cursor.
KFormula::Container * getDocument()
The document we show.