Glade-Perl

 view release on metacpan or  search on metacpan

Glade/PerlUIGtk.pm  view on Meta::CPAN

    my $right_justify = $class->use_par($proto, 'right_justify', $BOOL, 'False' );

    if ($proto->{'stock_item'}) {
# FIXME - this is a Gnome stock menu item and should be in UIExtra
# FIXME convert this to do a proper lookup (maybe with new sub)
        my $stock_item = $class->use_par($proto, 'stock_item', $DEFAULT, '' );
        $stock_item =~ s/GNOMEUIINFO_MENU_(.*)_TREE/$1/;
# FIXME this creates the string - we should look it up instead
        $stock_item = ucfirst(lc($stock_item));
# FIXME this only does uline for first character wrong, wrong, wrong
        $label = "_".$stock_item;
#        $stock_item = $Glade::PerlUIExtra::gnome_enums->{"GNOME_STOCK_PIXMAP_$stock_item"};
#        $class->add_to_UI( $depth, "\$widgets->{'$name'} = ".
#            "Gnome::Stock->menu_item('$stock_item', '$stock_item');" );
    } 
    if ($label) {
        $class->add_to_UI($depth, "\$widgets->{'$name'} = new Gtk::MenuItem(".
            "_('$label'));" );
    } else {
        $class->add_to_UI($depth, "\$widgets->{'$name'} = new Gtk::MenuItem;" );
    }
    if ($right_justify) { 
        $class->add_to_UI( $depth, "\$widgets->{'$name'}->right_justify;" );
    }
    $class->pack_widget($parent, $name, $proto, $depth );
    if (_($label) =~ /_/) {
        $class->add_to_UI( $depth,
            "$current_form\{'$name-key'} = ".
                "$current_form\{'$name'}->child->parse_uline(_('$label') );");
        $class->add_to_UI( $depth,
            "$current_form\{'$name'}->add_accelerator(".
                "'activate_item', $current_form\{'accelgroup'}, ". 
                "$current_form\{'$name-key'}, 'mod1_mask', ['visible', 'locked'] );");
        undef $widgets->{"$name-key"};
    }
    return $widgets->{$name};
}

sub new_GtkNotebook {
    my ($class, $parent, $proto, $depth) = @_;
    my $me = "$class->new_GtkNotebook";
    my $name = $proto->{'name'};
    my $tab_pos     = $class->use_par($proto, 'tab_pos'    , $LOOKUP, 'top' );
    my $show_tabs   = $class->use_par($proto, 'show_tabs',   $BOOL,   'True' );
    my $show_border = $class->use_par($proto, 'show_border', $BOOL,   'True' );
    my $scrollable  = $class->use_par($proto, 'scrollable',  $BOOL,   'True' );
    my $tab_hborder = $class->use_par($proto, 'tab_hborder', $DEFAULT, 0 );
    my $tab_vborder = $class->use_par($proto, 'tab_vborder', $DEFAULT, 0 );
    my $ignore      = $class->use_par($proto, 'num_pages',   $DEFAULT, 0 );
    
    unless ($class->new_from_child_name($parent, $name, $proto, $depth )) {
        $class->add_to_UI($depth, "\$widgets->{'$name'} = new Gtk::Notebook;" );
        $class->pack_widget($parent, $name, $proto, $depth );
    }
    $class->add_to_UI( $depth, "$current_form\{'$name'}->set_tab_pos('$tab_pos' );" );
    $class->add_to_UI( $depth, "$current_form\{'$name'}->set_show_tabs($show_tabs );" );
    $class->add_to_UI( $depth, "$current_form\{'$name'}->set_show_border($show_border );" );
    $class->add_to_UI( $depth, "$current_form\{'$name'}->set_scrollable($scrollable );" );
    $class->add_to_UI( $depth, "$current_form\{'$name'}->set_tab_hborder($tab_hborder );" );
    $class->add_to_UI( $depth, "$current_form\{'$name'}->set_tab_vborder($tab_vborder );" );
    if ($class->use_par($proto, 'popup_enable',    $BOOL,    'True'    )) { 
        $class->add_to_UI( $depth,  "$current_form\{'$name'}->popup_enable;" );
    }
    # 'num_pages'
    $nb->{$name} = {'panes' => [], 'pane' => 0, 'tab' => 0};
    @Notebook_panes = ();
    $Notebook_pane = 0;
    $Notebook_tab = 0;

    return $widgets->{$name};
}

sub new_GtkObject {
    my ($class, $parent, $proto, $depth) = @_;
    my $me = "$class->new_GtkObject";
    my $name = $proto->{'name'};

    $class->add_to_UI($depth, "\$widgets->{'$name'} = new Gtk::Object;" );

    $class->pack_widget($parent, $name, $proto, $depth );
    return $widgets->{$name};
}

sub new_GtkOptionMenu {
    my ($class, $parent, $proto, $depth) = @_;
    my $me = "$class->new_GtkOptionMenu";
    my $name = $proto->{'name'};
    my $item;
    my @items;
    my $count = 0;
    my $items          = $class->use_par($proto, 'items' );
    my $initial_choice = $class->use_par($proto, 'initial_choice', $DEFAULT, 0 );

    $class->add_to_UI( $depth,  "\$widgets->{'$name'} = new Gtk::OptionMenu;" );
    $class->pack_widget($parent, $name, $proto, $depth );

    $class->add_to_UI( $depth,  "\$widgets->{'${name}_menu'} = new Gtk::Menu;" );
    $class->pack_widget("$name", "${name}_menu", $proto, $depth );
    if (defined $items) {
        @items = split(/\n/, $items );
        foreach $item (@items) {
            if ($item) {
                $class->add_to_UI( $depth,  "\$widgets->{'${name}_item$count'} = ".
                    "new Gtk::MenuItem('$item' );" );
                $class->pack_widget("${name}_menu", "${name}_item$count", $proto, $depth+1 );
                if ($count == $initial_choice) {
                    $class->add_to_UI( $depth, 
                        "${current_form}\{'${name}_item$count'}\->activate;" );
                }
                $count++;
            }
        }
        $class->add_to_UI( $depth, 
            "${current_form}\{'$name'}->set_history( $initial_choice );" );
    }
    return $widgets->{$name};
}

sub new_GtkPacker {
    my ($class, $parent, $proto, $depth) = @_;
    my $me = "$class->new_GtkPacker";
    my $name = $proto->{'name'};



( run in 1.839 second using v1.01-cache-2.11-cpan-364913b4093 )