Commit edef7d00 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

Landing GtkTreeModelFilter and the completion code. (Test program and

Fri Jul 11 14:32:43 2003  Kristian Rietveld  <kris@gtk.org>

	Landing GtkTreeModelFilter and the completion code. (Test program
	and documentation will follow next week).

	* gtk/gtkcellayout.[ch], gtk/gtkentrycompletion.[ch],
	gtk/gtktreemodelfilter.[ch], gtk/gtkentryprivate.h: new files.

	* gtkentry.[ch]: added gtk_entry_{get,set}_completion, wrote
	necessary code to hook up completion.

	* gtktreeviewcolumn.c: made GtkTreeViewColumn implement the new
	GtkCellLayout interface.

	* gtkmarshalers.list: added BOOLEAN:OBJECT,BOXED.

	* gtk/gtk.h, gtk/Makefile.am, po/POTFILES.in: all updated for the new
	source files.
parent 8aafd6bb
......@@ -102,6 +102,7 @@ gtk_public_h_sources = \
gtkbutton.h \
gtkcalendar.h \
gtkcelleditable.h \
gtkcelllayout.h \
gtkcellrenderer.h \
gtkcellrendererpixbuf.h \
gtkcellrenderertext.h \
......@@ -124,6 +125,7 @@ gtk_public_h_sources = \
gtkdrawingarea.h \
gtkeditable.h \
gtkentry.h \
gtkentrycompletion.h \
gtkenums.h \
gtkeventbox.h \
gtkexpander.h \
......@@ -221,6 +223,7 @@ gtk_public_h_sources = \
gtktreednd.h \
gtktreeitem.h \
gtktreemodel.h \
gtktreemodelfilter.h \
gtktreemodelsort.h \
gtktreeselection.h \
gtktreesortable.h \
......@@ -241,6 +244,7 @@ gtk_public_h_sources = \
# GTK+ header files that don't get installed
gtk_private_h_sources = \
gtkentryprivate.h \
gtkrbtree.h \
gtktextbtree.h \
gtktextchildprivate.h \
......@@ -277,6 +281,7 @@ gtk_c_sources = \
gtkbox.c \
gtkbutton.c \
gtkcalendar.c \
gtkcelllayout.c \
gtkcellrenderer.c \
gtkcelleditable.c \
gtkcellrenderertext.c \
......@@ -299,6 +304,7 @@ gtk_c_sources = \
gtkdrawingarea.c \
gtkeditable.c \
gtkentry.c \
gtkentrycompletion.c \
gtkeventbox.c \
gtkexpander.c \
gtkfilesel.c \
......@@ -403,6 +409,7 @@ gtk_c_sources = \
gtktreedatalist.c \
gtktreednd.c \
gtktreemodel.c \
gtktreemodelfilter.c \
gtktreemodelsort.c \
gtktreeselection.c \
gtktreesortable.c \
......
......@@ -43,6 +43,7 @@
#include <gtk/gtkbox.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkcalendar.h>
#include <gtk/gtkcelllayout.h>
#include <gtk/gtkcellrenderer.h>
#include <gtk/gtkcellrendererpixbuf.h>
#include <gtk/gtkcellrenderertext.h>
......@@ -63,6 +64,7 @@
#include <gtk/gtkdrawingarea.h>
#include <gtk/gtkeditable.h>
#include <gtk/gtkentry.h>
#include <gtk/gtkentrycompletion.h>
#include <gtk/gtkenums.h>
#include <gtk/gtkeventbox.h>
#include <gtk/gtkexpander.h>
......@@ -152,6 +154,7 @@
#include <gtk/gtktreednd.h>
#include <gtk/gtktreeitem.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtktreemodelfilter.h>
#include <gtk/gtktreemodelsort.h>
#include <gtk/gtktreeselection.h>
#include <gtk/gtktreestore.h>
......
/* gtkcelllayout.c
* Copyright (C) 2003 Kristian Rietveld <kris@gtk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gtkcelllayout.h"
GType
gtk_cell_layout_get_type (void)
{
static GType cell_layout_type = 0;
if (! cell_layout_type)
{
static const GTypeInfo cell_layout_info =
{
sizeof (GtkCellLayoutIface),
NULL,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL
};
cell_layout_type =
g_type_register_static (G_TYPE_INTERFACE, "GtkCellLayout",
&cell_layout_info, 0);
g_type_interface_add_prerequisite (cell_layout_type, G_TYPE_OBJECT);
}
return cell_layout_type;
}
void
gtk_cell_layout_pack_start (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gboolean expand)
{
g_return_if_fail (GTK_IS_CELL_LAYOUT (cell_layout));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
(* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->pack_start) (cell_layout,
cell,
expand);
}
void
gtk_cell_layout_pack_end (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gboolean expand)
{
g_return_if_fail (GTK_IS_CELL_LAYOUT (cell_layout));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
(* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->pack_end) (cell_layout,
cell,
expand);
}
void
gtk_cell_layout_clear (GtkCellLayout *cell_layout)
{
g_return_if_fail (GTK_IS_CELL_LAYOUT (cell_layout));
(* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->clear) (cell_layout);
}
static void
gtk_cell_layout_set_attributesv (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
va_list args)
{
gchar *attribute;
gint column;
GtkCellLayoutIface *iface;
attribute = va_arg (args, gchar *);
iface = GTK_CELL_LAYOUT_GET_IFACE (cell_layout);
(* iface->clear_attributes) (cell_layout, cell);
while (attribute != NULL)
{
column = va_arg (args, gint);
(* iface->add_attribute) (cell_layout, cell, attribute, column);
attribute = va_arg (args, gchar *);
}
}
void
gtk_cell_layout_set_attributes (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
...)
{
va_list args;
g_return_if_fail (GTK_IS_CELL_LAYOUT (cell_layout));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
va_start (args, cell);
gtk_cell_layout_set_attributesv (cell_layout, cell, args);
va_end (args);
}
void
gtk_cell_layout_add_attribute (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
const gchar *attribute,
gint column)
{
g_return_if_fail (GTK_IS_CELL_LAYOUT (cell_layout));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
g_return_if_fail (attribute != NULL);
g_return_if_fail (column >= 0);
(* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->add_attribute) (cell_layout,
cell,
attribute,
column);
}
void
gtk_cell_layout_set_cell_data_func (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
GtkCellLayoutDataFunc func,
gpointer func_data,
GDestroyNotify destroy)
{
g_return_if_fail (GTK_IS_CELL_LAYOUT (cell_layout));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
(* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->set_cell_data_func) (cell_layout,
cell,
func,
func_data,
destroy);
}
void
gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
GtkCellRenderer *cell)
{
g_return_if_fail (GTK_IS_CELL_LAYOUT (cell_layout));
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
(* GTK_CELL_LAYOUT_GET_IFACE (cell_layout)->clear_attributes) (cell_layout,
cell);
}
/* gtkcelllayout.h
* Copyright (C) 2003 Kristian Rietveld <kris@gtk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_CELL_LAYOUT_H__
#define __GTK_CELL_LAYOUT_H__
#include <glib-object.h>
#include <gtk/gtkcellrenderer.h>
#include <gtk/gtktreeviewcolumn.h>
G_BEGIN_DECLS
#define GTK_TYPE_CELL_LAYOUT (gtk_cell_layout_get_type ())
#define GTK_CELL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_LAYOUT, GtkCellLayout))
#define GTK_IS_CELL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_LAYOUT))
#define GTK_CELL_LAYOUT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_CELL_LAYOUT, GtkCellLayoutIface))
typedef struct _GtkCellLayout GtkCellLayout; /* dummy typedef */
typedef struct _GtkCellLayoutIface GtkCellLayoutIface;
/* keep in sync with GtkTreeCellDataFunc */
typedef void (* GtkCellLayoutDataFunc) (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
gpointer data);
struct _GtkCellLayoutIface
{
GTypeInterface g_iface;
/* Virtual Table */
void (* pack_start) (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gboolean expand);
void (* pack_end) (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gboolean expand);
void (* clear) (GtkCellLayout *cell_layout);
void (* add_attribute) (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
const gchar *attribute,
gint column);
void (* set_cell_data_func) (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
GtkCellLayoutDataFunc func,
gpointer func_data,
GDestroyNotify destroy);
void (* clear_attributes) (GtkCellLayout *cell_layout,
GtkCellRenderer *cell);
};
GType gtk_cell_layout_get_type (void);
void gtk_cell_layout_pack_start (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gboolean expand);
void gtk_cell_layout_pack_end (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
gboolean expand);
void gtk_cell_layout_clear (GtkCellLayout *cell_layout);
void gtk_cell_layout_set_attributes (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
...);
void gtk_cell_layout_add_attribute (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
const gchar *attribute,
gint column);
void gtk_cell_layout_set_cell_data_func (GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
GtkCellLayoutDataFunc func,
gpointer func_data,
GDestroyNotify destroy);
void gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout,
GtkCellRenderer *cell);
G_END_DECLS
#endif /* __GTK_CELL_LAYOUT_H__ */
......@@ -47,10 +47,17 @@
#include "gtkstock.h"
#include "gtktextutil.h"
#include "gtkwindow.h"
#include "gtktreeview.h"
#include "gtktreeselection.h"
#include "gtkentryprivate.h"
#include "gtkcelllayout.h"
#define GTK_ENTRY_COMPLETION_KEY "gtk-entry-completion-key"
#define MIN_ENTRY_WIDTH 150
#define DRAW_TIMEOUT 20
#define INNER_BORDER 2
#define COMPLETION_TIMEOUT 300
/* Initial size of buffer, in bytes */
#define MIN_SIZE 16
......@@ -936,6 +943,8 @@ gtk_entry_finalize (GObject *object)
{
GtkEntry *entry = GTK_ENTRY (object);
gtk_entry_set_completion (entry, NULL);
if (entry->cached_layout)
g_object_unref (entry->cached_layout);
......@@ -1664,6 +1673,7 @@ gtk_entry_focus_out (GtkWidget *widget,
GdkEventFocus *event)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryCompletion *completion;
gtk_widget_queue_draw (widget);
......@@ -1675,6 +1685,10 @@ gtk_entry_focus_out (GtkWidget *widget,
g_signal_handlers_disconnect_by_func (gdk_keymap_get_for_display (gtk_widget_get_display (widget)),
gtk_entry_keymap_direction_changed,
entry);
completion = gtk_entry_get_completion (entry);
if (completion)
_gtk_entry_completion_popdown (completion);
return FALSE;
}
......@@ -4451,3 +4465,245 @@ gtk_entry_pend_cursor_blink (GtkEntry *entry)
show_cursor (entry);
}
}
/* completion */
static gint
gtk_entry_completion_timeout (gpointer data)
{
GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (data);
GDK_THREADS_ENTER ();
completion->priv->completion_timeout = 0;
if (strlen (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry))) >= completion->priv->minimum_key_length)
{
gint matches;
gint actions;
GtkTreeSelection *s;
gtk_entry_completion_complete (completion);
matches = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view)));
s = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->action_view));
gtk_tree_selection_unselect_all (s);
actions = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->actions), NULL);
if (matches > 0 || actions > 0)
_gtk_entry_completion_popup (completion);
}
GDK_THREADS_LEAVE ();
return FALSE;
}
static gboolean
gtk_entry_completion_key_press (GtkWidget *widget,
GdkEventKey *event,
gpointer user_data)
{
gint matches, actions = 0;
GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (user_data);
if (!GTK_WIDGET_MAPPED (completion->priv->popup_window))
return FALSE;
matches = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
if (completion->priv->actions)
actions = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->actions), NULL);
if (event->keyval == GDK_Up || event->keyval == GDK_Down)
{
GtkTreePath *path = NULL;
if (event->keyval == GDK_Up)
{
completion->priv->current_selected--;
if (completion->priv->current_selected < 0)
completion->priv->current_selected = 0;
}
else
{
completion->priv->current_selected++;
if (completion->priv->current_selected >= matches + actions)
completion->priv->current_selected = 0;
}
if (completion->priv->current_selected < matches)
{
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->action_view)));
path = gtk_tree_path_new_from_indices (completion->priv->current_selected, -1);
gtk_tree_view_set_cursor (GTK_TREE_VIEW (completion->priv->tree_view),
path, NULL, FALSE);
}
else if (completion->priv->current_selected - matches >= 0)
{
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view)));
path = gtk_tree_path_new_from_indices (completion->priv->current_selected - matches, -1);
gtk_tree_view_set_cursor (GTK_TREE_VIEW (completion->priv->action_view),
path, NULL, FALSE);
}
gtk_tree_path_free (path);
return TRUE;
}
else if (event->keyval == GDK_ISO_Enter ||
event->keyval == GDK_Return ||
event->keyval == GDK_Escape)
{
_gtk_entry_completion_popdown (completion);
if (event->keyval == GDK_Escape)
return TRUE;
if (completion->priv->current_selected < matches)
{
GtkTreeIter iter;
GtkTreeModel *model = NULL;
GtkTreeSelection *sel;
gboolean entry_set;
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view));
gtk_tree_selection_get_selected (sel, &model, &iter);
g_signal_emit_by_name (completion, "match_selected",
model, &iter, &entry_set);
if (!entry_set)
{
gchar *str = NULL;
gtk_tree_model_get (model, &iter,
completion->priv->text_column, &str,
-1);
g_signal_handler_block (widget, completion->priv->changed_id);
gtk_entry_set_text (GTK_ENTRY (widget), str);
g_signal_handler_unblock (widget, completion->priv->changed_id);
/* move the cursor to the end */
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
g_free (str);
}
return TRUE;
}
else if (completion->priv->current_selected - matches >= 0)
{
GtkTreePath *path;
path = gtk_tree_path_new_from_indices (completion->priv->current_selected - matches, -1);
g_signal_emit_by_name (completion, "action_activated",
gtk_tree_path_get_indices (path)[0]);
gtk_tree_path_free (path);
}
}
return FALSE;
}
static void
gtk_entry_completion_changed (GtkWidget *entry,
gpointer user_data)
{
GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (user_data);
if (GTK_WIDGET_MAPPED (completion->priv->popup_window))
_gtk_entry_completion_popdown (completion);
/* (re)install completion timeout */
if (completion->priv->completion_timeout)
g_source_remove (completion->priv->completion_timeout);
if (!gtk_entry_get_text (GTK_ENTRY (entry)))
return;
/* no need to normalize for this test */
if (! strcmp ("", gtk_entry_get_text (GTK_ENTRY (entry))))
return;
completion->priv->completion_timeout =
g_timeout_add (COMPLETION_TIMEOUT,
gtk_entry_completion_timeout,
completion);
}
void
gtk_entry_set_completion (GtkEntry *entry,
GtkEntryCompletion *completion)
{
GtkEntryCompletion *old;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (!completion || GTK_IS_ENTRY_COMPLETION (completion));
old = gtk_entry_get_completion (entry);
if (old)
{
if (old->priv->completion_timeout)
{
g_source_remove (old->priv->completion_timeout);
old->priv->completion_timeout = 0;
}
if (GTK_WIDGET_MAPPED (old->priv->popup_window))
_gtk_entry_completion_popdown (old);
gtk_cell_layout_clear (GTK_CELL_LAYOUT (old));
old->priv->text_column = -1;
if (g_signal_handler_is_connected (entry, old->priv->changed_id))
g_signal_handler_disconnect (entry, old->priv->changed_id);
if (g_signal_handler_is_connected (entry, old->priv->key_press_id))
g_signal_handler_disconnect (entry, old->priv->key_press_id);
old->priv->entry = NULL;
g_object_unref (old);
}
if (!completion)
{
g_object_set_data (G_OBJECT (entry), GTK_ENTRY_COMPLETION_KEY, NULL);
return;
}
/* hook into the entry */
g_object_ref (completion);
completion->priv->changed_id =
g_signal_connect (entry, "changed",
G_CALLBACK (gtk_entry_completion_changed), completion);
completion->priv->key_press_id =
g_signal_connect (entry, "key_press_event",
G_CALLBACK (gtk_entry_completion_key_press), completion);
completion->priv->entry = GTK_WIDGET (entry);
g_object_set_data (G_OBJECT (entry), GTK_ENTRY_COMPLETION_KEY, completion);
}
GtkEntryCompletion *
gtk_entry_get_completion (GtkEntry *entry)
{
GtkEntryCompletion *completion;
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
completion = GTK_ENTRY_COMPLETION (g_object_get_data (G_OBJECT (entry),
GTK_ENTRY_COMPLETION_KEY));
return completion;
}
......@@ -32,6 +32,7 @@
#include <gtk/gtkeditable.h>
#include <gtk/gtkimcontext.h>
#include <gtk/gtkmenu.h>
#include <gtk/gtkentrycompletion.h>
#include <pango/pango.h>
#ifdef __cplusplus
......@@ -182,6 +183,10 @@ void gtk_entry_get_layout_offsets (GtkEntry *entry,
gint *x,
gint *y);
void gtk_entry_set_completion (GtkEntry *entry,
GtkEntryCompletion *completion);
GtkEntryCompletion *gtk_entry_get_completion (GtkEntry *entry);
/* Deprecated compatibility functions
*/
......
This diff is collapsed.
/* gtkentrycompletion.h
* Copyright (C) 2003 Kristian Rietveld <kris@gtk.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_ENTRY_COMPLETION_H__
#define __GTK_ENTRY_COMPLETION_H__
#include <glib-object.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtkliststore.h>
#include <gtk/gtktreeviewcolumn.h>
#include <gtk/gtktreemodelfilter.h>
G_BEGIN_DECLS
#define GTK_TYPE_ENTRY_COMPLETION (gtk_entry_completion_get_type ())
#define GTK_ENTRY_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletion))
#define GTK_ENTRY_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionClass))
#define GTK_IS_ENTRY_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY_COMPLETION))
#define GTK_IS_ENTRY_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY_COMPLETION))
#define GTK_ENTRY_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionClass))
#define GTK_ENTRY_COMPLETION_GET_PRIVATE(obj)(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionPrivate))
typedef struct _GtkEntryCompletion GtkEntryCompletion;
typedef struct _GtkEntryCompletionClass GtkEntryCompletionClass;
typedef struct _GtkEntryCompletionPrivate GtkEntryCompletionPrivate;
typedef gboolean (* GtkEntryCompletionMatchFunc) (GtkEntryCompletion *completion,
const gchar *key,
GtkTreeIter *iter,
gpointer user_data);
struct _GtkEntryCompletion
{
GObject parent_instance;
/*< private >*/
GtkEntryCompletionPrivate *priv;
};
struct _GtkEntryCompletionClass
{
GObjectClass parent_class;
gboolean (* match_selected) (GtkEntryCompletion *completion,
GtkTreeModel *model,
GtkTreeIter *iter);
void (* action_activated) (GtkEntryCompletion *completion,
gint index);
};
/* core */
GType gtk_entry_completion_get_type (void);
GtkEntryCompletion *gtk_entry_completion_new (void);
GtkWidget *gtk_entry_completion_get_entry (GtkEntryCompletion *entry);
void gtk_entry_completion_set_model (GtkEntryCompletion *completion,
GtkTreeModel *model);
GtkTreeModel *gtk_entry_completion_get_model (GtkEntryCompletion *completion);
void gtk_entry_completion_set_match_func (GtkEntryCompletion *completion,
GtkEntryCompletionMatchFunc func,
gpointer func_data,
GDestroyNotify func_notify);
void gtk_entry_completion_set_minimum_key_length (GtkEntryCompletion *completion,
gint length);
gint gtk_entry_completion_get_minimum_key_length (GtkEntryCompletion *completion);
void gtk_entry_completion_complete (GtkEntryCompletion *completion);
void gtk_entry_completion_insert_action_text (GtkEntryCompletion *completion,
gint index,
gchar *text);
void gtk_entry_completion_insert_action_markup (GtkEntryCompletion *completion,
gint index,
gchar *markup);
void gtk_entry_completion_delete_action (GtkEntryCompletion *completion,
gint index);
/* convenience */