2008-07-01 22:57:50 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
1997-11-24 22:37:52 +00:00
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
2008-05-28 15:35:43 +00:00
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
1999-02-24 07:37:18 +00:00
|
|
|
*/
|
|
|
|
|
2009-10-21 18:30:04 +00:00
|
|
|
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
2008-05-28 15:07:04 +00:00
|
|
|
#error "Only <gtk/gtk.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#ifndef __GTK_DIALOG_H__
|
|
|
|
#define __GTK_DIALOG_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include <gtk/gtkwindow.h>
|
|
|
|
|
|
|
|
|
2005-03-20 07:01:23 +00:00
|
|
|
G_BEGIN_DECLS
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2011-01-04 17:51:11 +00:00
|
|
|
/**
|
|
|
|
* GtkDialogFlags:
|
|
|
|
* @GTK_DIALOG_MODAL: Make the constructed dialog modal,
|
|
|
|
* see gtk_window_set_modal()
|
|
|
|
* @GTK_DIALOG_DESTROY_WITH_PARENT: Destroy the dialog when its
|
|
|
|
* parent is destroyed, see gtk_window_set_destroy_with_parent()
|
|
|
|
*
|
|
|
|
* Flags used to influence dialog construction.
|
|
|
|
*/
|
2000-10-20 23:14:41 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2011-01-04 17:51:11 +00:00
|
|
|
GTK_DIALOG_MODAL = 1 << 0,
|
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1
|
2000-10-20 23:14:41 +00:00
|
|
|
} GtkDialogFlags;
|
|
|
|
|
2011-01-04 17:51:11 +00:00
|
|
|
/**
|
|
|
|
* GtkResponseType:
|
|
|
|
* @GTK_RESPONSE_NONE: Returned if an action widget has no response id,
|
|
|
|
* or if the dialog gets programmatically hidden or destroyed
|
|
|
|
* @GTK_RESPONSE_REJECT: Generic response id, not used by GTK+ dialogs
|
|
|
|
* @GTK_RESPONSE_ACCEPT: Generic response id, not used by GTK+ dialogs
|
|
|
|
* @GTK_RESPONSE_DELETE_EVENT: Returned if the dialog is deleted
|
|
|
|
* @GTK_RESPONSE_OK: Returned by OK buttons in GTK+ dialogs
|
|
|
|
* @GTK_RESPONSE_CANCEL: Returned by Cancel buttons in GTK+ dialogs
|
|
|
|
* @GTK_RESPONSE_CLOSE: Returned by Close buttons in GTK+ dialogs
|
|
|
|
* @GTK_RESPONSE_YES: Returned by Yes buttons in GTK+ dialogs
|
|
|
|
* @GTK_RESPONSE_NO: Returned by No buttons in GTK+ dialogs
|
|
|
|
* @GTK_RESPONSE_APPLY: Returned by Apply buttons in GTK+ dialogs
|
|
|
|
* @GTK_RESPONSE_HELP: Returned by Help buttons in GTK+ dialogs
|
2000-10-20 23:14:41 +00:00
|
|
|
*
|
2011-01-04 17:51:11 +00:00
|
|
|
* Predefined values for use as response ids in gtk_dialog_add_button().
|
|
|
|
* All predefined values are negative, GTK+ leaves positive values for
|
|
|
|
* application-defined response ids.
|
2000-10-20 23:14:41 +00:00
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
2011-01-04 17:51:11 +00:00
|
|
|
GTK_RESPONSE_NONE = -1,
|
|
|
|
GTK_RESPONSE_REJECT = -2,
|
|
|
|
GTK_RESPONSE_ACCEPT = -3,
|
Derive from GtkDialog, and use stock buttons. Should be 100% source
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
2000-11-06 16:44:01 +00:00
|
|
|
GTK_RESPONSE_DELETE_EVENT = -4,
|
2011-01-04 17:51:11 +00:00
|
|
|
GTK_RESPONSE_OK = -5,
|
|
|
|
GTK_RESPONSE_CANCEL = -6,
|
|
|
|
GTK_RESPONSE_CLOSE = -7,
|
|
|
|
GTK_RESPONSE_YES = -8,
|
|
|
|
GTK_RESPONSE_NO = -9,
|
|
|
|
GTK_RESPONSE_APPLY = -10,
|
|
|
|
GTK_RESPONSE_HELP = -11
|
2000-10-20 23:14:41 +00:00
|
|
|
} GtkResponseType;
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
1998-07-14 16:34:48 +00:00
|
|
|
#define GTK_TYPE_DIALOG (gtk_dialog_get_type ())
|
2002-10-11 22:57:11 +00:00
|
|
|
#define GTK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_DIALOG, GtkDialog))
|
|
|
|
#define GTK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_DIALOG, GtkDialogClass))
|
|
|
|
#define GTK_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DIALOG))
|
|
|
|
#define GTK_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DIALOG))
|
|
|
|
#define GTK_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DIALOG, GtkDialogClass))
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
2010-08-26 17:15:37 +00:00
|
|
|
typedef struct _GtkDialog GtkDialog;
|
|
|
|
typedef struct _GtkDialogPrivate GtkDialogPrivate;
|
|
|
|
typedef struct _GtkDialogClass GtkDialogClass;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2011-01-04 17:51:11 +00:00
|
|
|
/**
|
|
|
|
* GtkDialog:
|
|
|
|
*
|
|
|
|
* The GtkDialog struct contains only private fields
|
|
|
|
* and should not be directly accessed.
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
struct _GtkDialog
|
|
|
|
{
|
|
|
|
GtkWindow window;
|
|
|
|
|
2001-03-07 21:32:51 +00:00
|
|
|
/*< private >*/
|
2010-08-26 17:15:37 +00:00
|
|
|
GtkDialogPrivate *priv;
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkDialogClass
|
|
|
|
{
|
|
|
|
GtkWindowClass parent_class;
|
2000-10-20 23:14:41 +00:00
|
|
|
|
|
|
|
void (* response) (GtkDialog *dialog, gint response_id);
|
Clip the retrieved image data to the screen, using a server grab to avoid
2001-06-28 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkimage-x11.c (_gdk_x11_get_image): Clip the retrieved
image data to the screen, using a server grab to avoid race
conditions.
* gtk/gtkitemfactory.c (gtk_item_factory_create_item): remove
check for NULL return from gtk_image_new_from_stock(), it never
returns NULL.
(gtk_item_factory_create_item): fix bug where we parsed the stock
ID as an inline pixbuf
* gtk/gtktext.c (gtk_text_key_press): numeric keypad support
* gtk/gtkspinbutton.c (gtk_spin_button_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkoptionmenu.c (gtk_option_menu_key_press): numeric keypad
support (should be using binding set here)
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): numeric keypad
support
* gtk/gtkmenu.c (gtk_menu_class_init): numeric keypad support
* gtk/gtkmenubar.c (gtk_menu_bar_class_init): numeric keypad
* gtk/gtklistitem.c (gtk_list_item_class_init): numeric keypad
* gtk/gtkimcontextsimple.c
(gtk_im_context_simple_filter_keypress): keypad
* gtk/gtkfilesel.c (gtk_file_selection_key_press): keypad
* gtk/gtkentry.c (gtk_entry_class_init): numeric keypad fixes
* gtk/gtkctree.c (gtk_ctree_class_init): numeric keypad support
* gtk/gtkcolorsel.c (palette_activate): keypad support (of course,
should be binding-setted)
* gtk/gtkwindow.c (gtk_window_class_init): numeric keypad fixes
* gtk/gtkclist.c (gtk_clist_class_init): numeric keypad fixes
* gtk/gtkcalendar.c: numeric keypad fixes
* gtk/gtktextview.c (gtk_text_view_class_init): numeric keypad
support
* gdk/gdkwindow.c (gdk_window_get_clip_region): fix infinite loop
screwup
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
clip the render area to the drawable's clip region in advance,
so we don't get data from the server that we don't need.
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
check return value of gdk_pixbuf_get_from_drawable(), fall back
to bilevel alpha if we can't get the pixbuf to composite against.
* gdk/gdkdraw.c (gdk_drawable_get_image): set the image colormap
* gdk/gdkimage.c (gdk_image_get_colormap): add
gdk_image_set_colormap, gdk_image_get_colormap
* gdk/gdkpixbuf-drawable.c (rgbconvert): Change all converters to
take a region of the image, instead of converting the entire
image.
* gtk/gtkwidget.h (struct _GtkWidgetClass): add show_help
keybinding signal. Add default bindings for it. Add default
handler for show_help that shows the tooltip for the widget.
* gtk/gtkdialog.c (gtk_dialog_class_init): add binding set and
"close" keybinding signal, remove key press handler.
* gtk/gtktooltips.c (gtk_tooltips_set_colors): Just remove this,
it's not our usual practice to leave a deprecated function around
with a runtime warning, plus we don't want it to appear in docs,
plus if we make them yellow no one will want to change them
anyhow.
2001-06-29 01:59:02 +00:00
|
|
|
|
|
|
|
/* Keybinding signals */
|
|
|
|
|
|
|
|
void (* close) (GtkDialog *dialog);
|
2002-02-23 20:22:05 +00:00
|
|
|
|
|
|
|
/* Padding for future expansion */
|
|
|
|
void (*_gtk_reserved1) (void);
|
|
|
|
void (*_gtk_reserved2) (void);
|
|
|
|
void (*_gtk_reserved3) (void);
|
|
|
|
void (*_gtk_reserved4) (void);
|
1997-11-24 22:37:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-10-11 22:57:11 +00:00
|
|
|
GType gtk_dialog_get_type (void) G_GNUC_CONST;
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkWidget* gtk_dialog_new (void);
|
|
|
|
|
2000-10-20 23:14:41 +00:00
|
|
|
GtkWidget* gtk_dialog_new_with_buttons (const gchar *title,
|
|
|
|
GtkWindow *parent,
|
|
|
|
GtkDialogFlags flags,
|
|
|
|
const gchar *first_button_text,
|
2005-07-25 13:34:24 +00:00
|
|
|
...);
|
2000-10-20 23:14:41 +00:00
|
|
|
|
Derive from GtkDialog, and use stock buttons. Should be 100% source
2000-11-02 Havoc Pennington <hp@redhat.com>
* gtk/gtkfilesel.h, gtk/gtkfilesel.c: Derive from GtkDialog, and
use stock buttons. Should be 100% source compatible, appropriate
filesel fields now point to dialog->vbox and dialog->action_area.
On the bizarre side, dialog->action_area and filesel->action_area
are not the same widget.
(gtk_file_selection_init): Put some padding around the selection
entry, so it isn't touching the GtkDialog separator.
* gtk/gtkfontsel.h, gtk/gtkfontsel.c: Derive from GtkDialog,
use stock buttons, etc. Should also be source compatible.
Set the dialog default title in _init not _new().
* gtk/gtkcolorseldialog.c (gtk_color_selection_dialog_init):
Use stock buttons; don't put a button box inside the existing
dialog button box. Don't bother with push/pop colormap anymore.
* gtk/gtkdialog.h (GtkResponseType): Add a bunch of more
specific GTK_RESPONSE_* values. This is clearer than ACCEPT/REJECT
for message dialog, and necessary for the font selection and color
selection with help and apply buttons.
* gtk/gtkdialog.c (gtk_dialog_add_button): Return a pointer
to the created button widget. Set GTK_CAN_DEFAULT on the button.
(gtk_dialog_init): Default to GTK_BUTTONBOX_END, put less spacing
between buttons, put less padding around the action area.
(gtk_dialog_run): Exit on unmap rather than on destroy.
This will also exit the loop if the widget is hidden.
(gtk_dialog_delete_event_handler): Use GTK_RESPONSE_DELETE_EVENT
instead of GTK_RESPONSE_NONE; since we're already adding a bunch
of GTK_RESPONSE_* stuff, this seems cleaner, and lets you
special-case delete event.
* gtk/gtktexttagtable.c, gtk/gtktextview.c: Fix doc comment
formatting
2000-11-06 16:44:01 +00:00
|
|
|
void gtk_dialog_add_action_widget (GtkDialog *dialog,
|
|
|
|
GtkWidget *child,
|
|
|
|
gint response_id);
|
|
|
|
GtkWidget* gtk_dialog_add_button (GtkDialog *dialog,
|
|
|
|
const gchar *button_text,
|
|
|
|
gint response_id);
|
|
|
|
void gtk_dialog_add_buttons (GtkDialog *dialog,
|
|
|
|
const gchar *first_button_text,
|
2005-03-08 05:52:55 +00:00
|
|
|
...) G_GNUC_NULL_TERMINATED;
|
2000-10-20 23:14:41 +00:00
|
|
|
|
2001-01-09 17:45:34 +00:00
|
|
|
void gtk_dialog_set_response_sensitive (GtkDialog *dialog,
|
|
|
|
gint response_id,
|
|
|
|
gboolean setting);
|
|
|
|
void gtk_dialog_set_default_response (GtkDialog *dialog,
|
|
|
|
gint response_id);
|
2009-09-23 14:53:55 +00:00
|
|
|
GtkWidget* gtk_dialog_get_widget_for_response (GtkDialog *dialog,
|
|
|
|
gint response_id);
|
2005-05-03 04:44:53 +00:00
|
|
|
gint gtk_dialog_get_response_for_widget (GtkDialog *dialog,
|
2011-01-04 17:51:11 +00:00
|
|
|
GtkWidget *widget);
|
2001-01-09 17:45:34 +00:00
|
|
|
|
2004-10-25 05:43:29 +00:00
|
|
|
gboolean gtk_alternative_dialog_button_order (GdkScreen *screen);
|
|
|
|
void gtk_dialog_set_alternative_button_order (GtkDialog *dialog,
|
2011-01-04 17:51:11 +00:00
|
|
|
gint first_response_id,
|
|
|
|
...);
|
2004-11-21 04:55:37 +00:00
|
|
|
void gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
|
|
|
|
gint n_params,
|
|
|
|
gint *new_order);
|
2004-10-25 05:43:29 +00:00
|
|
|
|
2000-10-20 23:14:41 +00:00
|
|
|
/* Emit response signal */
|
|
|
|
void gtk_dialog_response (GtkDialog *dialog,
|
|
|
|
gint response_id);
|
|
|
|
|
|
|
|
/* Returns response_id */
|
|
|
|
gint gtk_dialog_run (GtkDialog *dialog);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
2008-06-24 10:22:40 +00:00
|
|
|
GtkWidget * gtk_dialog_get_action_area (GtkDialog *dialog);
|
|
|
|
GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog);
|
2004-02-03 19:46:43 +00:00
|
|
|
|
2005-03-20 07:01:23 +00:00
|
|
|
G_END_DECLS
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
#endif /* __GTK_DIALOG_H__ */
|