]> Pileus Git - ~andy/gtk/blob - gtk/gtkdialog.c
call the base class init fucntions from all parent types upon class
[~andy/gtk] / gtk / gtkdialog.c
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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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 #include "gtkbutton.h"
20 #include "gtkdialog.h"
21 #include "gtkhbox.h"
22 #include "gtkhseparator.h"
23 #include "gtkvbox.h"
24
25
26 static void gtk_dialog_class_init (GtkDialogClass *klass);
27 static void gtk_dialog_init       (GtkDialog      *dialog);
28
29
30 guint
31 gtk_dialog_get_type (void)
32 {
33   static guint dialog_type = 0;
34
35   if (!dialog_type)
36     {
37       GtkTypeInfo dialog_info =
38       {
39         "GtkDialog",
40         sizeof (GtkDialog),
41         sizeof (GtkDialogClass),
42         (GtkClassInitFunc) gtk_dialog_class_init,
43         (GtkObjectInitFunc) gtk_dialog_init,
44         /* reversed_1 */ NULL,
45         /* reversed_2 */ NULL,
46         (GtkClassInitFunc) NULL,
47       };
48
49       dialog_type = gtk_type_unique (gtk_window_get_type (), &dialog_info);
50     }
51
52   return dialog_type;
53 }
54
55 static void
56 gtk_dialog_class_init (GtkDialogClass *class)
57 {
58 }
59
60 static void
61 gtk_dialog_init (GtkDialog *dialog)
62 {
63   GtkWidget *separator;
64
65   dialog->vbox = gtk_vbox_new (FALSE, 0);
66   gtk_container_add (GTK_CONTAINER (dialog), dialog->vbox);
67   gtk_widget_show (dialog->vbox);
68
69   dialog->action_area = gtk_hbox_new (TRUE, 5);
70   gtk_container_border_width (GTK_CONTAINER (dialog->action_area), 10);
71   gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->action_area, FALSE, TRUE, 0);
72   gtk_widget_show (dialog->action_area);
73
74   separator = gtk_hseparator_new ();
75   gtk_box_pack_end (GTK_BOX (dialog->vbox), separator, FALSE, TRUE, 0);
76   gtk_widget_show (separator);
77 }
78
79 GtkWidget*
80 gtk_dialog_new (void)
81 {
82   return GTK_WIDGET (gtk_type_new (gtk_dialog_get_type ()));
83 }