Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

217 rader
7.2 KiB

  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 1998, 2001 Tim Janik
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser 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. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser 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. /*
  20. * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GTK+ Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  26. #error "Only <gtk/gtk.h> can be included directly."
  27. #endif
  28. #ifndef __GTK_ACCEL_GROUP_H__
  29. #define __GTK_ACCEL_GROUP_H__
  30. #include <gdk/gdk.h>
  31. #include <gtk/gtkenums.h>
  32. G_BEGIN_DECLS
  33. /* --- type macros --- */
  34. #define GTK_TYPE_ACCEL_GROUP (gtk_accel_group_get_type ())
  35. #define GTK_ACCEL_GROUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ACCEL_GROUP, GtkAccelGroup))
  36. #define GTK_ACCEL_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCEL_GROUP, GtkAccelGroupClass))
  37. #define GTK_IS_ACCEL_GROUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ACCEL_GROUP))
  38. #define GTK_IS_ACCEL_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCEL_GROUP))
  39. #define GTK_ACCEL_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCEL_GROUP, GtkAccelGroupClass))
  40. /* --- accel flags --- */
  41. typedef enum
  42. {
  43. GTK_ACCEL_VISIBLE = 1 << 0, /* display in GtkAccelLabel? */
  44. GTK_ACCEL_LOCKED = 1 << 1, /* is it removable? */
  45. GTK_ACCEL_MASK = 0x07
  46. } GtkAccelFlags;
  47. /* --- typedefs & structures --- */
  48. typedef struct _GtkAccelGroup GtkAccelGroup;
  49. typedef struct _GtkAccelGroupClass GtkAccelGroupClass;
  50. typedef struct _GtkAccelKey GtkAccelKey;
  51. typedef struct _GtkAccelGroupEntry GtkAccelGroupEntry;
  52. typedef gboolean (*GtkAccelGroupActivate) (GtkAccelGroup *accel_group,
  53. GObject *acceleratable,
  54. guint keyval,
  55. GdkModifierType modifier);
  56. /**
  57. * GtkAccelGroupFindFunc:
  58. * @key:
  59. * @closure:
  60. * @data:
  61. *
  62. * Since: 2.2
  63. */
  64. typedef gboolean (*GtkAccelGroupFindFunc) (GtkAccelKey *key,
  65. GClosure *closure,
  66. gpointer data);
  67. /**
  68. * GtkAccelGroup:
  69. *
  70. * An object representing and maintaining a group of accelerators.
  71. */
  72. struct _GtkAccelGroup
  73. {
  74. GObject parent;
  75. guint GSEAL (lock_count);
  76. GdkModifierType GSEAL (modifier_mask);
  77. GSList *GSEAL (acceleratables);
  78. guint GSEAL (n_accels);
  79. GtkAccelGroupEntry *GSEAL (priv_accels);
  80. };
  81. struct _GtkAccelGroupClass
  82. {
  83. GObjectClass parent_class;
  84. void (*accel_changed) (GtkAccelGroup *accel_group,
  85. guint keyval,
  86. GdkModifierType modifier,
  87. GClosure *accel_closure);
  88. /* Padding for future expansion */
  89. void (*_gtk_reserved1) (void);
  90. void (*_gtk_reserved2) (void);
  91. void (*_gtk_reserved3) (void);
  92. void (*_gtk_reserved4) (void);
  93. };
  94. struct _GtkAccelKey
  95. {
  96. guint accel_key;
  97. GdkModifierType accel_mods;
  98. guint accel_flags : 16;
  99. };
  100. /* -- Accelerator Groups --- */
  101. GType gtk_accel_group_get_type (void) G_GNUC_CONST;
  102. GtkAccelGroup* gtk_accel_group_new (void);
  103. gboolean gtk_accel_group_get_is_locked (GtkAccelGroup *accel_group);
  104. GdkModifierType
  105. gtk_accel_group_get_modifier_mask (GtkAccelGroup *accel_group);
  106. void gtk_accel_group_lock (GtkAccelGroup *accel_group);
  107. void gtk_accel_group_unlock (GtkAccelGroup *accel_group);
  108. void gtk_accel_group_connect (GtkAccelGroup *accel_group,
  109. guint accel_key,
  110. GdkModifierType accel_mods,
  111. GtkAccelFlags accel_flags,
  112. GClosure *closure);
  113. void gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group,
  114. const gchar *accel_path,
  115. GClosure *closure);
  116. gboolean gtk_accel_group_disconnect (GtkAccelGroup *accel_group,
  117. GClosure *closure);
  118. gboolean gtk_accel_group_disconnect_key (GtkAccelGroup *accel_group,
  119. guint accel_key,
  120. GdkModifierType accel_mods);
  121. gboolean gtk_accel_group_activate (GtkAccelGroup *accel_group,
  122. GQuark accel_quark,
  123. GObject *acceleratable,
  124. guint accel_key,
  125. GdkModifierType accel_mods);
  126. /* --- GtkActivatable glue --- */
  127. void _gtk_accel_group_attach (GtkAccelGroup *accel_group,
  128. GObject *object);
  129. void _gtk_accel_group_detach (GtkAccelGroup *accel_group,
  130. GObject *object);
  131. gboolean gtk_accel_groups_activate (GObject *object,
  132. guint accel_key,
  133. GdkModifierType accel_mods);
  134. GSList* gtk_accel_groups_from_object (GObject *object);
  135. GtkAccelKey* gtk_accel_group_find (GtkAccelGroup *accel_group,
  136. GtkAccelGroupFindFunc find_func,
  137. gpointer data);
  138. GtkAccelGroup* gtk_accel_group_from_accel_closure (GClosure *closure);
  139. /* --- Accelerators--- */
  140. gboolean gtk_accelerator_valid (guint keyval,
  141. GdkModifierType modifiers) G_GNUC_CONST;
  142. void gtk_accelerator_parse (const gchar *accelerator,
  143. guint *accelerator_key,
  144. GdkModifierType *accelerator_mods);
  145. gchar* gtk_accelerator_name (guint accelerator_key,
  146. GdkModifierType accelerator_mods);
  147. gchar* gtk_accelerator_get_label (guint accelerator_key,
  148. GdkModifierType accelerator_mods);
  149. void gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask);
  150. guint gtk_accelerator_get_default_mod_mask (void);
  151. /* --- internal --- */
  152. GtkAccelGroupEntry* gtk_accel_group_query (GtkAccelGroup *accel_group,
  153. guint accel_key,
  154. GdkModifierType accel_mods,
  155. guint *n_entries);
  156. void _gtk_accel_group_reconnect (GtkAccelGroup *accel_group,
  157. GQuark accel_path_quark);
  158. struct _GtkAccelGroupEntry
  159. {
  160. GtkAccelKey key;
  161. GClosure *closure;
  162. GQuark accel_path_quark;
  163. };
  164. #ifndef GTK_DISABLE_DEPRECATED
  165. /**
  166. * gtk_accel_group_ref:
  167. *
  168. * Deprecated equivalent of g_object_ref().
  169. *
  170. * Returns: the accel group that was passed in
  171. */
  172. #define gtk_accel_group_ref g_object_ref
  173. /**
  174. * gtk_accel_group_unref:
  175. *
  176. * Deprecated equivalent of g_object_unref().
  177. */
  178. #define gtk_accel_group_unref g_object_unref
  179. #endif /* GTK_DISABLE_DEPRECATED */
  180. G_END_DECLS
  181. #endif /* __GTK_ACCEL_GROUP_H__ */