You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

133 rivejä
7.6 KiB

  1. /* gtkentrycompletion.h
  2. * Copyright (C) 2003 Kristian Rietveld <kris@gtk.org>
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 02111-1307, USA.
  18. */
  19. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  20. #error "Only <gtk/gtk.h> can be included directly."
  21. #endif
  22. #ifndef __GTK_ENTRY_COMPLETION_H__
  23. #define __GTK_ENTRY_COMPLETION_H__
  24. #include <gtk/gtktreemodel.h>
  25. #include <gtk/gtkliststore.h>
  26. #include <gtk/gtktreeviewcolumn.h>
  27. #include <gtk/gtktreemodelfilter.h>
  28. G_BEGIN_DECLS
  29. #define GTK_TYPE_ENTRY_COMPLETION (gtk_entry_completion_get_type ())
  30. #define GTK_ENTRY_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletion))
  31. #define GTK_ENTRY_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionClass))
  32. #define GTK_IS_ENTRY_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY_COMPLETION))
  33. #define GTK_IS_ENTRY_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY_COMPLETION))
  34. #define GTK_ENTRY_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionClass))
  35. typedef struct _GtkEntryCompletion GtkEntryCompletion;
  36. typedef struct _GtkEntryCompletionClass GtkEntryCompletionClass;
  37. typedef struct _GtkEntryCompletionPrivate GtkEntryCompletionPrivate;
  38. typedef gboolean (* GtkEntryCompletionMatchFunc) (GtkEntryCompletion *completion,
  39. const gchar *key,
  40. GtkTreeIter *iter,
  41. gpointer user_data);
  42. struct _GtkEntryCompletion
  43. {
  44. GObject parent_instance;
  45. /*< private >*/
  46. GtkEntryCompletionPrivate *GSEAL (priv);
  47. };
  48. struct _GtkEntryCompletionClass
  49. {
  50. GObjectClass parent_class;
  51. gboolean (* match_selected) (GtkEntryCompletion *completion,
  52. GtkTreeModel *model,
  53. GtkTreeIter *iter);
  54. void (* action_activated) (GtkEntryCompletion *completion,
  55. gint index_);
  56. gboolean (* insert_prefix) (GtkEntryCompletion *completion,
  57. const gchar *prefix);
  58. gboolean (* cursor_on_match) (GtkEntryCompletion *completion,
  59. GtkTreeModel *model,
  60. GtkTreeIter *iter);
  61. /* Padding for future expansion */
  62. void (*_gtk_reserved0) (void);
  63. void (*_gtk_reserved1) (void);
  64. };
  65. /* core */
  66. GType gtk_entry_completion_get_type (void) G_GNUC_CONST;
  67. GtkEntryCompletion *gtk_entry_completion_new (void);
  68. GtkWidget *gtk_entry_completion_get_entry (GtkEntryCompletion *completion);
  69. void gtk_entry_completion_set_model (GtkEntryCompletion *completion,
  70. GtkTreeModel *model);
  71. GtkTreeModel *gtk_entry_completion_get_model (GtkEntryCompletion *completion);
  72. void gtk_entry_completion_set_match_func (GtkEntryCompletion *completion,
  73. GtkEntryCompletionMatchFunc func,
  74. gpointer func_data,
  75. GDestroyNotify func_notify);
  76. void gtk_entry_completion_set_minimum_key_length (GtkEntryCompletion *completion,
  77. gint length);
  78. gint gtk_entry_completion_get_minimum_key_length (GtkEntryCompletion *completion);
  79. void gtk_entry_completion_complete (GtkEntryCompletion *completion);
  80. void gtk_entry_completion_insert_prefix (GtkEntryCompletion *completion);
  81. void gtk_entry_completion_insert_action_text (GtkEntryCompletion *completion,
  82. gint index_,
  83. const gchar *text);
  84. void gtk_entry_completion_insert_action_markup (GtkEntryCompletion *completion,
  85. gint index_,
  86. const gchar *markup);
  87. void gtk_entry_completion_delete_action (GtkEntryCompletion *completion,
  88. gint index_);
  89. void gtk_entry_completion_set_inline_completion (GtkEntryCompletion *completion,
  90. gboolean inline_completion);
  91. gboolean gtk_entry_completion_get_inline_completion (GtkEntryCompletion *completion);
  92. void gtk_entry_completion_set_inline_selection (GtkEntryCompletion *completion,
  93. gboolean inline_selection);
  94. gboolean gtk_entry_completion_get_inline_selection (GtkEntryCompletion *completion);
  95. void gtk_entry_completion_set_popup_completion (GtkEntryCompletion *completion,
  96. gboolean popup_completion);
  97. gboolean gtk_entry_completion_get_popup_completion (GtkEntryCompletion *completion);
  98. void gtk_entry_completion_set_popup_set_width (GtkEntryCompletion *completion,
  99. gboolean popup_set_width);
  100. gboolean gtk_entry_completion_get_popup_set_width (GtkEntryCompletion *completion);
  101. void gtk_entry_completion_set_popup_single_match (GtkEntryCompletion *completion,
  102. gboolean popup_single_match);
  103. gboolean gtk_entry_completion_get_popup_single_match (GtkEntryCompletion *completion);
  104. const gchar *gtk_entry_completion_get_completion_prefix (GtkEntryCompletion *completion);
  105. /* convenience */
  106. void gtk_entry_completion_set_text_column (GtkEntryCompletion *completion,
  107. gint column);
  108. gint gtk_entry_completion_get_text_column (GtkEntryCompletion *completion);
  109. G_END_DECLS
  110. #endif /* __GTK_ENTRY_COMPLETION_H__ */