]> git.ozlabs.org Git - petitboot/blob - ui/ncurses/nc-boot-editor.h
ui/ncurses: ked -> boot-editor
[petitboot] / ui / ncurses / nc-boot-editor.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 <linux/input.h> /* This must be included before ncurses.h */
24 #include <form.h>
25
26 #include "types/types.h"
27 #include "ui/common/ui-system.h"
28 #include "nc-scr.h"
29
30 enum boot_editor_attr_field {
31         boot_editor_attr_field_normal = A_NORMAL,
32         boot_editor_attr_field_selected = A_REVERSE,
33 };
34
35 enum boot_editor_attr_cursor {
36         boot_editor_attr_cursor_ins = A_NORMAL,
37         boot_editor_attr_cursor_ovl = A_NORMAL | A_UNDERLINE,
38 };
39
40 /**
41  * enum boot_editor_result - Result code for boot_editor:on_exit().
42  * @boot_editor_cancel: The user canceled the operation.
43  * @boot_editor_update: The args were updated.
44  */
45
46 enum boot_editor_result {
47         boot_editor_cancel,
48         boot_editor_update,
49 };
50
51 /**
52  * struct boot_editor - kexec args editor.
53  */
54
55 struct boot_editor {
56         struct nc_scr scr;
57         FORM *ncf;
58         FIELD **fields;
59         enum boot_editor_attr_cursor attr_cursor;
60         void (*on_exit)(struct boot_editor *boot_editor,
61                         enum boot_editor_result result,
62                         struct pb_kexec_data *kd);
63 };
64
65 struct boot_editor *boot_editor_init(void *ui_ctx,
66                 const struct pb_kexec_data *kd,
67                 void (*on_exit)(struct boot_editor *,
68                                 enum boot_editor_result,
69                                 struct pb_kexec_data *));
70
71 #endif