1
/*
2
 * This file is a part of hildon
3
 *
4
 * Copyright (C) 2007-2009 Nokia Corporation. All rights reserved.
5
 *
6
 * Based in OssoABookLiveSearch, OSSO Address Book.
7
 * Author: Joergen Scheibengruber <jorgen.scheibengruber@nokia.com>
8
 * Hildon version: Claudio Saavedra <csaavedra@igalia.com>
9
 *
10
 * This program is free software; you can redistribute it and/or modify
11
 * it under the terms of the GNU Lesser Public License as published by
12
 * the Free Software Foundation; version 2 of the license.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Lesser Public License for more details.
18
 *
19
 */
20
21
#ifndef                                         __HILDON_LIVE_SEARCH__
22
#define                                         __HILDON_LIVE_SEARCH__
23
24
#include                                       <gtk/gtk.h>
25
26
G_BEGIN_DECLS
27
28
#define                                         HILDON_TYPE_LIVE_SEARCH             \
29
                                                (hildon_live_search_get_type())
30
31
#define                                         HILDON_LIVE_SEARCH(obj)             \
32
                                                (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
33
                                                HILDON_TYPE_LIVE_SEARCH,            \
34
                                                HildonLiveSearch))
35
36
#define                                         HILDON_LIVE_SEARCH_CLASS(klass)     \
37
                                                (G_TYPE_CHECK_CLASS_CAST ((klass),  \
38
                                                HILDON_TYPE_LIVE_SEARCH,            \
39
                                                HildonLiveSearchClass))
40
41
#define                                         HILDON_IS_LIVE_SEARCH(obj)          \
42
                                                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
43
                                                HILDON_TYPE_LIVE_SEARCH))
44
45
#define                                         HILDON_IS_LIVE_SEARCH_CLASS(klass)  \
46
                                                (G_TYPE_CHECK_CLASS_TYPE ((klass),  \
47
                                                HILDON_TYPE_LIVE_SEARCH))
48
49
#define                                         HILDON_LIVE_SEARCH_GET_CLASS(obj)   \
50
                                                (G_TYPE_INSTANCE_GET_CLASS ((obj),  \
51
                                                HILDON_TYPE_LIVE_SEARCH, \
52
                                                HildonLiveSearchClass))
53
54
55
typedef struct                                  _HildonLiveSearch HildonLiveSearch;
56
57
typedef struct                                  _HildonLiveSearchClass HildonLiveSearchClass;
58
59
typedef struct                                  _HildonLiveSearchPrivate HildonLiveSearchPrivate;
60
61
struct                                          _HildonLiveSearch
62
{
63
    /*< private >*/
64
    GtkToolbar parent;
65
    HildonLiveSearchPrivate *priv;
66
};
67
68
struct                                          _HildonLiveSearchClass
69
{
70
    GtkToolbarClass parent_class;
71
};
72
73
GType
74
hildon_live_search_get_type                     (void);
75
76
GtkWidget *
77
hildon_live_search_new                          (void);
78
79
void
80
hildon_live_search_append_text                  (HildonLiveSearch *livesearch,
81
                                                 const char       *text);
82
83
const char *
84
hildon_live_search_get_text                     (HildonLiveSearch *livesearch);
85
86
void
87
hildon_live_search_set_text                     (HildonLiveSearch *livesearch,
88
                                                 const char       *text);
89
90
void
91
hildon_live_search_set_filter                   (HildonLiveSearch   *livesearch,
92
                                                 GtkTreeModelFilter *filter);
93
94
GtkTreeModelFilter *
95
hildon_live_search_get_filter                   (HildonLiveSearch   *livesearch);
96
97
void
98
hildon_live_search_widget_hook                  (HildonLiveSearch *livesearch,
99
                                                 GtkWidget        *hook_widget,
100
                                                 GtkWidget        *kb_focus);
101
102
void
103
hildon_live_search_widget_unhook                (HildonLiveSearch *livesearch);
104
105
void
106
hildon_live_search_save_state                   (HildonLiveSearch *livesearch,
107
                                                 GKeyFile         *key_file);
108
109
void
110
hildon_live_search_restore_state                (HildonLiveSearch *livesearch,
111
                                                 GKeyFile         *key_file);
112
113
void
114
hildon_live_search_set_text_column              (HildonLiveSearch *livesearch,
115
                                                 gint              text_column);
116
117
118
119
/**
120
 * HildonLiveSearchVisibleFunc:
121
 * @model: The child model of the #GtkTreeModelFilter in the live search widget
122
 * @iter: a #GtkTreeIter pointing to the row in @model whose visibility is to be determined
123
 * @text: the text in the @HildonLiveSearch entry that is triggering this method call
124
 * @data: user data given to hildon_live_search_set_visible_func()
125
 *
126
 * Returns: whether the row indicated by @iter should be visible
127
 *
128
 * Since: 2.2.5
129
 **/
130
typedef gboolean (* HildonLiveSearchVisibleFunc) (GtkTreeModel *model,
131
                                                  GtkTreeIter  *iter,
132
                                                  gchar        *text,
133
                                                  gpointer      data);
134
135
void
136
hildon_live_search_set_visible_func              (HildonLiveSearch           *livesearch,
137
                                                  HildonLiveSearchVisibleFunc func,
138
                                                  gpointer                    data,
139
                                                  GDestroyNotify              destroy);
140
141
void
142
hildon_live_search_clean_selection_map           (HildonLiveSearch * livesearch);
143
144
G_END_DECLS
145
146
#endif                                          /* __HILDON_LIVE_SEARCH__ */