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
|
PROGRAM(toggle_button);
// Toggle buttons are derived from normal buttons and are very
// similar, except they will always be in one of two states,
// alternated by a click. They may be depressed, and when you click
// again, they will pop back up. Click again, and they will pop back
// down.
// <p>
// IMG: GTK.Toggle_button("Toggle button")
// IMG: GTK.Toggle_button("Toggle button")->set_active( 1 )
SIGNAL("toggled", "");
INHERIT(button);
FUNCTION(create, "function(string|void:void)");
NAME_ARGS(label);
// If you supply a string, a label will be created and inserted in the button.
// Otherwise, use ->add(widget) to create the contents of the button.
{
if(THIS->obj) error("GTK.Toggle_button->create() can only be called once.\n");
if(args)
{
char *s;
get_all_args("GTK.Toggle_button", args, "%s", &s);
THIS->obj = GTK_OBJECT( gtk_toggle_button_new_with_label( s ) );
} else {
THIS->obj = GTK_OBJECT( gtk_toggle_button_new( ) );
}
pgtk__init_this_object();
}
COMPLEX_FUNCTION(set_mode, int);
NAME_ARGS(mode);
// If true, draw indicator
COMPLEX_FUNCTION(set_active, int);
/* int COMPLEX_FUNCTION(get_active); */
CLASSMEMBER(active, int);
// returns 1 if the button is pressed, 0 otherwise.
SIMPLE_FUNCTION(toggled);
// emulate a 'toggle' of the button. This will emit a 'toggled' signal.
CLASSMEMBER(draw_indicator,int);
|