GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 <[email protected]>
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 [email protected]
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 #define GNC_TYPE_GENERAL_SEARCH \
38  (gnc_general_search_get_type ())
39 
40 #define GNC_GENERAL_SEARCH(obj) \
41  G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_GENERAL_SEARCH, GNCGeneralSearch)
42 
43 #define GNC_GENERAL_SEARCH_CLASS(klass) \
44  G_TYPE_CLASS_CAST (klass, GNC_TYPE_GENERAL_SEARCH, \
45  GNCGeneralSearchClass)
46 #define GNC_IS_GENERAL_SEARCH(obj) \
47  G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_GENERAL_SEARCH)
48 
49 /*
50  * If this returns NULL, then do nothing (probably an edit window). If
51  * it actually returns a search-window, then this widget will set up the
52  * appropriate callbacks to the search window to obtain selections.
53  */
54 typedef GNCSearchWindow *(*GNCSearchCB) (gpointer start, gpointer user_data);
55 
56 typedef struct
57 {
58  GtkHBox hbox;
59 
60  GtkWidget * entry; /* display of selection name */
61  GtkWidget * button; /* button for popping up search window */
62 
63  gpointer selected_item;
64 
65  gboolean allow_clear;
67 
68 typedef struct
69 {
70  GtkHBoxClass parent_class;
71 
72  void (*changed) (GNCGeneralSearch *edit);
74 
75 
76 GtkWidget *gnc_general_search_new (QofIdTypeConst type,
77  const char *label,
78  gboolean text_editable,
79  GNCSearchCB search_cb,
80  gpointer user_data,
81  QofBook *book);
82 
83 void gnc_general_search_allow_clear (GNCGeneralSearch *gsl,
84  gboolean allow_clear);
85 void gnc_general_search_set_selected (GNCGeneralSearch *gsl,
86  gpointer searched);
87 gpointer gnc_general_search_get_selected (GNCGeneralSearch *gsl);
88 
89 GType gnc_general_search_get_type (void);
90 
91 void gnc_general_search_grab_focus (GNCGeneralSearch *gsl);
92 
93 
94 #endif
const gchar * QofIdTypeConst
Definition: qofid.h:87