]> Pileus Git - ~andy/gtk/blob - examples/frame/frame.c
configure: Fix build of pixbuf-demo
[~andy/gtk] / examples / frame / frame.c
1
2 #include <gtk/gtk.h>
3
4 int main( int   argc,
5           char *argv[] )
6 {
7   /* GtkWidget is the storage type for widgets */
8   GtkWidget *window;
9   GtkWidget *frame;
10
11   /* Initialise GTK */
12   gtk_init (&argc, &argv);
13     
14   /* Create a new window */
15   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
16   gtk_window_set_title (GTK_WINDOW (window), "Frame Example");
17
18   /* Here we connect the "destroy" event to a signal handler */ 
19   g_signal_connect (G_OBJECT (window), "destroy",
20                     G_CALLBACK (gtk_main_quit), NULL);
21
22   gtk_widget_set_size_request (window, 300, 300);
23   /* Sets the border width of the window. */
24   gtk_container_set_border_width (GTK_CONTAINER (window), 10);
25
26   /* Create a Frame */
27   frame = gtk_frame_new (NULL);
28   gtk_container_add (GTK_CONTAINER (window), frame);
29
30   /* Set the frame's label */
31   gtk_frame_set_label (GTK_FRAME (frame), "GTK Frame Widget");
32
33   /* Align the label at the right of the frame */
34   gtk_frame_set_label_align (GTK_FRAME (frame), 1.0, 0.0);
35
36   /* Set the style of the frame */
37   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
38
39   gtk_widget_show (frame);
40   
41   /* Display the window */
42   gtk_widget_show (window);
43     
44   /* Enter the event loop */
45   gtk_main ();
46     
47   return 0;
48 }