diff options
author | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
commit | 8a2c2824a59d7644e13bc52c9a0ecbd641f21f95 (patch) | |
tree | 064ad3f2bf8daab0ad27b128abd86a9bbdb1e496 /muse2/muse/widgets/nentry.h | |
parent | a27706d9629e8b592cca4659f865b70adef24e6d (diff) |
new branch muse2, first checkin
Diffstat (limited to 'muse2/muse/widgets/nentry.h')
-rw-r--r-- | muse2/muse/widgets/nentry.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/muse2/muse/widgets/nentry.h b/muse2/muse/widgets/nentry.h new file mode 100644 index 00000000..30ddd930 --- /dev/null +++ b/muse2/muse/widgets/nentry.h @@ -0,0 +1,93 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: nentry.h,v 1.1.1.1.2.2 2008/05/21 00:28:54 terminator356 Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __NENTRY_H__ +#define __NENTRY_H__ + +#include <q3frame.h> +#include <qlineedit.h> +#include <qstring.h> +//Added by qt3to4: +#include <QWheelEvent> +#include <QEvent> +#include <Q3HBoxLayout> +#include <QMouseEvent> +#include <QLabel> +#include <QContextMenuEvent> +#include <QKeyEvent> + +class QTimer; +class Q3HBoxLayout; +class QLabel; + +class NentryFilter : public QObject { + Q_OBJECT + + protected: + bool eventFilter(QObject* object, QEvent* event); + public: + NentryFilter(QObject* parent); + }; + +//--------------------------------------------------------- +// Nentry +// numerical entry widget with optional label +//--------------------------------------------------------- + +class Nentry : public Q3Frame { + Q_OBJECT + + int button; + int starty; + bool drawFrame; + QTimer* timer; + int evx; + int timecount; + Q3HBoxLayout* layout; + QObject* filter; + QLabel* label; + int lPos; // label Position 0 - left, 1 - right + QWidget* focusW; + + protected: + QLineEdit* edit; + int val; + virtual void incValue(int x) = 0; + virtual void decValue(int x) = 0; + virtual bool setString(int, bool editable = false) = 0; + virtual bool setSValue(const QString&) = 0; + + private slots: + void repeat(); + + protected slots: + void endEdit(); + + public slots: + virtual void setValue(int); + + public: + Nentry(QWidget* parent, const QString& txt = QString(""), + int lPos = 0, bool dark=false); + + int value() const { return val; } + void setFrame(bool); + //void setAlignment(int flag) { edit->setAlignment(flag); } + void setText(const QString& s); + void setSize(int n); + void setDark(); + + void mousePress(QMouseEvent*); + void mouseMove(QMouseEvent*); + void mouseDoubleClick(QMouseEvent*); + void mouseRelease(QMouseEvent*); + void wheel(QWheelEvent*); + bool keyPress(QKeyEvent*); + void setFocusPolicy(Qt::FocusPolicy); + bool contextMenu(QContextMenuEvent*); + }; +#endif |