RemoteVstPlugin: fixed too short arrays for preset names
[lmms.git] / include / lcd_spinbox.h
blob8b2252209b0176e1a6e0bf325432dcf0359bfe6b
1 /*
2 * lcd_spinbox.h - class lcdSpinBox, an improved QLCDNumber
4 * Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 * Copyright (c) 2008-2009 Paul Giblock <pgib/at/users.sourceforge.net>
6 *
7 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
27 #ifndef _LCD_SPINBOX_H
28 #define _LCD_SPINBOX_H
30 #include <QtCore/QMap>
31 #include <QtGui/QWidget>
33 #include "AutomatableModelView.h"
36 class EXPORT lcdSpinBox : public QWidget, public IntModelView
38 Q_OBJECT
39 public:
40 lcdSpinBox( int _num_digits, QWidget * _parent, const QString & _name =
41 QString::null );
43 lcdSpinBox( int _num_digits, const QString & _lcd_style,
44 QWidget * _parent, const QString & _name = QString::null );
46 virtual ~lcdSpinBox();
48 void setLabel( const QString & _txt );
50 inline void addTextForValue( int _val, const QString & _text )
52 m_textForValue[_val] = _text;
53 update();
56 virtual void modelChanged()
58 ModelView::modelChanged();
59 update();
63 public slots:
64 virtual void setEnabled( bool _on );
65 virtual void setMarginWidth( int _width );
66 virtual void update();
69 protected:
70 virtual void contextMenuEvent( QContextMenuEvent * _me );
71 virtual void mousePressEvent( QMouseEvent * _me );
72 virtual void mouseMoveEvent( QMouseEvent * _me );
73 virtual void mouseReleaseEvent( QMouseEvent * _me );
74 virtual void wheelEvent( QWheelEvent * _we );
75 virtual void paintEvent( QPaintEvent * _me );
77 virtual void updateSize();
79 private:
81 static const int charsPerPixmap = 12;
83 QMap<int, QString> m_textForValue;
85 QString m_display;
87 QString m_label;
88 QPixmap * m_lcdPixmap;
90 int m_cellWidth;
91 int m_cellHeight;
92 int m_numDigits;
93 int m_marginWidth;
95 QPoint m_origMousePos;
98 signals:
99 void manualChange();
103 typedef IntModel lcdSpinBoxModel;
105 #endif