File: midipushbutton.cpp

package info (click to toggle)
ams 1.8.7-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,880 kB
  • ctags: 2,171
  • sloc: cpp: 17,793; makefile: 433; sh: 101
file content (42 lines) | stat: -rw-r--r-- 1,054 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <qslider.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qlabel.h>
#include <qsizepolicy.h>
#include <stdio.h>
#include <math.h>
#include <qstrlist.h>
#include "midipushbutton.h"
#include "synthdata.h"
#include "midiwidget.h"
#include "midiguicomponent.h"

MidiPushButton::MidiPushButton(QObject *parentModule, QWidget * parent, const char * name, SynthData *p_synthdata)
                           : MidiGUIcomponent(parentModule, p_synthdata, parent, name) {

  componentType = GUIcomponentType_pushbutton;
  setMargin(5);
  QHBox *buttonBox = new QHBox(this);
  new QWidget(buttonBox);
  pushButton = new QPushButton(name, buttonBox);  
  new QWidget(buttonBox);
  QObject::connect(pushButton, SIGNAL(clicked()), this, SLOT(buttonClicked()));
}

MidiPushButton::~MidiPushButton() {
}

void MidiPushButton::setMidiValue(int value) {

  if (midiSign == 1) {
    if (value > 124) emit clicked();
  } else {
    if (value <= 124) emit clicked();
  }
}

void MidiPushButton::buttonClicked() {

  emit clicked();
  emit guiComponentTouched();
}