diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-09 06:41:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-09 06:41:55 +0000 |
commit | 8bec1dda934fa75cbb1402c58cb879b23305dc40 (patch) | |
tree | b4294963397117f1cf022e7a62452697df996de3 /src/mainwindow.h | |
download | abakus-8bec1dda934fa75cbb1402c58cb879b23305dc40.tar.gz abakus-8bec1dda934fa75cbb1402c58cb879b23305dc40.zip |
Add abakus
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/abakus@1071969 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/mainwindow.h')
-rw-r--r-- | src/mainwindow.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/src/mainwindow.h b/src/mainwindow.h new file mode 100644 index 0000000..ee24cdd --- /dev/null +++ b/src/mainwindow.h @@ -0,0 +1,135 @@ +#ifndef ABAKUS_MAINWINDOW_H +#define ABAKUS_MAINWINDOW_H +/* + * mainwindow.h - part of abakus + * Copyright (C) 2004, 2005 Michael Pyne <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA + */ + +#include <kmainwindow.h> + +#include "numerictypes.h" + +class QPoint; +class QVBox; +class QCheckBox; +class QRadioButton; +class QBoxLayout; +class QListViewItem; +class QSplitter; +class QTimer; + +//class KComboBox; +class Editor; +class KPopupMenu; +class KAction; +class KListView; +class ResultListView; +class ResultListViewText; + +class AbakusIface; + +// Main window class, handles events and layout and stuff +class MainWindow : public KMainWindow +{ + Q_OBJECT + public: + MainWindow(); + + bool inRPNMode() const; + + protected: + virtual void contextMenuEvent(QContextMenuEvent *e); + virtual bool eventFilter(QObject *o, QEvent *e); + virtual bool queryExit(); + virtual void polish(); + + private slots: + void slotReturnPressed(); + void slotTextChanged(); + void slotEvaluate(); + + void slotPrecisionAuto(); + void slotPrecision3(); + void slotPrecision8(); + void slotPrecision15(); + void slotPrecision50(); + void slotPrecisionCustom(); + + void slotUpdateSize(); + + void slotDegrees(); + void slotRadians(); + + void slotEntrySelected(const QString &text); + void slotResultSelected(const QString &text); + + void slotToggleMenuBar(); + void slotToggleFunctionList(); + void slotToggleVariableList(); + void slotToggleHistoryList(); + void slotToggleCompactMode(); + void slotToggleExpressionMode(); + + void slotNewValue(const QString &name, Abakus::number_t value); + void slotChangeValue(const QString &name, Abakus::number_t value); + void slotRemoveValue(const QString &name); + + void slotNewFunction(const QString &name); + void slotRemoveFunction(const QString &name); + + private: + int getParenthesesLevel(const QString &str); + + void redrawResults(); + void selectCorrectPrecisionAction(); + + void loadConfig(); + void saveConfig(); + void setupLayout(); + void populateListViews(); + QString interpolateExpression(const QString &text, ResultListViewText *after); + + // Donated via JuK + KAction *action(const char *key) const; + + template <class T> T *action(const char *key) const + { + return dynamic_cast<T *>(action(key)); + } + + private: + QVBox *m_history; + QRadioButton *m_degrees; + QRadioButton *m_radians; + Editor *m_edit; + KPopupMenu *m_popup; + ResultListView *m_result; + QString m_lastError; + QBoxLayout *m_layout; + KListView *m_fnList, *m_varList; + QSplitter *m_mainSplitter, *m_listSplitter; + QSize m_newSize, m_oldSize; + + AbakusIface *m_dcopInterface; + + bool m_wasFnShown, m_wasVarShown, m_wasHistoryShown; + bool m_compactMode; + + bool m_insert; +}; + +#endif |