aboutsummaryrefslogtreecommitdiff
path: root/hildon/hildon-live-search.h
blob: 501c178895d2d425872cc54f4810ecf572d02733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
 * This file is a part of hildon
 *
 * Copyright (C) 2007-2009 Nokia Corporation. All rights reserved.
 *
 * Based in OssoABookLiveSearch, OSSO Address Book.
 * Author: Joergen Scheibengruber <jorgen.scheibengruber@nokia.com>
 * Hildon version: Claudio Saavedra <csaavedra@igalia.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser Public License as published by
 * the Free Software Foundation; version 2 of the license.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser Public License for more details.
 *
 */

#ifndef                                         __HILDON_LIVE_SEARCH__
#define                                         __HILDON_LIVE_SEARCH__

#include                                       <gtk/gtk.h>

G_BEGIN_DECLS

#define                                         HILDON_TYPE_LIVE_SEARCH             \
                                                (hildon_live_search_get_type())

#define                                         HILDON_LIVE_SEARCH(obj)             \
                                                (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
                                                HILDON_TYPE_LIVE_SEARCH,            \
                                                HildonLiveSearch))

#define                                         HILDON_LIVE_SEARCH_CLASS(klass)     \
                                                (G_TYPE_CHECK_CLASS_CAST ((klass),  \
                                                HILDON_TYPE_LIVE_SEARCH,            \
                                                HildonLiveSearchClass))

#define                                         HILDON_IS_LIVE_SEARCH(obj)          \
                                                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
                                                HILDON_TYPE_LIVE_SEARCH))

#define                                         HILDON_IS_LIVE_SEARCH_CLASS(klass)  \
                                                (G_TYPE_CHECK_CLASS_TYPE ((klass),  \
                                                HILDON_TYPE_LIVE_SEARCH))

#define                                         HILDON_LIVE_SEARCH_GET_CLASS(obj)   \
                                                (G_TYPE_INSTANCE_GET_CLASS ((obj),  \
                                                HILDON_TYPE_LIVE_SEARCH, \
                                                HildonLiveSearchClass))


typedef struct                                  _HildonLiveSearch HildonLiveSearch;

typedef struct                                  _HildonLiveSearchClass HildonLiveSearchClass;

typedef struct                                  _HildonLiveSearchPrivate HildonLiveSearchPrivate;

struct                                          _HildonLiveSearch
{
    /*< private >*/
    GtkToolbar parent;
    HildonLiveSearchPrivate *priv;
};

struct                                          _HildonLiveSearchClass
{
    GtkToolbarClass parent_class;
};

GType
hildon_live_search_get_type                     (void);

GtkWidget *
hildon_live_search_new                          (void);

void
hildon_live_search_append_text                  (HildonLiveSearch *livesearch,
                                                 const char       *text);

const char *
hildon_live_search_get_text                     (HildonLiveSearch *livesearch);

void
hildon_live_search_set_text                     (HildonLiveSearch *livesearch,
                                                 const char       *text);

void
hildon_live_search_set_filter                   (HildonLiveSearch   *livesearch,
                                                 GtkTreeModelFilter *filter);

GtkTreeModelFilter *
hildon_live_search_get_filter                   (HildonLiveSearch   *livesearch);

void
hildon_live_search_widget_hook                  (HildonLiveSearch *livesearch,
                                                 GtkWidget        *hook_widget,
                                                 GtkWidget        *kb_focus);

void
hildon_live_search_widget_unhook                (HildonLiveSearch *livesearch);

void
hildon_live_search_save_state                   (HildonLiveSearch *livesearch,
                                                 GKeyFile         *key_file);

void
hildon_live_search_restore_state                (HildonLiveSearch *livesearch,
                                                 GKeyFile         *key_file);

void
hildon_live_search_set_text_column              (HildonLiveSearch *livesearch,
                                                 gint              text_column);



/**
 * HildonLiveSearchVisibleFunc:
 * @model: The child model of the #GtkTreeModelFilter in the live search widget
 * @iter: a #GtkTreeIter pointing to the row in @model whose visibility is to be determined
 * @text: the text in the @HildonLiveSearch entry that is triggering this method call
 * @data: user data given to hildon_live_search_set_visible_func()
 *
 * Returns: whether the row indicated by @iter should be visible
 *
 * Since: 2.2.4
 **/
typedef gboolean (* HildonLiveSearchVisibleFunc) (GtkTreeModel *model,
                                                  GtkTreeIter  *iter,
                                                  gchar        *text,
                                                  gpointer      data);

void
hildon_live_search_set_visible_func              (HildonLiveSearch           *livesearch,
                                                  HildonLiveSearchVisibleFunc func,
                                                  gpointer                    data,
                                                  GDestroyNotify              destroy);

void
hildon_live_search_clean_selection_map           (HildonLiveSearch * livesearch);

G_END_DECLS

#endif                                          /* __HILDON_LIVE_SEARCH__ */