-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtally.h
61 lines (52 loc) · 2.09 KB
/
tally.h
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
#ifndef __PICLOCK_TALLY_H_INCLUDED
#define __PICLOCK_TALLY_H_INCLUDED
#include <memory>
#include "tallycolour.h"
#include "piclock_messages.h"
class TallyState
{
public:
virtual std::shared_ptr<TallyColour> FG(const struct timeval &curTime) const = 0;
virtual std::shared_ptr<TallyColour> BG(const struct timeval &curTime) const = 0;
virtual std::shared_ptr<std::string> Text(const struct timeval &curTime) const = 0;
virtual std::shared_ptr<std::string> Label(const struct timeval &curTime) const = 0;
virtual std::shared_ptr<TallyState> SetLabel(const std::string &lbl) const = 0;
virtual bool IsDigitalClock() const = 0;
virtual bool Equals(std::shared_ptr<TallyState> other) const = 0;
};
class SimpleTallyState : public TallyState
{
public:
std::shared_ptr<TallyColour> FG(const struct timeval &curTime) const override
{
return m_FG;
}
std::shared_ptr<TallyColour> BG(const struct timeval &curTime) const override
{
return m_BG;
}
std::shared_ptr<std::string> Text(const struct timeval &curTime) const override
{
return m_text;
}
std::shared_ptr<std::string> Label(const struct timeval &curTime) const override
{
return m_label;
}
std::shared_ptr<TallyState> SetLabel(const std::string & label) const override;
bool IsDigitalClock() const override
{
return false;
}
bool Equals(std::shared_ptr<TallyState> other) const override;
SimpleTallyState(const std::shared_ptr<ClockMsg_SetTally> &pMsg, const std::shared_ptr<TallyState> & pOld);
SimpleTallyState(const ClockMsg_SetTally &msg, const std::shared_ptr<TallyState> & pOld);
SimpleTallyState(const std::string &fg, const std::string &bg, const std::string &_text);
SimpleTallyState(const TallyColour &fg, const TallyColour &bg, const std::string &_text);
SimpleTallyState(const std::string &fg, const std::string &bg, const std::string &_text, const std::shared_ptr<TallyState> &_old);
SimpleTallyState(const TallyColour &fg, const TallyColour &bg, const std::string &_text, const std::shared_ptr<TallyState> &_old);
protected:
std::shared_ptr<TallyColour> m_FG, m_BG;
std::shared_ptr<std::string> m_text, m_label;
};
#endif