summaryrefslogtreecommitdiffstats
path: root/src/controlpushbutton.h
blob: ecfe841221bb1efc757f4a3554931a993afc1878 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/***************************************************************************
                          controlpushbutton.h  -  description
                             -------------------
    begin                : Wed Feb 20 2002
    copyright            : (C) 2002 by Tue and Ken Haste Andersen
    email                :
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef CONTROLPUSHBUTTON_H
#define CONTROLPUSHBUTTON_H

#include "controlobject.h"
#include "controllers/midi/midimessage.h"

/**
  *@author Tue and Ken Haste Andersen
  */

class ControlPushButton : public ControlObject {
    Q_OBJECT
  public:
    enum ButtonMode {
         PUSH = 0,
         TOGGLE,
         POWERWINDOW,
         LONGPRESSLATCHING,
         TRIGGER,
    };

    static QString buttonModeToString(int mode) {
        switch(mode) {
            case ControlPushButton::PUSH:
                return "PUSH";
            case ControlPushButton::TOGGLE:
                return "TOGGLE";
            case ControlPushButton::POWERWINDOW:
                return "POWERWINDOW";
            case ControlPushButton::LONGPRESSLATCHING:
                return "LONGPRESSLATCHING";
            case ControlPushButton::TRIGGER:
                return "TRIGGER";
            default:
                return "UNKNOWN";
        }
    }

    ControlPushButton(ConfigKey key, bool bPersist=false);
    virtual ~ControlPushButton();

    inline ButtonMode getButtonMode() const {
        return m_buttonMode;
    }
    void setButtonMode(enum ButtonMode mode);
    void setStates(int num_states);

  private:
    enum ButtonMode m_buttonMode;
    int m_iNoStates;
};

#endif