GnuCash  5.6-150-g038405b370+
gnc-general-select.h
1 /*
2  * gnc-general-select.h -- General Selection Widget
3  *
4  * Copyright (C) 2001 Free Software Foundation
5  * All rights reserved.
6  *
7  * Derek Atkins <warlord@MIT.EDU>
8  *
9  * GnuCash is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Library General Public License as
11  * published by the Free Software Foundation; either version 2 of
12  * the License, or (at your option) any later version.
13  *
14  * Gnucash is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, contact:
21  *
22  * Free Software Foundation Voice: +1-617-542-5942
23  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
24  * Boston, MA 02110-1301, USA gnu@gnu.org
25  *
26  */
27 /*
28  @NOTATION@
29  */
30 
31 #ifndef GNC_GENERAL_SELECT_H
32 #define GNC_GENERAL_SELECT_H
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define GNC_TYPE_GENERAL_SELECT (gnc_general_select_get_type ())
39 #define GNC_GENERAL_SELECT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gnc_general_select_get_type(), GNCGeneralSelect)
40 #define GNC_GENERAL_SELECT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gnc_general_select_get_type(), \ GNCGeneralSelectClass)
41 #define GNC_IS_GENERAL_SELECT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gnc_general_select_get_type ())
42 
43 typedef const char * (*GNCGeneralSelectGetStringCB) (gpointer);
44 typedef gpointer (*GNCGeneralSelectNewSelectCB) (gpointer cbarg, gpointer default_selection, GtkWidget *parent);
45 
46 typedef enum
47 {
48  GNC_GENERAL_SELECT_TYPE_SELECT = 1,
49  GNC_GENERAL_SELECT_TYPE_EDIT = 2,
50  GNC_GENERAL_SELECT_TYPE_VIEW = 3
51 } GNCGeneralSelectType;
52 
53 typedef struct
54 {
55  GtkBox hbox;
56 
57  GtkWidget *entry; /* display of selection name */
58  GtkWidget *button; /* button for popping up selection window */
59 
60  gpointer selected_item;
61 
62  GNCGeneralSelectGetStringCB get_string;
63  GNCGeneralSelectNewSelectCB new_select;
64  gpointer cb_arg;
65 
66  int disposed; /* private */
68 
69 typedef struct
70 {
71  GtkBoxClass parent_class;
72 
73  void (*changed) (GNCGeneralSelect *edit);
75 
76 
77 GtkWidget *gnc_general_select_new (GNCGeneralSelectType type,
78  GNCGeneralSelectGetStringCB get_string,
79  GNCGeneralSelectNewSelectCB new_select,
80  gpointer cb_arg);
81 void gnc_general_select_set_selected (GNCGeneralSelect *gsl,
82  gpointer selected);
83 gpointer gnc_general_select_get_selected (GNCGeneralSelect *gsl);
84 const char *gnc_general_select_get_printname (GNCGeneralSelect *gsl,
85  gpointer selection);
86 GType gnc_general_select_get_type (void);
87 
88 void gnc_general_select_make_mnemonic_target (GNCGeneralSelect *gsl, GtkWidget *label);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif
95