2 * Copyright (C) 2009 Sony Computer Entertainment Inc.
3 * Copyright 2009 Sony Corp.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
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.
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
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #if !defined(_PB_NC_CUI_H)
24 #include "ui/common/joystick.h"
26 #include "nc-helpscreen.h"
31 struct pb_boot_data *bd;
32 struct pb_plugin_data *pd;
36 const struct device *dev;
37 const struct boot_option *opt;
42 * struct cui - Data structure defining a cui state machine.
43 * @c_sig: Signature for callback type checking, should be cui_sig.
44 * @abort: When set to true signals the state machine to exit.
45 * @current: Pointer to the active nc object.
46 * @main: Pointer to the user supplied main menu.
48 * Device boot_options are dynamically added and removed from the @main
57 struct nc_scr *current;
59 struct pmenu *plugin_menu;
60 unsigned int n_plugins;
61 struct waitset *waitset;
62 struct discover_client *client;
63 struct system_info *sysinfo;
64 struct statuslog *statuslog;
65 struct sysinfo_screen *sysinfo_screen;
66 struct config *config;
67 struct config_screen *config_screen;
68 struct add_url_screen *add_url_screen;
69 struct plugin_screen *plugin_screen;
70 struct boot_editor *boot_editor;
71 struct lang_screen *lang_screen;
72 struct help_screen *help_screen;
73 struct subset_screen *subset_screen;
74 struct statuslog_screen *statuslog_screen;
77 unsigned int default_item;
78 int (*on_boot)(struct cui *cui, struct cui_opt_data *cod);
81 struct cui *cui_init(void* platform_info,
82 int (*js_map)(const struct js_event *e),
83 int start_daemon, int timeout);
84 struct nc_scr *cui_set_current(struct cui *cui, struct nc_scr *scr);
85 int cui_run(struct cui *cui);
86 void cui_item_edit(struct pmenu_item *item);
87 void cui_item_new(struct pmenu *menu);
88 void cui_show_sysinfo(struct cui *cui);
89 void cui_show_config(struct cui *cui);
90 void cui_show_lang(struct cui *cui);
91 void cui_show_statuslog(struct cui *cui);
92 void cui_show_help(struct cui *cui, const char *title,
93 const struct help_text *text);
94 void cui_show_subset(struct cui *cui, const char *title,
96 void cui_show_add_url(struct cui *cui);
97 void cui_show_plugin(struct pmenu_item *item);
98 void cui_show_plugin_menu(struct cui *cui);
99 int cui_send_config(struct cui *cui, struct config *config);
100 int cui_send_url(struct cui *cui, char *url);
101 int cui_send_plugin_install(struct cui *cui, char *file);
102 void cui_send_reinit(struct cui *cui);
104 /* convenience routines */
106 void cui_abort(struct cui *cui);
107 void cui_resize(struct cui *cui);
108 void cui_on_exit(struct pmenu *menu);
109 void cui_on_open(struct pmenu *menu);
110 int cui_run_cmd(struct cui *cui, const char **cmd_argv);
111 int cui_run_cmd_from_item(struct pmenu_item *item);
113 static inline struct cui *cui_from_arg(void *arg)
115 struct cui *cui = (struct cui *)arg;
117 assert(cui->c_sig == pb_cui_sig);
121 static inline struct cui *cui_from_pmenu(struct pmenu *menu)
123 return cui_from_arg(menu->scr.ui_ctx);
126 static inline struct cui *cui_from_item(struct pmenu_item *item)
128 return cui_from_pmenu(item->pmenu);