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
|
/*
* Copyright (C) 2009 Sony Computer Entertainment Inc.
* Copyright 2009 Sony Corp.
*
* 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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !defined(_PB_NC_CUI_H)
#define _PB_NC_CUI_H
#include <signal.h>
#include "ui/common/joystick.h"
#include "nc-menu.h"
#include "nc-helpscreen.h"
struct cui_opt_data {
const char *name;
struct pb_boot_data *bd;
/* optional data */
const struct device *dev;
const struct boot_option *opt;
uint32_t opt_hash;
};
/**
* struct cui - Data structure defining a cui state machine.
* @c_sig: Signature for callback type checking, should be cui_sig.
* @abort: When set to true signals the state machine to exit.
* @current: Pointer to the active nc object.
* @main: Pointer to the user supplied main menu.
*
* Device boot_options are dynamically added and removed from the @main
* menu.
*/
struct cui {
enum pb_nc_sig c_sig;
bool has_input;
sig_atomic_t abort;
sig_atomic_t resize;
struct nc_scr *current;
struct pmenu *main;
struct waitset *waitset;
struct discover_client *client;
struct system_info *sysinfo;
struct sysinfo_screen *sysinfo_screen;
struct config *config;
struct config_screen *config_screen;
struct add_url_screen *add_url_screen;
struct boot_editor *boot_editor;
struct lang_screen *lang_screen;
struct help_screen *help_screen;
struct pjs *pjs;
void *platform_info;
unsigned int default_item;
int (*on_boot)(struct cui *cui, struct cui_opt_data *cod);
};
struct cui *cui_init(void* platform_info,
int (*js_map)(const struct js_event *e),
int start_deamon);
struct nc_scr *cui_set_current(struct cui *cui, struct nc_scr *scr);
int cui_run(struct cui *cui);
void cui_item_edit(struct pmenu_item *item);
void cui_item_new(struct pmenu *menu);
void cui_show_sysinfo(struct cui *cui);
void cui_show_config(struct cui *cui);
void cui_show_lang(struct cui *cui);
void cui_show_help(struct cui *cui, const char *title,
const struct help_text *text);
void cui_show_add_url(struct cui *cui);
int cui_send_config(struct cui *cui, struct config *config);
int cui_send_url(struct cui *cui, char *url);
void cui_send_reinit(struct cui *cui);
/* convenience routines */
void cui_abort(struct cui *cui);
void cui_resize(struct cui *cui);
void cui_on_exit(struct pmenu *menu);
void cui_on_open(struct pmenu *menu);
int cui_run_cmd(struct pmenu_item *item);
static inline struct cui *cui_from_arg(void *arg)
{
struct cui *cui = (struct cui *)arg;
assert(cui->c_sig == pb_cui_sig);
return cui;
}
static inline struct cui *cui_from_pmenu(struct pmenu *menu)
{
return cui_from_arg(menu->scr.ui_ctx);
}
static inline struct cui *cui_from_item(struct pmenu_item *item)
{
return cui_from_pmenu(item->pmenu);
}
#endif
|