]> git.ozlabs.org Git - petitboot/blob - ui/ncurses/nc-ked.h
36ed4f17520fd331f73edaa735e627a4a92e3119
[petitboot] / ui / ncurses / nc-ked.h
1 /*
2  *  Copyright (C) 2009 Sony Computer Entertainment Inc.
3  *  Copyright 2009 Sony Corp.
4  *
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.
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
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #if !defined(_PB_NC_KED_H)
20 #define _PB_NC_KED_H
21
22 #include <assert.h>
23 #include <form.h>
24
25 #include "pb-protocol/pb-protocol.h"
26 #include "ui/common/ui-system.h"
27 #include "nc-scr.h"
28
29 enum ked_attr_field {
30         ked_attr_field_normal = A_NORMAL,
31         ked_attr_field_selected = A_REVERSE,
32 };
33
34 enum ked_attr_cursor {
35         ked_attr_cursor_ins = A_NORMAL,
36         ked_attr_cursor_ovl = A_NORMAL | A_UNDERLINE,
37 };
38
39 /**
40  * enum ked_result - Result code for ked:on_exit().
41  * @ked_cancel: The user canceled the operation.
42  * @ked_update: The args were updated.
43  * @ked_boot: The user requested a boot of this item.
44  */
45
46 enum ked_result {
47         ked_cancel,
48         ked_update,
49         ked_boot,
50 };
51
52 /**
53  * struct ked - kexec args editor.
54  */
55
56 struct ked {
57         struct nc_scr scr;
58         FORM *ncf;
59         FIELD **fields;
60         enum ked_attr_cursor attr_cursor;
61         void (*on_exit)(struct ked *ked, enum ked_result result,
62                 struct pb_kexec_data *kd);
63 };
64
65 struct ked *ked_init(void *ui_ctx, const struct pb_kexec_data *kd,
66         void (*on_exit)(struct ked *, enum ked_result, struct pb_kexec_data *));
67
68 #endif