Gtk2
view release on metacpan or search on metacpan
ChangeLog.pre-git view on Meta::CPAN
2005/02/08 01:15 (-0400) muppetman
* Gtk2.pm, NEWS, README, copyright.pod: unstable release 1.073
* Makefile.PL: require Glib 1.073
* MANIFEST: updated
2005/02/08 01:05 (-0400) muppetman
* t/GtkComboBox.t: Fix gtk+ assertions by setting the combobox up
properly.
2005/02/08 00:15 (-0400) muppetman
* xs/GdkPixbuf.xs, t/GdkPixbuf.t: bind and test gdk_pixbuf_get_option
* t/GtkAboutDialog.t, xs/GtkAboutDialog.xs: implement and test
gtk_show_about_dialog
* xs/GtkCellRenderer.xs, t/GtkCellRenderer.t: bind and test
examples/timeouttest.pl
gdk.typemap
gtk-demo/alphatest.png
gtk-demo/apple-red.png
gtk-demo/appwindow.pl
gtk-demo/assistant.pl
gtk-demo/background.jpg
gtk-demo/button_box.pl
gtk-demo/changedisplay.pl
gtk-demo/colorsel.pl
gtk-demo/combobox.pl
gtk-demo/demo.ui
gtk-demo/dialog.pl
gtk-demo/drawingarea.pl
gtk-demo/editable_cells.pl
gtk-demo/entry_completion.pl
gtk-demo/floppybuddy.gif
gtk-demo/gnome-applets.png
gtk-demo/gnome-calendar.png
gtk-demo/gnome-foot.png
gtk-demo/gnome-gimp.png
gtk-demo/combobox.pl view on Meta::CPAN
#
# Combo boxes
#
# The ComboBox widget allows to select one option out of a list.
# The ComboBoxEntry additionally allows the user to enter a value
# that is not in the list of options.
#
# How the options are displayed is controlled by cell renderers.
#
package combobox;
use strict;
use warnings;
use Glib ':constants';
use Gtk2;
#include "demo-common.h"
use constant PIXBUF_COL => 0;
use constant TEXT_COL => 1;
gtk-demo/combobox.pl view on Meta::CPAN
sub new($@)
{
my $class = shift;
my $self = $class->SUPER::new();
bless $self, $class;
$self;
}
package combobox;
sub do {
my $do_widget = shift;
if (!$window) {
$window = Gtk2::Window->new('GTK_WINDOW_TOPLEVEL');
$window->set_screen ($do_widget->get_screen)
if Gtk2->CHECK_VERSION (2, 2, 0);
$window->set_title("Combo boxes");
$window->signal_connect("destroy", sub { $window = undef; });
$window->set_border_width(10);
my $vbox = Gtk2::VBox->new(FALSE, 2);
$window->add($vbox);
# A combobox demonstrating cell renderers, separators and
# insensitive rows
#
my $frame = Gtk2::Frame->new("Some stock icons");
$vbox->pack_start($frame, FALSE, FALSE, 0);
my $box = Gtk2::VBox->new(FALSE, 0);
$box->set_border_width(5);
$frame->add($box);
my $model = create_stock_icon_store();
gtk-demo/combobox.pl view on Meta::CPAN
$combo->pack_start($renderer, TRUE);
$combo->set_attributes($renderer,
"text", TEXT_COL);
$combo->set_cell_data_func($renderer, \&set_sensitive);
$combo->set_row_separator_func(\&is_separator);
$combo->set_active(0);
# A combobox demonstrating trees.
#
$frame = Gtk2::Frame->new("Where are we ?");
$vbox->pack_start($frame, FALSE, FALSE, 0);
$box = Gtk2::VBox->new(FALSE, 0);
$box->set_border_width(5);
$frame->add($box);
$model = create_capital_store ();
$combo = Gtk2::ComboBox->new_with_model($model);
gtk-demo/main.pl view on Meta::CPAN
{ title => "Multiple Views", filename => "textview.pl", func => 'stub', },
);
@testgtk_demos = (
{ title => "Application main window", filename => "appwindow.pl", func => 'stub', },
{ title => "Assistant", filename => "assistant.pl", func => 'stub', available => sub { Gtk2->CHECK_VERSION (2, 10, 0); } },
{ title => "Builder", filename => "builder.pl", func => 'stub', available => sub { Gtk2->CHECK_VERSION (2, 12, 0); } },
{ title => "Button Boxes", filename => "button_box.pl", func => 'stub', },
{ title => "Change Display", filename => "changedisplay.pl", func => 'stub', },
{ title => "Color Selector", filename => "colorsel.pl", func => 'stub', },
{ title => "Combo boxes", filename => "combobox.pl", func => 'stub', available => sub { Gtk2->CHECK_VERSION (2, 4, 0); } },
{ title => "Dialog and Message Boxes", filename => "dialog.pl", func => 'stub', },
{ title => "Drawing Area", filename => "drawingarea.pl", func => 'stub', },
{ title => "Images", filename => "images.pl", func => 'stub', },
{ title => "Item Factory", filename => "item_factory.pl", func => 'stub', },
{ title => "Menus", filename => "menus.pl", func => 'stub', },
{ title => "Paned Widgets", filename => "panes.pl", func => 'stub', },
{ title => "Pixbufs", filename => "pixbufs.pl", func => 'stub', },
{ title => "Size Groups", filename => "sizegroup.pl", func => 'stub', },
{ title => "Stock Item and Icon Browser", filename => "stock_browser.pl", func => 'stub', },
{ title => "Text Widget", children => \@child1 },
xs/GtkComboBox.xs view on Meta::CPAN
=for object Gtk2::ComboBox - A widget used to choose from a list of items
=cut
=for position SYNOPSIS
=head1 SYNOPSIS
# the easy way:
$combobox = Gtk2::ComboBox->new_text;
foreach (@strings) {
$combobox->append_text ($_);
}
$combobox->prepend_text ($another_string);
$combobox->insert_text ($index, $yet_another_string);
$combobox->remove_text ($index);
$text = $combobox->get_active_text;
# the full-featured way.
# a combo box that shows stock ids and their images:
use constant ID_COLUMN => 0;
$model = Gtk2::ListStore->new ('Glib::String');
foreach (qw(gtk-ok gtk-cancel gtk-yes gtk-no gtk-save gtk-open)) {
$model->set ($model->append, ID_COLUMN, $_);
}
$combo_box = Gtk2::ComboBox->new ($model);
# to display anything, you must pack cell renderers into
# the combobox, which implements the Gtk2::CellLayout interface.
$renderer = Gtk2::CellRendererPixbuf->new;
$combo_box->pack_start ($renderer, FALSE);
$combo_box->add_attribute ($renderer, stock_id => ID_COLUMN);
$renderer = Gtk2::CellRendererText->new;
$combo_box->pack_start ($renderer, TRUE);
$combo_box->add_attribute ($renderer, text => ID_COLUMN);
# select by index
$combo_box->set_active ($index);
$active_index = $combo_box->get_active;
( run in 1.969 second using v1.01-cache-2.11-cpan-8dfa8b56332 )