1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
PROGRAM(button);
// A container that can only contain one child, and accepts events.
// draws a bevelbox around itself.
// IMG: GTK.Button("A button")
// IMG: GTK.Button("A button\nwith multiple lines\nof text")
// IMG: GTK.Button()->add(GTK.Image(GDK.Image(0)->set(Image.image(100,40)->test())))
INHERIT(container);
SUBWIDGET(child, widget);
// Returns the (one and only) child of this container.
SIGNAL("pressed", "Called when the button is pressed");
SIGNAL("released", "Called when the button is released");
SIGNAL("clicked", "Called when the button is pressed, and then released");
SIGNAL("enter", "Called when the mouse enters the button");
SIGNAL("leave", "Called when the mouse leaves the button");
FUNCTION(create, "function(string|void:void)")
NAME_ARGS(label_text);
// If a string is supplied, a label is created and added to the button.
{
if(THIS->obj) error("GTK.Button->create() can only be called once.\n");
if(args)
{
char *s;
get_all_args("GTK.Button", args, "%s", &s);
THIS->obj = GTK_OBJECT( gtk_button_new_with_label( s ) );
} else {
THIS->obj = GTK_OBJECT( gtk_button_new( ) );
}
pgtk__init_this_object();
}
SIMPLE_FUNCTION(pressed);
// Emulate a 'press' event.
SIMPLE_FUNCTION(released);
// Emulate a 'release' event.
SIMPLE_FUNCTION(clicked);
// Emulate a 'clicked' event (press followed by release).
SIMPLE_FUNCTION(enter);
// Emulate a 'enter' event.
SIMPLE_FUNCTION(leave);
// Emulate a 'leave' event.
SIMPLE_INT_FUNCTION(set_relief);
NAME_ARGS(newstyle);
// One of CONST(GTK_RELIEF)
int COMPLEX_FUNCTION(get_relief);
|