Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  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_MENU_H__
  29. #define __GTK_MENU_H__
  30. #include <gtk/gtkaccelgroup.h>
  31. #include <gtk/gtkmenushell.h>
  32. G_BEGIN_DECLS
  33. #define GTK_TYPE_MENU (gtk_menu_get_type ())
  34. #define GTK_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU, GtkMenu))
  35. #define GTK_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU, GtkMenuClass))
  36. #define GTK_IS_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU))
  37. #define GTK_IS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU))
  38. #define GTK_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU, GtkMenuClass))
  39. typedef struct _GtkMenu GtkMenu;
  40. typedef struct _GtkMenuClass GtkMenuClass;
  41. typedef void (*GtkMenuPositionFunc) (GtkMenu *menu,
  42. gint *x,
  43. gint *y,
  44. gboolean *push_in,
  45. gpointer user_data);
  46. typedef void (*GtkMenuDetachFunc) (GtkWidget *attach_widget,
  47. GtkMenu *menu);
  48. struct _GtkMenu
  49. {
  50. GtkMenuShell GSEAL (menu_shell);
  51. GtkWidget *GSEAL (parent_menu_item);
  52. GtkWidget *GSEAL (old_active_menu_item);
  53. GtkAccelGroup *GSEAL (accel_group);
  54. gchar *GSEAL (accel_path);
  55. GtkMenuPositionFunc GSEAL (position_func);
  56. gpointer GSEAL (position_func_data);
  57. guint GSEAL (toggle_size);
  58. /* Do _not_ touch these widgets directly. We hide the reference
  59. * count from the toplevel to the menu, so it must be restored
  60. * before operating on these widgets
  61. */
  62. GtkWidget *GSEAL (toplevel);
  63. GtkWidget *GSEAL (tearoff_window);
  64. GtkWidget *GSEAL (tearoff_hbox);
  65. GtkWidget *GSEAL (tearoff_scrollbar);
  66. GtkAdjustment *GSEAL (tearoff_adjustment);
  67. GdkWindow *GSEAL (view_window);
  68. GdkWindow *GSEAL (bin_window);
  69. gint GSEAL (scroll_offset);
  70. gint GSEAL (saved_scroll_offset);
  71. gint GSEAL (scroll_step);
  72. guint GSEAL (timeout_id);
  73. /* When a submenu of this menu is popped up, motion in this
  74. * region is ignored
  75. */
  76. GdkRegion *GSEAL (navigation_region); /* unused */
  77. guint GSEAL (navigation_timeout);
  78. guint GSEAL (needs_destruction_ref_count) : 1;
  79. guint GSEAL (torn_off) : 1;
  80. /* The tearoff is active when it is torn off and the not-torn-off
  81. * menu is not popped up.
  82. */
  83. guint GSEAL (tearoff_active) : 1;
  84. guint GSEAL (scroll_fast) : 1;
  85. guint GSEAL (upper_arrow_visible) : 1;
  86. guint GSEAL (lower_arrow_visible) : 1;
  87. guint GSEAL (upper_arrow_prelight) : 1;
  88. guint GSEAL (lower_arrow_prelight) : 1;
  89. };
  90. struct _GtkMenuClass
  91. {
  92. GtkMenuShellClass parent_class;
  93. /* Padding for future expansion */
  94. void (*_gtk_reserved1) (void);
  95. void (*_gtk_reserved2) (void);
  96. void (*_gtk_reserved3) (void);
  97. void (*_gtk_reserved4) (void);
  98. };
  99. GType gtk_menu_get_type (void) G_GNUC_CONST;
  100. GtkWidget* gtk_menu_new (void);
  101. /* Display the menu onscreen */
  102. void gtk_menu_popup (GtkMenu *menu,
  103. GtkWidget *parent_menu_shell,
  104. GtkWidget *parent_menu_item,
  105. GtkMenuPositionFunc func,
  106. gpointer data,
  107. guint button,
  108. guint32 activate_time);
  109. /* Position the menu according to its position function. Called
  110. * from gtkmenuitem.c when a menu-item changes its allocation
  111. */
  112. void gtk_menu_reposition (GtkMenu *menu);
  113. void gtk_menu_popdown (GtkMenu *menu);
  114. /* Keep track of the last menu item selected. (For the purposes
  115. * of the option menu
  116. */
  117. GtkWidget* gtk_menu_get_active (GtkMenu *menu);
  118. void gtk_menu_set_active (GtkMenu *menu,
  119. guint index_);
  120. /* set/get the accelerator group that holds global accelerators (should
  121. * be added to the corresponding toplevel with gtk_window_add_accel_group().
  122. */
  123. void gtk_menu_set_accel_group (GtkMenu *menu,
  124. GtkAccelGroup *accel_group);
  125. GtkAccelGroup* gtk_menu_get_accel_group (GtkMenu *menu);
  126. void gtk_menu_set_accel_path (GtkMenu *menu,
  127. const gchar *accel_path);
  128. const gchar* gtk_menu_get_accel_path (GtkMenu *menu);
  129. /* A reference count is kept for a widget when it is attached to
  130. * a particular widget. This is typically a menu item; it may also
  131. * be a widget with a popup menu - for instance, the Notebook widget.
  132. */
  133. void gtk_menu_attach_to_widget (GtkMenu *menu,
  134. GtkWidget *attach_widget,
  135. GtkMenuDetachFunc detacher);
  136. void gtk_menu_detach (GtkMenu *menu);
  137. /* This should be dumped in favor of data set when the menu is popped
  138. * up - that is currently in the ItemFactory code, but should be
  139. * in the Menu code.
  140. */
  141. GtkWidget* gtk_menu_get_attach_widget (GtkMenu *menu);
  142. void gtk_menu_set_tearoff_state (GtkMenu *menu,
  143. gboolean torn_off);
  144. gboolean gtk_menu_get_tearoff_state (GtkMenu *menu);
  145. /* This sets the window manager title for the window that
  146. * appears when a menu is torn off
  147. */
  148. void gtk_menu_set_title (GtkMenu *menu,
  149. const gchar *title);
  150. G_CONST_RETURN gchar *gtk_menu_get_title (GtkMenu *menu);
  151. void gtk_menu_reorder_child (GtkMenu *menu,
  152. GtkWidget *child,
  153. gint position);
  154. void gtk_menu_set_screen (GtkMenu *menu,
  155. GdkScreen *screen);
  156. void gtk_menu_attach (GtkMenu *menu,
  157. GtkWidget *child,
  158. guint left_attach,
  159. guint right_attach,
  160. guint top_attach,
  161. guint bottom_attach);
  162. void gtk_menu_set_monitor (GtkMenu *menu,
  163. gint monitor_num);
  164. gint gtk_menu_get_monitor (GtkMenu *menu);
  165. GList* gtk_menu_get_for_attach_widget (GtkWidget *widget);
  166. #ifndef GTK_DISABLE_DEPRECATED
  167. #define gtk_menu_append(menu,child) gtk_menu_shell_append ((GtkMenuShell *)(menu),(child))
  168. #define gtk_menu_prepend(menu,child) gtk_menu_shell_prepend ((GtkMenuShell *)(menu),(child))
  169. #define gtk_menu_insert(menu,child,pos) gtk_menu_shell_insert ((GtkMenuShell *)(menu),(child),(pos))
  170. #endif /* GTK_DISABLE_DEPRECATED */
  171. void gtk_menu_set_reserve_toggle_size (GtkMenu *menu,
  172. gboolean reserve_toggle_size);
  173. gboolean gtk_menu_get_reserve_toggle_size (GtkMenu *menu);
  174. G_END_DECLS
  175. #endif /* __GTK_MENU_H__ */