25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

159 lines
4.7 KiB

  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * GtkBindingSet: Keybinding manager for GtkObjects.
  5. * Copyright (C) 1998 Tim Janik
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. * Boston, MA 02111-1307, USA.
  21. */
  22. /*
  23. * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
  24. * file for a list of people on the GTK+ Team. See the ChangeLog
  25. * files for a list of changes. These files are distributed with
  26. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  27. */
  28. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  29. #error "Only <gtk/gtk.h> can be included directly."
  30. #endif
  31. #ifndef __GTK_BINDINGS_H__
  32. #define __GTK_BINDINGS_H__
  33. #include <gdk/gdk.h>
  34. #include <gtk/gtkobject.h>
  35. G_BEGIN_DECLS
  36. /* Binding sets
  37. */
  38. typedef struct _GtkBindingSet GtkBindingSet;
  39. typedef struct _GtkBindingEntry GtkBindingEntry;
  40. typedef struct _GtkBindingSignal GtkBindingSignal;
  41. typedef struct _GtkBindingArg GtkBindingArg;
  42. struct _GtkBindingSet
  43. {
  44. gchar *set_name;
  45. gint priority;
  46. GSList *widget_path_pspecs;
  47. GSList *widget_class_pspecs;
  48. GSList *class_branch_pspecs;
  49. GtkBindingEntry *entries;
  50. GtkBindingEntry *current;
  51. guint parsed : 1; /* From RC content */
  52. };
  53. struct _GtkBindingEntry
  54. {
  55. /* key portion
  56. */
  57. guint keyval;
  58. GdkModifierType modifiers;
  59. GtkBindingSet *binding_set;
  60. guint destroyed : 1;
  61. guint in_emission : 1;
  62. guint marks_unbound : 1;
  63. GtkBindingEntry *set_next;
  64. GtkBindingEntry *hash_next;
  65. GtkBindingSignal *signals;
  66. };
  67. struct _GtkBindingArg
  68. {
  69. GType arg_type;
  70. union {
  71. glong long_data;
  72. gdouble double_data;
  73. gchar *string_data;
  74. } d;
  75. };
  76. struct _GtkBindingSignal
  77. {
  78. GtkBindingSignal *next;
  79. gchar *signal_name;
  80. guint n_args;
  81. GtkBindingArg *args;
  82. };
  83. /* Application-level methods */
  84. GtkBindingSet* gtk_binding_set_new (const gchar *set_name);
  85. GtkBindingSet* gtk_binding_set_by_class(gpointer object_class);
  86. GtkBindingSet* gtk_binding_set_find (const gchar *set_name);
  87. gboolean gtk_bindings_activate (GtkObject *object,
  88. guint keyval,
  89. GdkModifierType modifiers);
  90. gboolean gtk_bindings_activate_event (GtkObject *object,
  91. GdkEventKey *event);
  92. gboolean gtk_binding_set_activate (GtkBindingSet *binding_set,
  93. guint keyval,
  94. GdkModifierType modifiers,
  95. GtkObject *object);
  96. #ifndef GTK_DISABLE_DEPRECATED
  97. #define gtk_binding_entry_add gtk_binding_entry_clear
  98. void gtk_binding_entry_clear (GtkBindingSet *binding_set,
  99. guint keyval,
  100. GdkModifierType modifiers);
  101. guint gtk_binding_parse_binding (GScanner *scanner);
  102. #endif /* GTK_DISABLE_DEPRECATED */
  103. void gtk_binding_entry_skip (GtkBindingSet *binding_set,
  104. guint keyval,
  105. GdkModifierType modifiers);
  106. void gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
  107. guint keyval,
  108. GdkModifierType modifiers,
  109. const gchar *signal_name,
  110. guint n_args,
  111. ...);
  112. void gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
  113. guint keyval,
  114. GdkModifierType modifiers,
  115. const gchar *signal_name,
  116. GSList *binding_args);
  117. void gtk_binding_entry_remove (GtkBindingSet *binding_set,
  118. guint keyval,
  119. GdkModifierType modifiers);
  120. void gtk_binding_set_add_path (GtkBindingSet *binding_set,
  121. GtkPathType path_type,
  122. const gchar *path_pattern,
  123. GtkPathPriorityType priority);
  124. /* Non-public methods */
  125. guint _gtk_binding_parse_binding (GScanner *scanner);
  126. void _gtk_binding_reset_parsed (void);
  127. void _gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
  128. guint keyval,
  129. GdkModifierType modifiers,
  130. const gchar *signal_name,
  131. GSList *binding_args);
  132. G_END_DECLS
  133. #endif /* __GTK_BINDINGS_H__ */