| 1 | /* |
|---|
| 2 | * Hydrogen |
|---|
| 3 | * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net] |
|---|
| 4 | * |
|---|
| 5 | * http://www.hydrogen-music.org |
|---|
| 6 | * |
|---|
| 7 | * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | * it under the terms of the GNU General Public License as published by |
|---|
| 9 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | * (at your option) any later version. |
|---|
| 11 | * |
|---|
| 12 | * This program is distributed in the hope that it will be useful, |
|---|
| 13 | * but WITHOUT ANY WARRANTY, without even the implied warranty of |
|---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | * GNU General Public License for more details. |
|---|
| 16 | * |
|---|
| 17 | * You should have received a copy of the GNU General Public License |
|---|
| 18 | * along with this program; if not, write to the Free Software |
|---|
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | * |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| 23 | #ifndef LCDCOMBO_H |
|---|
| 24 | #define LCDCOMBO_H |
|---|
| 25 | |
|---|
| 26 | #include "config.h" |
|---|
| 27 | |
|---|
| 28 | #include <QtGui> |
|---|
| 29 | |
|---|
| 30 | #include <hydrogen/Object.h> |
|---|
| 31 | |
|---|
| 32 | class Button; |
|---|
| 33 | class LCDDisplay; |
|---|
| 34 | |
|---|
| 35 | class LCDCombo : public QWidget, public Object |
|---|
| 36 | { |
|---|
| 37 | Q_OBJECT |
|---|
| 38 | public: |
|---|
| 39 | LCDCombo(QWidget *pParent, int digits = 5); |
|---|
| 40 | ~LCDCombo(); |
|---|
| 41 | |
|---|
| 42 | int count(); |
|---|
| 43 | int length(); |
|---|
| 44 | void update(); |
|---|
| 45 | QString getText(); |
|---|
| 46 | bool addItem(const QString &text ); |
|---|
| 47 | void addSeparator(); |
|---|
| 48 | inline void insertItem(int index, const QString &text ); |
|---|
| 49 | void set_text( const QString &text ); |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | private slots: |
|---|
| 53 | void changeText(QAction*); |
|---|
| 54 | void onClick(Button*); |
|---|
| 55 | |
|---|
| 56 | signals: |
|---|
| 57 | void valueChanged( QString str ); |
|---|
| 58 | |
|---|
| 59 | private: |
|---|
| 60 | QStringList items; |
|---|
| 61 | LCDDisplay *display; |
|---|
| 62 | Button *button; |
|---|
| 63 | QMenu *pop; |
|---|
| 64 | int size; |
|---|
| 65 | int active; |
|---|
| 66 | static const QString SEPARATOR; |
|---|
| 67 | |
|---|
| 68 | virtual void mousePressEvent(QMouseEvent *ev); |
|---|
| 69 | virtual void wheelEvent( QWheelEvent * ev ); |
|---|
| 70 | }; |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | #endif |
|---|