1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // Copyright(C) 2006 Simon Howard
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 // 02111-1307, USA.
20 //
21 
22 #ifndef TXT_DROPDOWN_H
23 #define TXT_DROPDOWN_H
24 
25 /**
26  * @file txt_dropdown.h
27  *
28  * Dropdown list widget.
29  */
30 
31 /**
32  * Dropdown list widget.
33  *
34  * A dropdown list allows the user to select from a list of values,
35  * which appears when the list is selected.
36  *
37  * When the value of a dropdown list is changed, the "changed" signal
38  * is emitted.
39  */
40 
41 typedef struct txt_dropdown_list_s txt_dropdown_list_t;
42 
43 #include "txt_widget.h"
44 
45 //
46 // Drop-down list box.
47 //
48 
49 struct txt_dropdown_list_s
50 {
51     txt_widget_t widget;
52     int *variable;
53     char **values;
54     int num_values;
55 };
56 
57 /**
58  * Create a new dropdown list widget.
59  *
60  * The parameters specify a list of string labels, and a pointer to an
61  * integer variable.  The variable contains the current "value" of the
62  * list, as an index within the list of labels.
63  *
64  * @param variable        Pointer to the variable containing the
65  *                        list's value.
66  * @param values          Pointer to an array of strings containing
67  *                        the labels to use for the list.
68  * @param num_values      The number of variables in the list.
69  */
70 
71 txt_dropdown_list_t *TXT_NewDropdownList(int *variable,
72                                          char **values, int num_values);
73 
74 #endif /* #ifndef TXT_DROPDOWN_H */
75 
76 
77