GnuCash  5.6-150-g038405b370+
gnc-query-view.h
1 /********************************************************************\
2  * gnc-query-view.h -- GnuCash GNOME query display view widget *
3  * Copyright (C) 2003 Derek Atkins <derek@ihtfp.com> *
4  * Copyright (C) 2012 Robert Fewell *
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 as *
8  * published by the Free Software Foundation; either version 2 of *
9  * 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, contact: *
18  * *
19  * Free Software Foundation Voice: +1-617-542-5942 *
20  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21  * Boston, MA 02110-1301, USA gnu@gnu.org *
22 \********************************************************************/
23 
24 #ifndef GNC_QUERY_VIEW_H
25 #define GNC_QUERY_VIEW_H
26 
27 #include <gtk/gtk.h>
28 
29 #include "Query.h"
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif /* __cplusplus */
35 
36 #define GNC_TYPE_QUERY_VIEW (gnc_query_view_get_type ())
37 #define GNC_QUERY_VIEW(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_QUERY_VIEW, GNCQueryView)
38 #define GNC_QUERY_VIEW_CLASS(klass) G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_QUERY_VIEW, GNCQueryViewClass)
39 #define GNC_IS_QUERY_VIEW(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_QUERY_VIEW)
40 #define GNC_IS_QUERY_VIEW_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_QUERY_VIEW)
41 
42 typedef struct _GNCQueryView GNCQueryView;
43 typedef struct _GNCQueryViewClass GNCQueryViewClass;
44 
46 {
47  GtkTreeView qview;
48 
49  /* Query information */
50  Query *query;
51 
52  /* Select information */
53  gint toggled_row;
54  gint toggled_column;
55  gboolean use_scroll_to_selection;
56 
57  /* Column information */
58  gint num_columns;
59  GList *column_params;
60 
61  /* numeric information */
62  gboolean numeric_abs;
63  gboolean numeric_inv_sort;
64 
65  /* Sorting info */
66  gint sort_column;
67  gboolean increasing;
68 };
69 
71 {
72  GtkTreeViewClass view_class;
73 
74  /* This signal is emitted when a toggle happens, the pointer has
75  an integer value for the active setting of the toggle */
76  void (*column_toggled) (GNCQueryView *qview, gpointer item);
77 
78  /* This signal is emitted when a row is selected, the pointer has
79  an integer value for the number of rows selected */
80  void (*row_selected) (GNCQueryView *qview, gpointer item);
81 
82  /* This signal is emitted when a row is double clicked, the pointer has
83  a pointer to the entry */
84  void (*double_click_entry) (GNCQueryView *qview, gpointer entry);
85 };
86 
87 /***********************************************************
88  * public functions *
89  ***********************************************************/
90 
91 GType gnc_query_view_get_type (void);
92 
93 /* The param_list remains owned by the caller but is used by the
94  * query-view; do not destroy it until you destroy this query-view.
95  * The query will be copied by the query-view so the caller may do
96  * whatever they want.
97  */
98 GtkWidget * gnc_query_view_new (GList *param_list, Query *query);
99 
100 void gnc_query_view_construct (GNCQueryView *qview, GList *param_list, Query *query);
101 
102 void gnc_query_view_reset_query (GNCQueryView *view, Query *query);
103 
104 void gnc_query_view_set_numerics (GNCQueryView *qview, gboolean abs, gboolean inv_sort);
105 
106 gint gnc_query_view_get_num_entries (GNCQueryView *qview);
107 
108 gpointer gnc_query_view_get_selected_entry (GNCQueryView *qview);
109 
112 GList * gnc_query_view_get_selected_entry_list (GNCQueryView *qview);
113 
114 void gnc_query_view_refresh (GNCQueryView *qview);
115 
116 void gnc_query_view_unselect_all (GNCQueryView *qview);
117 
118 gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item);
119 
120 void gnc_query_sort_order (GNCQueryView *qview, gint column, GtkSortType order);
121 
122 void gnc_query_set_expand_column (GNCQueryView *qview, gint column);
123 
124 void gnc_query_scroll_to_selection (GNCQueryView *qview);
125 
126 void gnc_query_force_scroll_to_selection (GNCQueryView *qview);
127 
128 void gnc_query_use_scroll_to_selection (GNCQueryView *qview, gboolean scroll);
129 
130 #ifdef __cplusplus
131 }
132 #endif /* __cplusplus */
133 
134 #endif /* GNC_QUERY_VIEW_H */
A Query.
Definition: qofquery.cpp:74