8
function newbutton(ALabel : PChar) : PGtkWidget;
11
Result:=gtk_button_new_with_label(ALabel);
12
gtk_widget_show(result);
15
procedure destroy(widget : pGtkWidget ; data: pgpointer ); cdecl;
23
hbox,vbox : PgtkWidget;
26
gtk_init (@argc, @argv);
27
window := gtk_window_new (GTK_WINDOW_TOPLEVEL);
28
// Box to divide window in 2 halves:
29
totalbox := gtk_vbox_new(true,10);
30
gtk_widget_show(totalbox);
31
// A box for each half of the screen:
32
hbox := gtk_hbox_new(false,5);
33
gtk_widget_show(hbox);
34
vbox := gtk_vbox_new(true,5);
35
gtk_widget_show(vbox);
36
// Put boxes in their halves
37
gtk_box_pack_start(GTK_BOX(totalbox),hbox,true,true,0);
38
gtk_box_pack_start(GTK_BOX(totalbox),vbox,true,true,0);
39
// Now fill boxes with buttons.
41
gtk_box_pack_start(GTK_BOX(hbox),newbutton('Button 1'),false,false,0);
42
gtk_box_pack_start(GTK_BOX(hbox),newbutton('Button 2'),false,false,0);
43
gtk_box_pack_start(GTK_BOX(hbox),newbutton('Button 3'),false,false,0);
45
gtk_box_pack_start(GTK_BOX(vbox),newbutton('Button A'),true,true,0);
46
gtk_box_pack_start(GTK_BOX(vbox),newbutton('Button B'),true,true,0);
47
gtk_box_pack_start(GTK_BOX(vbox),newbutton('Button C'),true,true,0);
48
// Put totalbox in window
49
gtk_container_set_border_width(GTK_CONTAINER(Window),5);
50
gtk_container_add(GTK_Container(window),totalbox);
51
gtk_signal_connect (PGTKOBJECT (window), 'destroy',
52
GTK_SIGNAL_FUNC (@destroy), NULL);
53
gtk_widget_show (window);