1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
28 #include "gtkcolorseldialog.h"
31 #include "gtkbutton.h"
37 static void gtk_color_selection_dialog_class_init (GtkColorSelectionDialogClass *klass);
38 static void gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag);
40 static GtkWindowClass *color_selection_dialog_parent_class = NULL;
43 /***************************/
44 /* GtkColorSelectionDialog */
45 /***************************/
48 gtk_color_selection_dialog_get_type (void)
50 static GType color_selection_dialog_type = 0;
52 if (!color_selection_dialog_type)
54 static const GTypeInfo colorsel_diag_info =
56 sizeof (GtkColorSelectionDialogClass),
58 NULL, /* base_finalize */
59 (GClassInitFunc) gtk_color_selection_dialog_class_init,
60 NULL, /* class_finalize */
61 NULL, /* class_data */
62 sizeof (GtkColorSelectionDialog),
64 (GInstanceInitFunc) gtk_color_selection_dialog_init,
67 color_selection_dialog_type =
68 g_type_register_static (GTK_TYPE_DIALOG, g_intern_static_string ("GtkColorSelectionDialog"),
69 &colorsel_diag_info, 0);
72 return color_selection_dialog_type;
76 gtk_color_selection_dialog_class_init (GtkColorSelectionDialogClass *klass)
78 color_selection_dialog_parent_class = g_type_class_peek_parent (klass);
82 gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
84 GtkWidget *action_area_button_box, *frame;
86 frame = gtk_frame_new (NULL);
87 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
88 gtk_container_add (GTK_CONTAINER (GTK_DIALOG (colorseldiag)->vbox), frame);
89 gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
90 gtk_widget_show (frame);
92 colorseldiag->colorsel = gtk_color_selection_new ();
93 gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
94 gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
95 gtk_container_add (GTK_CONTAINER (frame), colorseldiag->colorsel);
96 gtk_widget_show (colorseldiag->colorsel);
98 action_area_button_box = GTK_DIALOG (colorseldiag)->action_area;
100 colorseldiag->cancel_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
102 GTK_RESPONSE_CANCEL);
104 colorseldiag->ok_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
108 gtk_widget_grab_default (colorseldiag->ok_button);
110 colorseldiag->help_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
114 gtk_widget_hide (colorseldiag->help_button);
116 gtk_dialog_set_alternative_button_order (GTK_DIALOG (colorseldiag),
122 gtk_window_set_title (GTK_WINDOW (colorseldiag),
123 _("Color Selection"));
127 gtk_color_selection_dialog_new (const gchar *title)
129 GtkColorSelectionDialog *colorseldiag;
131 colorseldiag = g_object_new (GTK_TYPE_COLOR_SELECTION_DIALOG, NULL);
134 gtk_window_set_title (GTK_WINDOW (colorseldiag), title);
136 gtk_window_set_resizable (GTK_WINDOW (colorseldiag), FALSE);
138 return GTK_WIDGET (colorseldiag);
141 #define __GTK_COLOR_SELECTION_DIALOG_C__
142 #include "gtkaliasdef.c"