Import into DevLib.
[bertos.git] / gui / leveledit.h
1 /**
2  * \file
3  * <!--
4  * Copyright 2004, 2006 Develer S.r.l. (http://www.develer.com/)
5  * This file is part of DevLib - See README.devlib for information.
6  * -->
7  *
8  * \brief Generic editor for (volume/gain/contrast/...) setting.
9  *
10  * \version $Id$
11  *
12  * \author Stefano Fedrigo <aleph@develer.com>
13  */
14 #ifndef GUI_LEVELEDIT_H
15 #define GUI_LEVELEDIT_H
16
17 //#include <gui/levelbar.h>
18
19 /* Type for level_init */
20 #define LEVELEDIT_NOBAR  0  /**< Edit numeber only, without bar nor units */
21 #define LEVELEDIT_SINGLE 1  /**< Single channel editing */
22 #define LEVELEDIT_DOUBLE 2  /**< Double channel editing */
23
24
25
26 /* Fwd decl */
27 struct Bitmap;
28 struct LevelEdit;
29
30 /** Type for callback used to set meter levels */
31 typedef void level_set_callback(void);
32
33 /** Type for callback used to customize display of units */
34 typedef void display_callback(struct LevelEdit *);
35
36 /**
37  * State of a level meter
38  */
39 typedef struct LevelEdit {
40         int type;           /*<! Type of level edititing mode (see prev defines) */
41         const char *title;  /*<! Title on top of screen */
42         const char *unit;   /*<! Unit of quantity changed by this LevelEdit */
43         int min;            /*<! Minimum level */
44         int max;            /*<! Maximum level */
45         int step;           /*<! Value of a single increment/decrement */
46
47         level_set_callback *set_hook;     /*<! Callback called when a value is changed  */
48         display_callback   *display_hook; /*<! Callback for complex unit display */
49         int *ch1_val;                     /*<! (left) Value edited by this leveledit */
50         int *ch2_val;                     /*<! Right channel edited */
51
52         struct Bitmap   *bitmap;  /*<! Bitmap where the whole thing is rendered */
53 } LevelEdit;
54
55
56 void level_init(struct LevelEdit *lev,
57                 int type,
58                 struct Bitmap *bmp, const char *title, const char *unit,
59                 int min, int max, int step,
60                 int *ch1_val, int *ch2_val,
61                 level_set_callback *change_hook, display_callback *display_hook);
62 void level_edit(struct LevelEdit *lev);
63
64 #endif /* GUI_LEVELEDIT_H */