GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-query-view.h
1 /********************************************************************\
2  * gnc-query-view.h -- GnuCash GNOME query display view widget *
3  * Copyright (C) 2003 Derek Atkins <[email protected]> *
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 [email protected] *
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 #endif /* __cplusplus */
34 
35 #define GNC_TYPE_QUERY_VIEW (gnc_query_view_get_type ())
36 #define GNC_QUERY_VIEW(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_QUERY_VIEW, GNCQueryView)
37 #define GNC_QUERY_VIEW_CLASS(klass) G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_QUERY_VIEW, GNCQueryViewClass)
38 #define GNC_IS_QUERY_VIEW(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_QUERY_VIEW)
39 #define GNC_IS_QUERY_VIEW_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_QUERY_VIEW)
40 
41  typedef struct _GNCQueryView GNCQueryView;
43 
45  {
46  GtkTreeView qview;
47 
48  /* Query information */
49  Query *query;
50  gint num_entries;
51 
52  /* Select information */
53  gpointer selected_entry;
54  GList *selected_entry_list;
55  gint toggled_row;
56  gint toggled_column;
57 
58  /* Column information */
59  gint num_columns;
60  GList *column_params;
61 
62  /* numeric information */
63  gboolean numeric_abs;
64  gboolean numeric_inv_sort;
65 
66  /* Sorting info */
67  gint sort_column;
68  gboolean increasing;
69  };
70 
72  {
73  GtkTreeViewClass view_class;
74 
75  /* This signal is emitted when a toggle happens, the pointer has
76  an interger value for the active setting of the toggle */
77  void (*column_toggled) (GNCQueryView *qview, gpointer item);
78 
79  /* This signal is emitted when a row is selected, the pointer has
80  an interger value for the number of rows selected */
81  void (*row_selected) (GNCQueryView *qview, gpointer item);
82 
83  /* This signal is emitted when a row is double clicked, the pointer has
84  a pointer to the entry */
85  void (*double_click_entry) (GNCQueryView *qview, gpointer entry);
86  };
87 
88  /***********************************************************
89  * public functions *
90  ***********************************************************/
91 
92  GType gnc_query_view_get_type (void);
93 
94  /* The param_list remains owned by the caller but is used by the
95  * query-view; do not destroy it until you destroy this query-view.
96  * The query will be copied by the query-view so the caller may do
97  * whatever they want.
98  */
99  GtkWidget * gnc_query_view_new (GList *param_list, Query *query);
100 
101  void gnc_query_view_construct (GNCQueryView *qview, GList *param_list, Query *query);
102 
103  void gnc_query_view_reset_query (GNCQueryView *view, Query *query);
104 
105  void gnc_query_view_set_numerics (GNCQueryView *qview, gboolean abs, gboolean inv_sort);
106 
107  gint gnc_query_view_get_num_entries (GNCQueryView *qview);
108 
109  gpointer gnc_query_view_get_selected_entry (GNCQueryView *qview);
110 
111  GList * gnc_query_view_get_selected_entry_list (GNCQueryView *qview);
112 
113  void gnc_query_view_refresh (GNCQueryView *qview);
114 
115  void gnc_query_view_unselect_all (GNCQueryView *qview);
116 
117  gboolean gnc_query_view_item_in_view (GNCQueryView *qview, gpointer item);
118 
119  void gnc_query_sort_order (GNCQueryView *qview, gint column, GtkSortType order);
120 
121 #ifdef __cplusplus
122 }
123 #endif /* __cplusplus */
124 
125 #endif /* GNC_QUERY_VIEW_H */