1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
4 * Copyright (C) Naba Kumar 2010 <naba@gnome.org>
6 * anjuta is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * anjuta is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 * See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _SYMBOL_DB_MODEL_H_
21 #define _SYMBOL_DB_MODEL_H_
23 #include <glib-object.h>
25 #include <libgda/gda-data-model.h>
26 #include "symbol-db-engine.h"
30 #define SYMBOL_DB_TYPE_MODEL (sdb_model_get_type ())
31 #define SYMBOL_DB_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYMBOL_DB_TYPE_MODEL, SymbolDBModel))
32 #define SYMBOL_DB_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYMBOL_DB_TYPE_MODEL, SymbolDBModelClass))
33 #define SYMBOL_DB_IS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYMBOL_DB_TYPE_MODEL))
34 #define SYMBOL_DB_IS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYMBOL_DB_TYPE_MODEL))
35 #define SYMBOL_DB_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYMBOL_DB_TYPE_MODEL, SymbolDBModelClass))
37 typedef struct _SymbolDBModelClass SymbolDBModelClass
;
38 typedef struct _SymbolDBModel SymbolDBModel
;
39 typedef struct _SymbolDBModelPriv SymbolDBModelPriv
;
41 struct _SymbolDBModelClass
43 GObjectClass parent_class
;
46 gboolean (*get_query_value
) (SymbolDBModel
*model
,
47 GdaDataModel
*data_model
,
48 GdaDataModelIter
*iter
, gint column
,
51 gboolean (*get_query_value_at
) (SymbolDBModel
*model
,
52 GdaDataModel
*data_model
, gint position
,
53 gint column
, GValue
*value
);
55 /* Pure virtual methods; alternatives to signals */
57 gboolean (*get_has_child
) (SymbolDBModel
*model
, gint tree_level
,
58 GValue column_values
[]);
60 gint (*get_n_children
) (SymbolDBModel
*model
, gint tree_level
,
61 GValue column_values
[]);
63 GdaDataModel
* (*get_children
) (SymbolDBModel
*model
, gint tree_level
,
64 GValue column_values
[],
65 gint offset
, gint limit
);
70 GObject parent_instance
;
72 SymbolDBModelPriv
*priv
;
75 GType
sdb_model_get_type (void) G_GNUC_CONST
;
77 /* Use this to create the model normally. The "..." part is alternatively GType
78 * and gint for column type and corresponding GdaDataModel column.
80 GtkTreeModel
* symbol_db_model_new (gint n_columns
, ...);
82 /* Normally used by bindings */
83 GtkTreeModel
* symbol_db_model_newv (gint n_columns
, GType
*types
,
86 /* Used by derived classes */
87 void symbol_db_model_set_columns (SymbolDBModel
*model
, gint n_columns
,
88 GType
*types
, gint
*data_cols
);
90 void symbol_db_model_update (SymbolDBModel
*model
);
91 void symbol_db_model_freeze (SymbolDBModel
*model
);
92 void symbol_db_model_thaw (SymbolDBModel
*model
);
96 #endif /* _SYMBOL_DB_MODEL_H_ */