summaryrefslogtreecommitdiffstats
path: root/apps/gui/buttonbar.h
blob: 3098ecce4f6dd8bb98b5b25008fca0fd6683a346 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2005 by Kevin Ferrare
 *
 * All files in this archive are subject to the GNU General Public License.
 * See the file COPYING in the source tree root for full license agreement.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/

#ifndef _GUI_BUTTONBAR_H_
#define _GUI_BUTTONBAR_H_
#include "config.h"
#include "button.h"
#include "screen_access.h"


#ifdef HAS_BUTTONBAR
#define BUTTONBAR_HEIGHT 8
#define BUTTONBAR_MAX_BUTTONS 3
#define BUTTONBAR_CAPTION_LENGTH 8


struct gui_buttonbar
{
    char caption[BUTTONBAR_MAX_BUTTONS][BUTTONBAR_CAPTION_LENGTH];
    struct screen * display;
};

/*
 * Initializes the buttonbar
 *  - buttonbar : the buttonbar
 */
extern void gui_buttonbar_init(struct gui_buttonbar * buttonbar);

/*
 * Attach the buttonbar to a screen
 *  - buttonbar : the buttonbar
 *  - display : the display to attach the buttonbar
 */
extern void gui_buttonbar_set_display(struct gui_buttonbar * buttonbar,
                                      struct screen * display);

/*
 * Set the caption of the items of the buttonbar
 *  - buttonbar : the buttonbar
 *  - caption1,2,3 : the first, second and thirds items of the bar
 */
extern void gui_buttonbar_set(struct gui_buttonbar * buttonbar,
                              const char *caption1,
                              const char *caption2,
                              const char *caption3);

/*
 * Disable the buttonbar
 *  - buttonbar : the buttonbar
 */
extern void gui_buttonbar_unset(struct gui_buttonbar * buttonbar);

/*
 * Draw the buttonbar on it's attached screen
 *  - buttonbar : the buttonbar
 */
extern void gui_buttonbar_draw(struct gui_buttonbar * buttonbar);

/*
 * Returns true if the buttonbar has something to display, false otherwise
 *  - buttonbar : the buttonbar
 */
extern bool gui_buttonbar_isset(struct gui_buttonbar * buttonbar);
#else
#define BUTTONBAR_HEIGHT 0
#endif
#endif /* _GUI_BUTTONBAR_H_ */