SpaIot Library
buttoncontroller.h
1/*
2 * SpaIot Library (c) by espilonrt - epsilonrt@gmail.com
3 * This file is part of SpaIot library <https://github.com/epsilonrt/spaiot-lib>
4 *
5 * SpaIot library is licensed under a
6 * Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
7 *
8 * You should have received a copy of the license along with this
9 * work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>.
10 *
11 * SpaIot library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY;
13 */
14#pragma once
15
16#include <map>
17#include <string>
18#include "global.h"
19
20namespace SpaIot {
21
26 class ButtonController {
27 public:
31 ButtonController();
36 virtual ~ButtonController() {}
40 virtual void begin() = 0;
46 virtual int select (int button) = 0;
50 virtual void deselect () = 0;
55 virtual int selected() const;
60 virtual bool isOpened() const;
65 virtual bool isNull() const;
70 virtual bool isSelected() const;
75 virtual bool operator== (const ButtonController &other) const;
80 virtual bool operator!= (const ButtonController &other) const;
81
88 static bool addToRegister (const std::string & name, ButtonController & controller);
94 static ButtonController & getFromRegister (const std::string & name);
95
96 protected:
97 bool m_isopened;
98 int m_selected;
99
100 private:
101 static std::map<std::string, ButtonController &> Register;
102 };
103}
SpaIot name space.
Definition: bussettings.h:21