Gtk2
view release on metacpan or search on metacpan
gtk-demo/main.pl view on Meta::CPAN
#!/usr/bin/perl -w
#
# $Id$
#
our $PROGDIR = $0;
$PROGDIR =~ s/main.pl$//;
use strict;
use Carp;
use Glib qw(TRUE FALSE);
use Gtk2;
use Gtk2::Pango;
use Gtk2;
use vars qw/ @testgtk_demos /;
# lists of demo code descriptions.
# the func is a plain string in each of these, as a sentinel value to tell
# row_activated_cb that the file containing that function hasn't been
# loaded yet.
my @child0 = (
{ title => "Editable Cells", filename => "editable_cells.pl", func => 'stub', },
{ title => "List Store", filename => "list_store.pl", func => 'stub', },
{ title => "Tree Store", filename => "tree_store.pl", func => 'stub', },
);
my @child1 = (
{ title => "Hypertext", filename => "hypertext.pl", func => 'stub', },
{ 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 },
{ title => "Tree View", children => \@child0 },
);
push @testgtk_demos,
{ title => "Entry Completion", filename => "entry_completion.pl", func => 'stub', },
{ title => "UI Manager", filename => "ui_manager.pl", func => 'stub', }
if Gtk2->CHECK_VERSION (2, 4, 0);
push @testgtk_demos,
{ title => "Rotated Text", filename => "rotated_text.pl", func => 'stub', },
if Gtk2->CHECK_VERSION (2, 6, 0);
# some globals.
my $info_buffer;
my $source_buffer;
my $current_file;
# clean names for column numbers.
use constant TITLE_COLUMN => 0;
use constant FILENAME_COLUMN => 1;
use constant FUNC_COLUMN => 2;
use constant ITALIC_COLUMN => 3;
use constant NUM_COLUMNS => 4;
#/**
# * demo_find_file:
# * @base: base filename
# * @err: location to store error, or %NULL.
# *
# * Looks for @base first in the current directory, then in the
# * location GTK+ where it will be installed on make install,
# * returns the first file found.
# *
# * Return value: the filename, if found or %NULL
# **/
sub demo_find_file {
my $base = shift;
return $base if -e $base;
my $filename = $PROGDIR.$base;
croak "Cannot find demo data file $base ($filename)\n"
unless -e $filename;
return $filename;
}
sub window_closed_cb {
( run in 1.238 second using v1.01-cache-2.11-cpan-8dfa8b56332 )