GnuCash  5.6-150-g038405b370+
gnc-general-search.h
1 /*
2  * gnc-general-search.h -- Widget to pop-up a search dialog and show
3  * the selected item.
4  *
5  * Copyright (C) 2001 Free Software Foundation
6  * All rights reserved.
7  *
8  * Derek Atkins <warlord@MIT.EDU>
9  *
10  * GnuCash is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU Library General Public License as
12  * published by the Free Software Foundation; either version 2 of
13  * the License, or (at your option) any later version.
14  *
15  * Gnucash is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, contact:
22  *
23  * Free Software Foundation Voice: +1-617-542-5942
24  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
25  * Boston, MA 02110-1301, USA gnu@gnu.org
26  *
27  */
28 /*
29  @NOTATION@
30  */
31 
32 #ifndef GNC_GENERAL_SEARCH_H
33 #define GNC_GENERAL_SEARCH_H
34 
35 #include "dialog-search.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #define GNC_TYPE_GENERAL_SEARCH \
42  (gnc_general_search_get_type ())
43 
44 #define GNC_GENERAL_SEARCH(obj) \
45  G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_GENERAL_SEARCH, GNCGeneralSearch)
46 
47 #define GNC_GENERAL_SEARCH_CLASS(klass) \
48  G_TYPE_CLASS_CAST (klass, GNC_TYPE_GENERAL_SEARCH, \
49  GNCGeneralSearchClass)
50 #define GNC_IS_GENERAL_SEARCH(obj) \
51  G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_GENERAL_SEARCH)
52 
53 /*
54  * If this returns NULL, then do nothing (probably an edit window). If
55  * it actually returns a search-window, then this widget will set up the
56  * appropriate callbacks to the search window to obtain selections.
57  */
58 typedef GNCSearchWindow *(*GNCSearchCB) (GtkWindow *parent, gpointer start, gpointer user_data);
59 
60 typedef struct
61 {
62  GtkBox hbox;
63 
64  GtkWidget * entry; /* display of selection name */
65  GtkWidget * button; /* button for popping up search window */
66 
67  gpointer selected_item;
68 
69  gboolean allow_clear;
71 
72 typedef struct
73 {
74  GtkBoxClass parent_class;
75 
76  void (*changed) (GNCGeneralSearch *edit);
78 
79 
80 GtkWidget *gnc_general_search_new (QofIdTypeConst type,
81  const char *label,
82  gboolean text_editable,
83  GNCSearchCB search_cb,
84  gpointer user_data,
85  QofBook *book);
86 
87 void gnc_general_search_allow_clear (GNCGeneralSearch *gsl,
88  gboolean allow_clear);
89 void gnc_general_search_set_selected (GNCGeneralSearch *gsl,
90  gpointer searched);
91 gpointer gnc_general_search_get_selected (GNCGeneralSearch *gsl);
92 
93 GType gnc_general_search_get_type (void);
94 
95 void gnc_general_search_grab_focus (GNCGeneralSearch *gsl);
96 
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif
const gchar * QofIdTypeConst
QofIdTypeConst declaration.
Definition: qofid.h:82