summaryrefslogtreecommitdiff
path: root/apps/gui/option_select.h
diff options
context:
space:
mode:
authorKevin Ferrare <kevin@rockbox.org>2005-11-22 03:38:07 +0000
committerKevin Ferrare <kevin@rockbox.org>2005-11-22 03:38:07 +0000
commit74b6af93b1436dc61e8f10b3aff3c79face5faba (patch)
treef5d17c6b0adb9f6cc448a112b309a6dff7451a76 /apps/gui/option_select.h
parent8042640ce967014f10dbc0e3f382cd1876310b66 (diff)
downloadrockbox-74b6af93b1436dc61e8f10b3aff3c79face5faba.tar.gz
rockbox-74b6af93b1436dc61e8f10b3aff3c79face5faba.zip
Added multi-screen support for quickscreen (mostly rewritten from scratch) and USB screen ; just looking at the hour makes me think it could be buggy
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8039 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/option_select.h')
-rw-r--r--apps/gui/option_select.h119
1 files changed, 119 insertions, 0 deletions
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h
new file mode 100644
index 0000000000..c6a5e196f0
--- /dev/null
+++ b/apps/gui/option_select.h
@@ -0,0 +1,119 @@
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
20#ifndef _GUI_OPTION_SELECT_H_
21#define _GUI_OPTION_SELECT_H_
22#include "settings.h"
23
24typedef void option_formatter(char* dest, int dest_length,
25 int variable, const char* unit);
26
27struct option_select
28{
29 const char * title;
30 int min_value;
31 int max_value;
32 int step;
33 int option;
34 const char * extra_string;
35 /* In the case the option is a number */
36 option_formatter *formatter;
37 const struct opt_items * items;
38 bool limit_loop;
39};
40
41/*
42 * Initializes an option containing a numeric values
43 * - title : the title of the option
44 * - init_value : the initial value the number will be
45 * - min_value, max_value : bounds to the value
46 * - step : the ammount you want to add / withdraw to the initial number
47 * each time a key is pressed
48 * - unit : the unit in which the value is (ex "s", "bytes", ...)
49 * - formatter : a callback function that generates a string
50 * from the number it gets
51 */
52extern void option_select_init_numeric(struct option_select * opt,
53 const char * title,
54 int init_value,
55 int min_value,
56 int max_value,
57 int step,
58 const char * unit,
59 option_formatter *formatter);
60
61/*
62 * Initializes an option containing a list of choices
63 * - title : the title of the option
64 * - selected : the initially selected item
65 * - items : the list of items, defined in settings.h
66 * - nb_items : the number of items in the 'items' list
67 */
68extern void option_select_init_items(struct option_select * opt,
69 const char * title,
70 int selected,
71 const struct opt_items * items,
72 int nb_items);
73
74/*
75 * Gets the selected option
76 * - opt : the option struct
77 * - buffer : a buffer to eventually format the option
78 * Returns the selected option
79 */
80extern const char * option_select_get_text(struct option_select * opt, char * buffer);
81
82/*
83 * Selects the next value
84 * - opt : the option struct
85 */
86extern void option_select_next(struct option_select * opt);
87
88/*
89 * Selects the previous value
90 * - opt : the option struct
91 */
92extern void option_select_prev(struct option_select * opt);
93
94/*
95 * Returns the selected number
96 * - opt : the option struct
97 */
98#define option_select_get_selected(_opt) \
99 (_opt)->option
100
101/*
102 * Returns the title
103 * - opt : the option struct
104 */
105#define option_select_get_title(_opt) \
106 (_opt)->title
107
108/*
109 * Tells the option selector wether it should stop when reaching the min/max value
110 * or should continue (by going to max/min)
111 * - opt : the option struct
112 * - scroll :
113 * - true : stops when reaching min/max
114 * - false : continues to go to max/min when reaching min/max
115 */
116#define option_select_limit_loop(_opt, loop) \
117 (_opt)->limit_loop=loop
118
119#endif /* _GUI_OPTION_SELECT_H_ */