446 |
andreas |
1 |
/*
|
|
|
2 |
* Copyright (C) 2023 by Andreas Theofilu <andreas@theosys.at>
|
|
|
3 |
*
|
|
|
4 |
* This program is free software; you can redistribute it and/or modify
|
|
|
5 |
* it under the terms of the GNU General Public License as published by
|
|
|
6 |
* the Free Software Foundation; either version 3 of the License, or
|
|
|
7 |
* (at your option) any later version.
|
|
|
8 |
*
|
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
* GNU General Public License for more details.
|
|
|
13 |
*
|
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
|
15 |
* along with this program; if not, write to the Free Software Foundation,
|
|
|
16 |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
17 |
*/
|
|
|
18 |
|
|
|
19 |
#include "tbuttonstates.h"
|
|
|
20 |
#include "tresources.h"
|
|
|
21 |
#include "terror.h"
|
|
|
22 |
|
|
|
23 |
TButtonStates::TButtonStates(const TButtonStates& bs)
|
|
|
24 |
{
|
|
|
25 |
DECL_TRACER("TButtonStates::TButtonStates(const TButtonStates& bs)");
|
|
|
26 |
|
|
|
27 |
type = bs.type;
|
|
|
28 |
ap = bs.ap;
|
|
|
29 |
ad = bs.ad;
|
|
|
30 |
ch = bs.ch;
|
|
|
31 |
cp = bs.cp;
|
|
|
32 |
lp = bs.lp;
|
|
|
33 |
lv = bs.lv;
|
|
|
34 |
|
|
|
35 |
init();
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
TButtonStates::TButtonStates(BUTTONTYPE t, int rap, int rad, int rch, int rcp, int rlp, int rlv)
|
|
|
39 |
: type(t),
|
|
|
40 |
ap(rap),
|
|
|
41 |
ad(rad),
|
|
|
42 |
ch(rch),
|
|
|
43 |
cp(rcp),
|
|
|
44 |
lp(rlp),
|
|
|
45 |
lv(rlv)
|
|
|
46 |
{
|
|
|
47 |
DECL_TRACER("TButtonStates::TButtonStates(BUTTONTYPE t, int rap, int rad, int rch, int rcp, int rlp, int rlv)");
|
|
|
48 |
|
|
|
49 |
init();
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
TButtonStates::~TButtonStates()
|
|
|
53 |
{
|
|
|
54 |
DECL_TRACER("TButtonStates::~TButtonStates()");
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
void TButtonStates::init()
|
|
|
58 |
{
|
|
|
59 |
DECL_TRACER("TButtonStates::init()");
|
|
|
60 |
|
|
|
61 |
switch(type)
|
|
|
62 |
{
|
|
|
63 |
case GENERAL: mID = createButtonID(type, ap, ad, cp, ch, lp, lv); break;
|
|
|
64 |
case MULTISTATE_GENERAL: mID = createButtonID(type, ap, ad, cp, ch); break;
|
|
|
65 |
case BARGRAPH: mID = createButtonID(type, -1, -1, -1, -1, lp, lv); break;
|
|
|
66 |
case MULTISTATE_BARGRAPH: mID = createButtonID(type, -1, -1, cp, ch, lp, lv); break;
|
|
|
67 |
case JOYSTICK: mID = createButtonID(type, -1, -1, -1, -1, lp, lv); break;
|
|
|
68 |
case TEXT_INPUT: mID = createButtonID(type, ap, ad, cp, ch); break;
|
|
|
69 |
case LISTBOX: mID = createButtonID(type, ap, ad, cp, ch); break;
|
|
|
70 |
case SUBPAGE_VIEW: mID = createButtonID(type, ap, ad, cp, ch); break;
|
|
|
71 |
default:
|
|
|
72 |
mID = createButtonID(type, ap, ad, cp, ch, lp, lv);
|
|
|
73 |
}
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
bool TButtonStates::isButton(BUTTONTYPE t, uint32_t ID)
|
|
|
77 |
{
|
|
|
78 |
// DECL_TRACER("TButtonStates::isButton(BUTTONTYPE t, uint32_t ID)");
|
|
|
79 |
|
|
|
80 |
if (type == t && ID == mID)
|
|
|
81 |
return true;
|
|
|
82 |
|
|
|
83 |
return false;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
bool TButtonStates::isButton(BUTTONTYPE t, int rap, int rad, int rch, int rcp, int rlp, int rlv)
|
|
|
87 |
{
|
|
|
88 |
// DECL_TRACER("TButtonStates::isButton(int rap, int rad, int rch, int rcp, int rlp, int rlv)");
|
|
|
89 |
|
|
|
90 |
if (type == t && rap == ap && rad == ad && rch == ch && rcp == cp && rlp == lp && rlv == lv)
|
|
|
91 |
return true;
|
|
|
92 |
|
|
|
93 |
return false;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
bool TButtonStates::isButton(const TButtonStates& bs)
|
|
|
97 |
{
|
|
|
98 |
// DECL_TRACER("TButtonStates::isButton(const TButtonStates& bs)");
|
|
|
99 |
|
|
|
100 |
if (bs.type == type && bs.ad == ad && bs.ap == ap && bs.ch == ch && bs.cp == cp && bs.lp == lp && bs.lv == lv)
|
|
|
101 |
return true;
|
|
|
102 |
|
|
|
103 |
return false;
|
|
|
104 |
}
|