#!/usr/cogent/bin/gamma
/* Example: Multiple buttons.
* This example creates several identical buttons
* and adds them to a horizontal button box.
*/
/* Initialize Cogent interprocess communication.*/
init_ipc("a", "aq");
/* The "Hello, world!" function again. */
function hello()
{
princ("Hello, world!\n");
}
/* Create a GtkWindow with a title.*/
window = new(GtkWindow);
window.set_border_width(20);
window.set_default_size(300,100);
window.set_title("Hello Buttons!");
/* Create a horizontal button box, add it to the window.*/
box1 = new(GtkHButtonBox);
window.add(box1);
/* Create some buttons, make callbacks for them, and add
* the buttons to the box.
*/
for (i=1;i<=3;i++)
{
button = new(GtkButton);
button.label = string("Button ",i);
button.signal("clicked",#hello());
box1.add(button);
}
/* Make an exit button. */
button = new(GtkButton);
button.label = string("Exit");
button.signal("clicked",#gtk_main_quit());
box1.add(button);
/*
* Show everything.
*/
window.show_all();
/* Enter the GTK main processing loop.*/
gtk_main();