]> git.0d.be Git - empathy.git/blob - tp-account-widgets/tpaw-live-search.h
0772d9d917dda8cd4f921ab058d664fb72ea33e2
[empathy.git] / tp-account-widgets / tpaw-live-search.h
1 /*
2  * Copyright (C) 2010 Collabora Ltd.
3  * Copyright (C) 2007-2010 Nokia Corporation.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  * Authors: Felix Kaser <felix.kaser@collabora.co.uk>
20  *          Xavier Claessens <xavier.claessens@collabora.co.uk>
21  *          Claudio Saavedra <csaavedra@igalia.com>
22  */
23
24 #ifndef __TPAW_LIVE_SEARCH_H__
25 #define __TPAW_LIVE_SEARCH_H__
26
27 #include <gtk/gtk.h>
28
29 G_BEGIN_DECLS
30
31 #define TPAW_TYPE_LIVE_SEARCH         (tpaw_live_search_get_type ())
32 #define TPAW_LIVE_SEARCH(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TPAW_TYPE_LIVE_SEARCH, TpawLiveSearch))
33 #define TPAW_LIVE_SEARCH_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), TPAW_TYPE_LIVE_SEARCH, TpawLiveSearchClass))
34 #define TPAW_IS_LIVE_SEARCH(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TPAW_TYPE_LIVE_SEARCH))
35 #define TPAW_IS_LIVE_SEARCH_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), TPAW_TYPE_LIVE_SEARCH))
36 #define TPAW_LIVE_SEARCH_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TPAW_TYPE_LIVE_SEARCH, TpawLiveSearchClass))
37
38 typedef struct _TpawLiveSearch      TpawLiveSearch;
39 typedef struct _TpawLiveSearchPriv  TpawLiveSearchPriv;
40 typedef struct _TpawLiveSearchClass TpawLiveSearchClass;
41
42 struct _TpawLiveSearch {
43   GtkHBox parent;
44
45   /*<private>*/
46   TpawLiveSearchPriv *priv;
47 };
48
49 struct _TpawLiveSearchClass {
50   GtkHBoxClass parent_class;
51 };
52
53 GType tpaw_live_search_get_type (void) G_GNUC_CONST;
54 GtkWidget *tpaw_live_search_new (GtkWidget *hook);
55
56 GtkWidget *tpaw_live_search_get_hook_widget (TpawLiveSearch *self);
57 void tpaw_live_search_set_hook_widget (TpawLiveSearch *self,
58     GtkWidget *hook);
59
60 const gchar *tpaw_live_search_get_text (TpawLiveSearch *self);
61 void tpaw_live_search_set_text (TpawLiveSearch *self,
62     const gchar *text);
63
64 gboolean tpaw_live_search_match (TpawLiveSearch *self,
65     const gchar *string);
66
67 GPtrArray * tpaw_live_search_strip_utf8_string (const gchar *string);
68
69 gboolean tpaw_live_search_match_words (const gchar *string,
70     GPtrArray *words);
71
72 GPtrArray * tpaw_live_search_get_words (TpawLiveSearch *self);
73
74 /* Made public for unit tests */
75 gboolean tpaw_live_search_match_string (const gchar *string,
76    const gchar *prefix);
77
78 G_END_DECLS
79
80 #endif /* __TPAW_LIVE_SEARCH_H__ */