summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/yesno.c50
-rw-r--r--apps/gui/yesno.h54
2 files changed, 65 insertions, 39 deletions
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c
index d05ea6654a..1ef61249b6 100644
--- a/apps/gui/yesno.c
+++ b/apps/gui/yesno.c
@@ -1,3 +1,22 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id $
9 *
10 * Copyright (C) 2005 by Kevin Ferrare
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
1#include "yesno.h" 20#include "yesno.h"
2#include "system.h" 21#include "system.h"
3#include "kernel.h" 22#include "kernel.h"
@@ -5,7 +24,14 @@
5#include "lang.h" 24#include "lang.h"
6#include "action.h" 25#include "action.h"
7 26
8void gui_yesno_init(struct gui_yesno * yn, 27/*
28 * Initializes the yesno asker
29 * - yn : the yesno structure
30 * - main_message : the question the user has to answer
31 * - yes_message : message displayed if answer is 'yes'
32 * - no_message : message displayed if answer is 'no'
33 */
34static void gui_yesno_init(struct gui_yesno * yn,
9 struct text_message * main_message, 35 struct text_message * main_message,
10 struct text_message * yes_message, 36 struct text_message * yes_message,
11 struct text_message * no_message) 37 struct text_message * no_message)
@@ -16,13 +42,22 @@ void gui_yesno_init(struct gui_yesno * yn,
16 yn->display=0; 42 yn->display=0;
17} 43}
18 44
19void gui_yesno_set_display(struct gui_yesno * yn, 45/*
46 * Attach the yesno to a screen
47 * - yn : the yesno structure
48 * - display : the screen to attach
49 */
50static void gui_yesno_set_display(struct gui_yesno * yn,
20 struct screen * display) 51 struct screen * display)
21{ 52{
22 yn->display=display; 53 yn->display=display;
23} 54}
24 55
25void gui_yesno_draw(struct gui_yesno * yn) 56/*
57 * Draws the yesno
58 * - yn : the yesno structure
59 */
60static void gui_yesno_draw(struct gui_yesno * yn)
26{ 61{
27 struct screen * display=yn->display; 62 struct screen * display=yn->display;
28 int nb_lines, line_shift=0; 63 int nb_lines, line_shift=0;
@@ -45,7 +80,14 @@ void gui_yesno_draw(struct gui_yesno * yn)
45 gui_textarea_update(display); 80 gui_textarea_update(display);
46} 81}
47 82
48bool gui_yesno_draw_result(struct gui_yesno * yn, enum yesno_res result) 83/*
84 * Draws the yesno result
85 * - yn : the yesno structure
86 * - result : the result tha must be displayed :
87 * YESNO_NO if no
88 * YESNO_YES if yes
89 */
90static bool gui_yesno_draw_result(struct gui_yesno * yn, enum yesno_res result)
49{ 91{
50 struct text_message * message=yn->result_message[result]; 92 struct text_message * message=yn->result_message[result];
51 if(message==NULL) 93 if(message==NULL)
diff --git a/apps/gui/yesno.h b/apps/gui/yesno.h
index 7b60cab132..67456cf69b 100644
--- a/apps/gui/yesno.h
+++ b/apps/gui/yesno.h
@@ -1,3 +1,22 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id $
9 *
10 * Copyright (C) 2005 by Kevin Ferrare
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
1#ifndef _GUI_YESNO_H_ 20#ifndef _GUI_YESNO_H_
2#define _GUI_YESNO_H_ 21#define _GUI_YESNO_H_
3 22
@@ -20,41 +39,6 @@ struct gui_yesno
20}; 39};
21 40
22/* 41/*
23 * Initializes the yesno asker
24 * - yn : the yesno structure
25 * - main_message : the question the user has to answer
26 * - yes_message : message displayed if answer is 'yes'
27 * - no_message : message displayed if answer is 'no'
28 */
29extern void gui_yesno_init(struct gui_yesno * yn,
30 struct text_message * main_message,
31 struct text_message * yes_message,
32 struct text_message * no_message);
33
34/*
35 * Attach the yesno to a screen
36 * - yn : the yesno structure
37 * - display : the screen to attach
38 */
39extern void gui_yesno_set_display(struct gui_yesno * yn,
40 struct screen * display);
41
42/*
43 * Draws the yesno
44 * - yn : the yesno structure
45 */
46extern void gui_yesno_draw(struct gui_yesno * yn);
47
48/*
49 * Draws the yesno result
50 * - yn : the yesno structure
51 * - result : the result tha must be displayed :
52 * YESNO_NO if no
53 * YESNO_YES if yes
54 */
55extern bool gui_yesno_draw_result(struct gui_yesno * yn, enum yesno_res result);
56
57/*
58 * Runs the yesno asker : 42 * Runs the yesno asker :
59 * it will display the 'main_message' question, and wait for user keypress 43 * it will display the 'main_message' question, and wait for user keypress
60 * PLAY means yes, other keys means no 44 * PLAY means yes, other keys means no