Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

192 řádky
7.9 KiB

  1. /* GTK - The GIMP Toolkit
  2. * gtkrecentchooser.h - Abstract interface for recent file selectors GUIs
  3. *
  4. * Copyright (C) 2006, Emmanuele Bassi
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  22. #error "Only <gtk/gtk.h> can be included directly."
  23. #endif
  24. #ifndef __GTK_RECENT_CHOOSER_H__
  25. #define __GTK_RECENT_CHOOSER_H__
  26. #include <gtk/gtkwidget.h>
  27. #include <gtk/gtkrecentmanager.h>
  28. #include <gtk/gtkrecentfilter.h>
  29. G_BEGIN_DECLS
  30. #define GTK_TYPE_RECENT_CHOOSER (gtk_recent_chooser_get_type ())
  31. #define GTK_RECENT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RECENT_CHOOSER, GtkRecentChooser))
  32. #define GTK_IS_RECENT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RECENT_CHOOSER))
  33. #define GTK_RECENT_CHOOSER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_RECENT_CHOOSER, GtkRecentChooserIface))
  34. /**
  35. * GtkRecentSortType:
  36. * @GTK_RECENT_SORT_NONE: Do not sort the returned list of recently used
  37. * resources.
  38. * @GTK_RECENT_SORT_MRU: Sort the returned list with the most recently used
  39. * items first.
  40. * @GTK_RECENT_SORT_LRU: Sort the returned list with the least recently used
  41. * items first.
  42. * @GTK_RECENT_SORT_CUSTOM: Sort the returned list using a custom sorting
  43. * function passed using gtk_recent_manager_set_sort_func().
  44. *
  45. * Used to specify the sorting method to be applyed to the recently
  46. * used resource list.
  47. **/
  48. typedef enum
  49. {
  50. GTK_RECENT_SORT_NONE = 0,
  51. GTK_RECENT_SORT_MRU,
  52. GTK_RECENT_SORT_LRU,
  53. GTK_RECENT_SORT_CUSTOM
  54. } GtkRecentSortType;
  55. typedef gint (*GtkRecentSortFunc) (GtkRecentInfo *a,
  56. GtkRecentInfo *b,
  57. gpointer user_data);
  58. typedef struct _GtkRecentChooser GtkRecentChooser; /* dummy */
  59. typedef struct _GtkRecentChooserIface GtkRecentChooserIface;
  60. #define GTK_RECENT_CHOOSER_ERROR (gtk_recent_chooser_error_quark ())
  61. typedef enum
  62. {
  63. GTK_RECENT_CHOOSER_ERROR_NOT_FOUND,
  64. GTK_RECENT_CHOOSER_ERROR_INVALID_URI
  65. } GtkRecentChooserError;
  66. GQuark gtk_recent_chooser_error_quark (void);
  67. struct _GtkRecentChooserIface
  68. {
  69. GTypeInterface base_iface;
  70. /*
  71. * Methods
  72. */
  73. gboolean (* set_current_uri) (GtkRecentChooser *chooser,
  74. const gchar *uri,
  75. GError **error);
  76. gchar * (* get_current_uri) (GtkRecentChooser *chooser);
  77. gboolean (* select_uri) (GtkRecentChooser *chooser,
  78. const gchar *uri,
  79. GError **error);
  80. void (* unselect_uri) (GtkRecentChooser *chooser,
  81. const gchar *uri);
  82. void (* select_all) (GtkRecentChooser *chooser);
  83. void (* unselect_all) (GtkRecentChooser *chooser);
  84. GList * (* get_items) (GtkRecentChooser *chooser);
  85. GtkRecentManager *(* get_recent_manager) (GtkRecentChooser *chooser);
  86. void (* add_filter) (GtkRecentChooser *chooser,
  87. GtkRecentFilter *filter);
  88. void (* remove_filter) (GtkRecentChooser *chooser,
  89. GtkRecentFilter *filter);
  90. GSList * (* list_filters) (GtkRecentChooser *chooser);
  91. void (* set_sort_func) (GtkRecentChooser *chooser,
  92. GtkRecentSortFunc sort_func,
  93. gpointer data,
  94. GDestroyNotify destroy);
  95. /*
  96. * Signals
  97. */
  98. void (* item_activated) (GtkRecentChooser *chooser);
  99. void (* selection_changed) (GtkRecentChooser *chooser);
  100. };
  101. GType gtk_recent_chooser_get_type (void) G_GNUC_CONST;
  102. /*
  103. * Configuration
  104. */
  105. void gtk_recent_chooser_set_show_private (GtkRecentChooser *chooser,
  106. gboolean show_private);
  107. gboolean gtk_recent_chooser_get_show_private (GtkRecentChooser *chooser);
  108. void gtk_recent_chooser_set_show_not_found (GtkRecentChooser *chooser,
  109. gboolean show_not_found);
  110. gboolean gtk_recent_chooser_get_show_not_found (GtkRecentChooser *chooser);
  111. void gtk_recent_chooser_set_select_multiple (GtkRecentChooser *chooser,
  112. gboolean select_multiple);
  113. gboolean gtk_recent_chooser_get_select_multiple (GtkRecentChooser *chooser);
  114. void gtk_recent_chooser_set_limit (GtkRecentChooser *chooser,
  115. gint limit);
  116. gint gtk_recent_chooser_get_limit (GtkRecentChooser *chooser);
  117. void gtk_recent_chooser_set_local_only (GtkRecentChooser *chooser,
  118. gboolean local_only);
  119. gboolean gtk_recent_chooser_get_local_only (GtkRecentChooser *chooser);
  120. void gtk_recent_chooser_set_show_tips (GtkRecentChooser *chooser,
  121. gboolean show_tips);
  122. gboolean gtk_recent_chooser_get_show_tips (GtkRecentChooser *chooser);
  123. #ifndef GTK_DISABLE_DEPRECATED
  124. void gtk_recent_chooser_set_show_numbers (GtkRecentChooser *chooser,
  125. gboolean show_numbers);
  126. gboolean gtk_recent_chooser_get_show_numbers (GtkRecentChooser *chooser);
  127. #endif /* GTK_DISABLE_DEPRECATED */
  128. void gtk_recent_chooser_set_show_icons (GtkRecentChooser *chooser,
  129. gboolean show_icons);
  130. gboolean gtk_recent_chooser_get_show_icons (GtkRecentChooser *chooser);
  131. void gtk_recent_chooser_set_sort_type (GtkRecentChooser *chooser,
  132. GtkRecentSortType sort_type);
  133. GtkRecentSortType gtk_recent_chooser_get_sort_type (GtkRecentChooser *chooser);
  134. void gtk_recent_chooser_set_sort_func (GtkRecentChooser *chooser,
  135. GtkRecentSortFunc sort_func,
  136. gpointer sort_data,
  137. GDestroyNotify data_destroy);
  138. /*
  139. * Items handling
  140. */
  141. gboolean gtk_recent_chooser_set_current_uri (GtkRecentChooser *chooser,
  142. const gchar *uri,
  143. GError **error);
  144. gchar * gtk_recent_chooser_get_current_uri (GtkRecentChooser *chooser);
  145. GtkRecentInfo *gtk_recent_chooser_get_current_item (GtkRecentChooser *chooser);
  146. gboolean gtk_recent_chooser_select_uri (GtkRecentChooser *chooser,
  147. const gchar *uri,
  148. GError **error);
  149. void gtk_recent_chooser_unselect_uri (GtkRecentChooser *chooser,
  150. const gchar *uri);
  151. void gtk_recent_chooser_select_all (GtkRecentChooser *chooser);
  152. void gtk_recent_chooser_unselect_all (GtkRecentChooser *chooser);
  153. GList * gtk_recent_chooser_get_items (GtkRecentChooser *chooser);
  154. gchar ** gtk_recent_chooser_get_uris (GtkRecentChooser *chooser,
  155. gsize *length);
  156. /*
  157. * Filters
  158. */
  159. void gtk_recent_chooser_add_filter (GtkRecentChooser *chooser,
  160. GtkRecentFilter *filter);
  161. void gtk_recent_chooser_remove_filter (GtkRecentChooser *chooser,
  162. GtkRecentFilter *filter);
  163. GSList * gtk_recent_chooser_list_filters (GtkRecentChooser *chooser);
  164. void gtk_recent_chooser_set_filter (GtkRecentChooser *chooser,
  165. GtkRecentFilter *filter);
  166. GtkRecentFilter *gtk_recent_chooser_get_filter (GtkRecentChooser *chooser);
  167. G_END_DECLS
  168. #endif /* __GTK_RECENT_CHOOSER_H__ */