File indexing completed on 2024-04-21 03:42:04

0001 /*
0002     KmPlot - a math. function plotter for the KDE-Desktop
0003 
0004     SPDX-FileCopyrightText: 2006 David Saxton <david@bluehaze.org>
0005 
0006     This file is part of the KDE Project.
0007     KmPlot is part of the KDE-EDU Project.
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 
0011 */
0012 
0013 #ifndef EQUATIONEDITWIDGET_H
0014 #define EQUATIONEDITWIDGET_H
0015 
0016 #include <KTextEdit>
0017 
0018 class EquationEdit;
0019 
0020 /**
0021  * The actual line edit.
0022  */
0023 class EquationEditWidget : public KTextEdit
0024 {
0025 public:
0026     explicit EquationEditWidget(EquationEdit *parent);
0027 
0028     /**
0029      * Call this after changing font size.
0030      */
0031     void recalculateGeometry();
0032     /**
0033      * Whether to clear the selection when focus is lost.
0034      */
0035     void setClearSelectionOnFocusOut(bool doIt);
0036 
0037 protected:
0038     void clearSelection();
0039 
0040     void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
0041     void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
0042     void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
0043     void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
0044 
0045     EquationEdit *m_parent;
0046     bool m_clearSelectionOnFocusOut;
0047 };
0048 
0049 #endif