25#include <tdeapplication.h>
30#include "basicelement.h"
31#include "formulacursor.h"
32#include "formulaelement.h"
33#include "kformulacontainer.h"
34#include "kformuladocument.h"
35#include "kformulawidget.h"
38KFormulaWidget::KFormulaWidget(
Container* doc, TQWidget* parent,
const char* name, WFlags f)
39 : TQWidget(parent,
name, f | WRepaintNoErase | WResizeNoErase),
42 connect(doc, TQ_SIGNAL(formulaChanged(
int,
int)),
43 this, TQ_SLOT(slotFormulaChanged(
int,
int)));
44 connect(&formulaView, TQ_SIGNAL(cursorChanged(
bool,
bool)),
45 this, TQ_SLOT(slotCursorChanged(
bool,
bool)));
47 setFocusPolicy(TQWidget::StrongFocus);
48 setBackgroundMode(NoBackground);
51 slotFormulaChanged(rect.width(), rect.height());
54KFormulaWidget::~KFormulaWidget()
70void KFormulaWidget::paintEvent(TQPaintEvent* event)
74 TQPainter p( &buffer );
76 formulaView.draw( p, event->rect(), colorGroup() );
80 painter.drawPixmap( event->rect().x(), event->rect().y(),
81 buffer, event->rect().x(), event->rect().y(), event->rect().width(), event->rect().height() );
85void KFormulaWidget::keyPressEvent(TQKeyEvent* event)
87 formulaView.keyPressEvent(event);
91void KFormulaWidget::focusInEvent(TQFocusEvent* event)
93 formulaView.focusInEvent(event);
96void KFormulaWidget::focusOutEvent(TQFocusEvent* event)
98 formulaView.focusOutEvent(event);
101void KFormulaWidget::mousePressEvent(TQMouseEvent* event)
103 formulaView.mousePressEvent(event);
106void KFormulaWidget::mouseReleaseEvent(TQMouseEvent* event)
108 formulaView.mouseReleaseEvent(event);
111void KFormulaWidget::mouseDoubleClickEvent(TQMouseEvent* event)
113 formulaView.mouseDoubleClickEvent(event);
116void KFormulaWidget::mouseMoveEvent(TQMouseEvent* event)
118 formulaView.mouseMoveEvent(event);
121void KFormulaWidget::wheelEvent(TQWheelEvent* event)
123 formulaView.wheelEvent(event);
129 resize(width + 5, height + 5);
130 buffer.resize(width + 5, height + 5);
152void KFormulaWidget::slotSelectAll()
154 formulaView.slotSelectAll();
157void KFormulaWidget::slotCursorChanged(
bool visible,
bool selecting)
171#include "kformulawidget.moc"
TQRect boundingRect() const
TQPoint getCursorPoint() const
FormulaCursor * getCursor() const
Our cursor.
void setReadOnly(bool ro)
Puts the widget in read only mode.
virtual Container * getDocument() const
The document we show.
const char * name(StdAction id)