-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenubase.h
131 lines (103 loc) · 2.89 KB
/
menubase.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
* See the files COPYING and README for copyright information and how to reach
* the author.
*
* $Id: menubase.h,v 1.10 2006/09/16 18:33:36 lordjaxom Exp $
*/
#ifndef VDR_BURN_MENUBASE_H
#define VDR_BURN_MENUBASE_H
#include "jobs.h"
#include "menuitems.h"
#include "proctools/format.h"
#include <string>
#include <vdr/osdbase.h>
namespace vdr_burn
{
namespace menu
{
// --- starter --------------------------------------------------------
namespace display
{
enum type
{
none,
recordings,
job,
status
};
const int count = status + 1;
extern const std::string strings[count];
}
class starter: public cOsdMenu
{
public:
starter();
virtual ~starter();
static void cycle_display();
static void set_display(display::type display_);
static std::string get_next_display();
static display::type get_current_display() { return m_instance->m_display; }
protected:
eOSState show_menu();
virtual eOSState ProcessKey(eKeys key);
private:
static starter* m_instance;
display::type m_display;
display::type m_nextDisplay;
};
inline
void starter::set_display(display::type display_)
{
m_instance->m_nextDisplay = display_;
}
// --- pagebase -------------------------------------------------------
class pagebase: public cOsdMenu
{
// XXX remove when implementing proper event handling
friend class track_editor;
struct user_wait
{
bool waiting;
bool result;
std::string message;
cMutex lock;
cCondVar condition;
user_wait(): waiting(false) {}
};
public:
pagebase(const std::string& title, int tab0 = 0, int tab1 = 0, int tab2 = 0);
virtual ~pagebase() = 0;
static bool wait_for_user(const std::string& message);
protected:
void set_help(const std::string& red = std::string(),
const std::string& green = std::string(),
const std::string& yellow = std::string());
void set_current(int current);
void display();
void check_waiting_user();
virtual void set_help_keys() { set_help(); }
virtual bool menu_closing() { return true; }
virtual eOSState menu_update() { return osContinue; }
virtual eOSState ok_pressed() { return osContinue; }
virtual eOSState zero_pressed() { return osContinue; }
virtual eOSState red_pressed() { return osContinue; }
virtual eOSState green_pressed() { return osContinue; }
virtual eOSState yellow_pressed() { return osContinue; }
virtual void submenu_closing() { }
virtual eOSState ProcessKey(eKeys key);
private:
static user_wait m_waitInfo;
job* last_active_job;
int last_percent;
using cOsdMenu::Display;
// <rant> must be constants, thanks for mentioning INSIDE THE
// ACTUAL IMPLEMENTATION. if you want to find out what I mean,
// look into MY impl :> </rant>
std::string m_red;
std::string m_green;
std::string m_yellow;
std::string m_blue;
};
} // namespace menu
} // namespace vdr_burn
#endif // VDR_BURN_MENUBASE_H