您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

187 行
6.5 KiB

  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_DIALOG_H__
  29. #define __GTK_DIALOG_H__
  30. #include <gtk/gtkwindow.h>
  31. G_BEGIN_DECLS
  32. /* Parameters for dialog construction */
  33. typedef enum
  34. {
  35. GTK_DIALOG_MODAL = 1 << 0, /* call gtk_window_set_modal (win, TRUE) */
  36. GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1, /* call gtk_window_set_destroy_with_parent () */
  37. GTK_DIALOG_NO_SEPARATOR = 1 << 2 /* no separator bar above buttons */
  38. } GtkDialogFlags;
  39. /* Convenience enum to use for response_id's. Positive values are
  40. * totally user-interpreted. GTK will sometimes return
  41. * GTK_RESPONSE_NONE if no response_id is available.
  42. *
  43. * Typical usage is:
  44. * if (gtk_dialog_run(dialog) == GTK_RESPONSE_ACCEPT)
  45. * blah();
  46. */
  47. typedef enum
  48. {
  49. /* GTK returns this if a response widget has no response_id,
  50. * or if the dialog gets programmatically hidden or destroyed.
  51. */
  52. GTK_RESPONSE_NONE = -1,
  53. /* GTK won't return these unless you pass them in
  54. * as the response for an action widget. They are
  55. * for your convenience.
  56. */
  57. GTK_RESPONSE_REJECT = -2,
  58. GTK_RESPONSE_ACCEPT = -3,
  59. /* If the dialog is deleted. */
  60. GTK_RESPONSE_DELETE_EVENT = -4,
  61. /* These are returned from GTK dialogs, and you can also use them
  62. * yourself if you like.
  63. */
  64. GTK_RESPONSE_OK = -5,
  65. GTK_RESPONSE_CANCEL = -6,
  66. GTK_RESPONSE_CLOSE = -7,
  67. GTK_RESPONSE_YES = -8,
  68. GTK_RESPONSE_NO = -9,
  69. GTK_RESPONSE_APPLY = -10,
  70. GTK_RESPONSE_HELP = -11
  71. } GtkResponseType;
  72. #define GTK_TYPE_DIALOG (gtk_dialog_get_type ())
  73. #define GTK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_DIALOG, GtkDialog))
  74. #define GTK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_DIALOG, GtkDialogClass))
  75. #define GTK_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DIALOG))
  76. #define GTK_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DIALOG))
  77. #define GTK_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DIALOG, GtkDialogClass))
  78. typedef struct _GtkDialog GtkDialog;
  79. typedef struct _GtkDialogClass GtkDialogClass;
  80. struct _GtkDialog
  81. {
  82. GtkWindow window;
  83. /*< public >*/
  84. GtkWidget *GSEAL (vbox);
  85. GtkWidget *GSEAL (action_area);
  86. /*< private >*/
  87. GtkWidget *GSEAL (separator);
  88. };
  89. struct _GtkDialogClass
  90. {
  91. GtkWindowClass parent_class;
  92. void (* response) (GtkDialog *dialog, gint response_id);
  93. /* Keybinding signals */
  94. void (* close) (GtkDialog *dialog);
  95. /* Padding for future expansion */
  96. void (*_gtk_reserved1) (void);
  97. void (*_gtk_reserved2) (void);
  98. void (*_gtk_reserved3) (void);
  99. void (*_gtk_reserved4) (void);
  100. };
  101. GType gtk_dialog_get_type (void) G_GNUC_CONST;
  102. GtkWidget* gtk_dialog_new (void);
  103. GtkWidget* gtk_dialog_new_with_buttons (const gchar *title,
  104. GtkWindow *parent,
  105. GtkDialogFlags flags,
  106. const gchar *first_button_text,
  107. ...);
  108. void gtk_dialog_add_action_widget (GtkDialog *dialog,
  109. GtkWidget *child,
  110. gint response_id);
  111. GtkWidget* gtk_dialog_add_button (GtkDialog *dialog,
  112. const gchar *button_text,
  113. gint response_id);
  114. void gtk_dialog_add_buttons (GtkDialog *dialog,
  115. const gchar *first_button_text,
  116. ...) G_GNUC_NULL_TERMINATED;
  117. void gtk_dialog_set_response_sensitive (GtkDialog *dialog,
  118. gint response_id,
  119. gboolean setting);
  120. void gtk_dialog_set_default_response (GtkDialog *dialog,
  121. gint response_id);
  122. GtkWidget* gtk_dialog_get_widget_for_response (GtkDialog *dialog,
  123. gint response_id);
  124. gint gtk_dialog_get_response_for_widget (GtkDialog *dialog,
  125. GtkWidget *widget);
  126. #if !defined (GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
  127. void gtk_dialog_set_has_separator (GtkDialog *dialog,
  128. gboolean setting);
  129. gboolean gtk_dialog_get_has_separator (GtkDialog *dialog);
  130. #endif
  131. gboolean gtk_alternative_dialog_button_order (GdkScreen *screen);
  132. void gtk_dialog_set_alternative_button_order (GtkDialog *dialog,
  133. gint first_response_id,
  134. ...);
  135. void gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
  136. gint n_params,
  137. gint *new_order);
  138. /* Emit response signal */
  139. void gtk_dialog_response (GtkDialog *dialog,
  140. gint response_id);
  141. /* Returns response_id */
  142. gint gtk_dialog_run (GtkDialog *dialog);
  143. GtkWidget * gtk_dialog_get_action_area (GtkDialog *dialog);
  144. GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog);
  145. /* For private use only */
  146. void _gtk_dialog_set_ignore_separator (GtkDialog *dialog,
  147. gboolean ignore_separator);
  148. G_END_DECLS
  149. #endif /* __GTK_DIALOG_H__ */