GnuCash 2.4.99
gnc-query-list.h
00001 /********************************************************************\
00002  * gnc-query-list.h -- GnuCash GNOME query display list widget      *
00003  * Copyright (C) 2003 Derek Atkins <derek@ihtfp.com>                *
00004  *                                                                  *
00005  * This program is free software; you can redistribute it and/or    *
00006  * modify it under the terms of the GNU General Public License as   *
00007  * published by the Free Software Foundation; either version 2 of   *
00008  * the License, or (at your option) any later version.              *
00009  *                                                                  *
00010  * This program is distributed in the hope that it will be useful,  *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00013  * GNU General Public License for more details.                     *
00014  *                                                                  *
00015  * You should have received a copy of the GNU General Public License*
00016  * along with this program; if not, contact:                        *
00017  *                                                                  *
00018  * Free Software Foundation           Voice:  +1-617-542-5942       *
00019  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
00020  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
00021 \********************************************************************/
00022 
00023 #ifndef GNC_QUERY_LIST_H
00024 #define GNC_QUERY_LIST_H
00025 
00026 #include <gtk/gtk.h>
00027 
00028 #include "Query.h"
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif                          /* __cplusplus */
00033 
00034 #define GNC_TYPE_QUERY_LIST (gnc_query_list_get_type ())
00035 #define GNC_QUERY_LIST(obj) (GTK_CHECK_CAST ((obj), GNC_TYPE_QUERY_LIST, GNCQueryList))
00036 #define GNC_QUERY_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNC_TYPE_QUERY_LIST, GNCQueryListClass))
00037 #define IS_GNC_QUERY_LIST(obj) (GTK_CHECK_TYPE ((obj), GNC_TYPE_QUERY_LIST))
00038 #define IS_GNC_QUERY_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNC_TYPE_QUERY_LIST))
00039 
00040     typedef struct _GNCQueryList      GNCQueryList;
00041     typedef struct _GNCQueryListClass GNCQueryListClass;
00042 
00043     struct _GNCQueryList
00044     {
00045         GtkCList clist;
00046 
00047         /* Query information */
00048         Query *query;
00049         gboolean no_toggle;
00050         gboolean always_unselect;
00051         gint current_row;
00052         gint num_entries;
00053         gpointer current_entry;
00054 
00055         /* Column information */
00056         gint num_columns;
00057         GList *column_params;
00058 
00059         /* numeric information */
00060         gboolean numeric_abs;
00061         gboolean numeric_inv_sort;
00062 
00063         /* Sorting info */
00064         gint sort_column;
00065         gboolean increasing;
00066         GtkWidget **title_arrows;
00067 
00068         /* Column resizing */
00069         gint prev_allocation;
00070         gint *title_widths;
00071     };
00072 
00073     struct _GNCQueryListClass
00074     {
00075         GtkCListClass clist_class;
00076 
00077         void (*line_toggled) (GNCQueryList *list, gpointer entry);
00078         void (*double_click_entry) (GNCQueryList *list, gpointer entry);
00079     };
00080 
00081     /***********************************************************
00082      *                public functions                         *
00083      ***********************************************************/
00084 
00085     GType gnc_query_list_get_type (void);
00086 
00087     /* The param_list remains owned by the caller but is used by the
00088      * query-list; do not destroy it until you destroy this query-list.
00089      * The query will be copied by the query-list so the caller may do
00090      * whatever they want.
00091      */
00092     GtkWidget * gnc_query_list_new (GList *param_list, Query *query);
00093     void gnc_query_list_construct (GNCQueryList *list, GList *param_list, Query *query);
00094     void gnc_query_list_reset_query (GNCQueryList *list, Query *query);
00095 
00096     void gnc_query_list_set_numerics (GNCQueryList *list, gboolean abs, gboolean inv_sort);
00097 
00098     gint gnc_query_list_get_needed_height(GNCQueryList *list, gint num_rows);
00099 
00100     gint gnc_query_list_get_num_entries(GNCQueryList *list);
00101 
00102     gpointer gnc_query_list_get_current_entry(GNCQueryList *list);
00103 
00104     void gnc_query_list_refresh (GNCQueryList *list);
00105 
00106     void gnc_query_list_unselect_all(GNCQueryList *list);
00107 
00108     gboolean gnc_query_list_item_in_list (GNCQueryList *list, gpointer item);
00109 
00110     void gnc_query_list_refresh_item (GNCQueryList *list, gpointer item);
00111 
00112 #ifdef __cplusplus
00113 }
00114 #endif /* __cplusplus */
00115 
00116 #endif /* GNC_QUERY_LIST_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines