Gtk2::Dialog enhancements
- From: "muppet" <scott asofyet org>
- To: <gtk-perl-list gnome org>
- Subject: Gtk2::Dialog enhancements
- Date: Tue, 25 Mar 2003 15:20:30 -0500 (EST)
discovered that no functionality equivalent to gtk_dialog_new_with_buttons was
implemented, so i did. is there
instead of having another constructor, you specify the new_with_buttons args
to new, in the same vein as the multi-purpose new for Gtk2::Button.
i also made some changes to the way the response ids are handled. the dialog
functions were accepting only ints, but run() was attempting to return a
GtkResponseType enum, resulting in rather annoying problems... i changed this
so that the functions accept either response type enums strings or integers,
and run() returns a string if the return code maps into the enum, and
otherwise an integer. this allows you to specify stock response codes as
well as custom ones.
i didn't remove any behaviour, by the way, this is only enhancements (making
it work correctly, IMHO).
the old way:
$d = Gtk2::Dialog->new;
$d->add_button ("gtk-ok", -5); # -5 => GTK_RESPONSE_OK
$d->add_button ("gtk-cancel", 42);
# if the user clicks this button, the program will croak
# when it fails to convert 42 to a GtkReponseType string
the new way(s):
$d = Gtk2::Dialog->new;
$d->add_button ("gtk-ok", 'ok');
$d->add_button ("gtk-cancel", 'cancel');
$d2 = Gtk2::Dialog->new ($title, $parent, ['destroy-with-parent'],
'gtk-ok', 'ok',
'gtk-cancel', 'cancel',
'the answer', 42);
(note that 'gtk-ok' and 'gtk-cancel' are the stock ids for stock OK and Cancel
buttons.)
--
muppet <scott asofyet org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]