Glade-Perl-Two

 view release on metacpan or  search on metacpan

Glade/Two/Generate.pm  view on Meta::CPAN

    # Those below will NOT work in specific version mentioned
};

%app_fields = (
    'type'  => 'glade2perl-2',
    'widgets'   => {
        'underlineable' => " ".
            join(" ", (
                'GtkLabel', 
                'GtkButton', 
                'GtkMenuItem')
               )." ",
        'to_ignore'     => join (' ', 
            'Placeholder',
            'Custom',
           ),
        'ignored'       => 0,
        'missing'       => 0,
        'gnome'         => join( " ",
            'GnomeAbout',
            'GnomeApp',

Glade/Two/Generate.pm  view on Meta::CPAN

            'GnomeMessageBox',
            'GnomeNumberEntry',
            'GnomePaperSelector',
            'GnomePixmap',
            'GnomePixmapEntry',
            'GnomePropertyBox',
            'GnomeSpell',
#            'GtkCalendar',          # In Gtk after CVS-19990914
            'GtkClock',
            'GtkDial',
            'GtkPixmapMenuItem',
           ),
        'gnome_db'      => join( " ",
            'GnomeDbGrid',
            'GnomeDbList',
            'GnomeDbCombo',
            'GnomeDbReport',
            'GnomeDbError',
            'GnomeDbLogin',
            'GnomeDbBrowser',
            'GnomeDbErrorDlg',

Glade/Two/Generate.pm  view on Meta::CPAN

#            die "\nerror F$me   $indent- This is a $child_type type Window".
#                " - what should I do?";
#        }
        $postpone_show = 1;

    } else {
        # We probably have a parent to pack into somehow
        eval "\$refpar = (ref ${current_form}\{'$parentname'})||'UNDEFINED !!';";
        $Glade_Perl->diag_print(5, "Adding %s to %s", $refwid, $refpar);
        unless (eval "exists ${current_form}\{'$parentname'}") {
            if ($Glade_Perl->source->quick_gen or 'Gtk2::Menu' eq $refwid) {
                # We are a popup menu so we don't have a root window
#            $class->add_to_UI($depth, "${first_form}->popup_enable;");
                $class->add_to_UI($depth,   
                    "${current_form}\{'tooltips'} = new Gtk2::Tooltips;");
                $class->add_to_UI($depth,   
                    "${current_form}\{'accelgroup'} = new Gtk2::AccelGroup;");
                $class->add_to_UI($depth, 
                    "${current_form}\{'accelgroup'}->attach(\$widgets->{'$childname'});");
                $postpone_show = 1;
            } else {
                die sprintf(("\nerror %s - Unable to find a widget called '%s' - ".
                    "I can not pack widget '%s' into a non-existant widget!"),
                    $me, $parentname, $childname);
            }
        }
        if ($postpone_show) {
            # Do nothing
            
#---------------------------------------
        } elsif (' Gtk2::ImageMenuItem ' =~ m/ $refpar / && 
            ' Gtk2::Image ' =~ m/ $refwid / ) {
#            $class->use_par($proto->{'packing'}, 'type', $NOT_WIDGET|$MAYBE)) {
#print "We have a $refpar to pack into\n";
            $class->add_to_UI($depth, 
                "${current_form}\{'$parentname'}->set_image(".
                    "\$widgets->{'$childname'});");
#            $class->add_to_UI($depth, 
#                "\$widgets->{'$childname'} = ".
#                    "${current_form}\{'$parentname'}->get_image();");
                    

Glade/Two/Generate.pm  view on Meta::CPAN

#            $Glade_Perl->diag_print(2, $proto);
            my $x      = $class->use_par($proto->{'packing'}, 'x', $NOT_WIDGET);
            my $y      = $class->use_par($proto->{'packing'}, 'y', $NOT_WIDGET);
#            my $width  = $class->use_par($proto, 'width');
#            my $height = $class->use_par($proto, 'height');
            $class->add_to_UI($depth, 
                "${current_form}\{'$parentname'}->put(".
                    "\$widgets->{'$childname'}, $x, $y);");

#---------------------------------------
        } elsif (' Gtk2::MenuBar Gtk2::Menu ' =~ m/ $refpar /) {
            # We are a menuitem
            $class->add_to_UI($depth, 
                "${current_form}\{'$parentname'}->append(".
                    "\$widgets->{'$childname'});");

#---------------------------------------
        } elsif (' Gtk2::MenuItem Gtk2::PixmapMenuItem ' =~ m/ $refpar /) {
            # We are a menu for a meuitem
            $class->add_to_UI($depth, 
                "${current_form}\{'$parentname'}->set_submenu(".
                    "\$widgets->{'$childname'});");
            $postpone_show = 1;

#---------------------------------------
        } elsif (' Gtk2::OptionMenu ' =~ m/ $refpar /) {
            # We are a menu for an optionmenu
            $class->add_to_UI($depth, 
                "${current_form}\{'$parentname'}->set_menu(".
                    "\$widgets->{'$childname'});");
            $postpone_show = 1;

#---------------------------------------
        } elsif (' Gtk2::Notebook ' =~ m/ $refpar /) {
#print $childname," ",Dumper($proto->{'packing'});
            $child_type = $class->use_par($proto->{'packing'}, 'type', $MAYBE|$NOT_WIDGET);

Glade/Two/Generate.pm  view on Meta::CPAN

                        "\$widgets->{'$childname'});");
            
            } elsif (' Gnome::Dock ' =~ m/ $refwid /) {
# FIXME why have I commented this out? Is it because Gnome::Dock should not
# be constructed within a Gnome::App - add Gnome::DockItems by using method
# Gnome::App::add_docked() or Gnome::App::add_dock_item() instead?
#                $class->add_to_UI($depth, 
#                    "${current_form}\{'$parentname'}->set_contents(".
#                        "\$widgets->{'$childname'});");

            } elsif (' Gtk2::MenuBar ' =~ m/ $refwid /) {
                $class->add_to_UI($depth, 
                    "${current_form}\{'$parentname'}->set_menus(".
                        "\$widgets->{'$childname'});");

            } else {
                $Glade_Perl->diag_print (1, 
                    "error Don't know how to pack %s %s (type '%s') - what should I do?",
                    $refwid, "${current_form}\{'${childname}'}{'child_name'}", $type);
            }
                        

Glade/Two/Generate.pm  view on Meta::CPAN

                'default_focus_target' => 'mnemonic_widget',
                'focus_target'      => 'mnemonic_widget',
            },
            'GtkLayout'         => {
                'area_width'        => 'width',
                'area_height'       => 'height',
            },
            'GtkList'           => {
                $WIDGET             => $BROKEN,
            },
            'GtkMenuBar'        => {
                'shadow_type'       => $OBSOLETE,
            },
            'GtkMenuItem'       => {
                'right_justify'     => $OBSOLETE,
            },
            'GtkNotebook'       => {
                'popup_enable'      => 'enable-popup',
            },
            'GtkOptionMenu'     => {
                'initial_choice'    => 'history',
            },
            'GtkPacker'         => {
                $WIDGET             => $REMOVED,
            },
            'GtkPixmap'         => {
                $WIDGET             => $DEPRECATED,
                $CONVERT_TO         => 'GtkImage',
            },
            'GtkPixmapMenuItem' => {
                $WIDGET             => $REMOVED,
            },
            'GtkRange'          => {
                'policy'            => 'update-policy',
            },
            'GtkSpinButton'     => {
                'snap'              => 'snap_to_ticks',
            },
            'GtkTable'          => {
                $CHILD              => {

Glade/Two/Gtk.pm  view on Meta::CPAN


#    unless ($class->get_internal_child($parent, $name, $proto, $depth)) {
        $class->add_to_UI($depth,  "\$widgets->{'$name'} = new Gtk2::List;");
#    }
    $class->use_set_property($name, $proto, 'selection_mode', $LOOKUP, $depth);

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

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

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

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

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

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

    $class->use_set_property($name, $proto, 'shadow_type', $LOOKUP, $depth);

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

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

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

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

sub new_GtkImageMenuItem {
    my ($class, $parent, $proto, $depth) = @_;
    my $me = "$class->new_GtkImageMenuItem";
    my $name = $proto->{'widget'}{'name'};
    my $label = $class->use_par($proto, 'label', $DEFAULT, '');

    if ($proto->{'widget'}{'property'}{'stock'}) {
        # This is a stock menu item
        my $stock = $class->use_par($proto, 'stock', $MAYBE);
#        $label = Glade::Gnome->lookup($stock_item);
#        $stock_item = $Glade::Gnome::gnome_enums->{"GNOME_STOCK_PIXMAP_$stock_item"};
        $class->add_to_UI($depth, "\$widgets->{'$name'} = ".
            "Gtk2::ImageMenuItem->new_from_stock('$stock', 
                $current_form\{'accelgroup'});");
    } elsif ($label) {
        if ($class->use_par($proto, 'use_underline', $BOOL)) {
            $class->add_to_UI($depth, "\$widgets->{'$name'} = ".
                "new_with_mnemonic Gtk2::ImageMenuItem(_('$label'));");
        } else {
            $class->add_to_UI($depth, "\$widgets->{'$name'} = ".
                "new_with_label Gtk2::ImageMenuItem(_('$label'));");
        }
    } else {
        $class->add_to_UI($depth, "\$widgets->{'$name'} = ".
            "new Gtk2::ImageMenuItem;");
    }
    $class->load_class("Gtk2::AccelLabel");
    
    $class->set_label_properties($parent, $name, $proto, $depth);
    $class->pack_widget($parent, $name, $proto, $depth);

    return $widgets->{$name};
}

sub new_GtkListItem {

Glade/Two/Gtk.pm  view on Meta::CPAN

            "_('$label'));");
    } else {
        $class->add_to_UI($depth, "\$widgets->{'$name'} = new Gtk2::ListItem;");
    }
    $class->set_label_properties($parent, $name, $proto, $depth);
    $class->pack_widget($parent, $name, $proto, $depth);

    return $widgets->{$name};
}

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

    $class->load_class("Gtk2::AccelLabel");
    if ($proto->{'widget'}{'property'}{'stock_item'}) {
# FIXME - this is a Gnome stock menu item and should be in Gnome
        my $stock_item = $class->use_par($proto, 'stock_item', $DEFAULT, '');
        $proto->{'widget'}{'property'}{'label'} = 
            {'value' => Glade::Gnome->lookup($stock_item)};
#        $label = Glade::Gnome->lookup($stock_item);
#        $stock_item = $Glade::Gnome::gnome_enums->{"GNOME_STOCK_PIXMAP_$stock_item"};
#        $class->add_to_UI($depth, "\$widgets->{'$name'} = ".
#            "Gnome::Stock->menu_item('$stock_item', '$stock_item');");
    }
    my $use_underline = $class->use_par($proto, 'use_underline', $BOOL|$MAYBE);
    my $label = $class->use_par($proto, 'label', $DEFAULT, '');
    if ($label) {
        if ($use_underline) {
            $class->add_to_UI($depth, "\$widgets->{'$name'} = ".
                "new_with_mnemonic Gtk2::MenuItem(_('$label'));");
        } else {
            $class->add_to_UI($depth, "\$widgets->{'$name'} = ".
                "new_with_label Gtk2::MenuItem(_('$label'));");
        }
    } else {
        $class->add_to_UI($depth, "\$widgets->{'$name'} = new Gtk2::MenuItem();");
    }
    $class->set_label_properties($parent, $name, $proto, $depth);
    $class->pack_widget($parent, $name, $proto, $depth);

    return $widgets->{$name};
}

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

    $class->load_class("Gtk2::AccelLabel");

    my $use_underline = $class->use_par($proto, 'use_underline', $BOOL|$MAYBE);
    my $label  = $class->use_par($proto, 'label',  $DEFAULT, '');
    if ($label) {
        if ($use_underline) {
            $class->add_to_UI($depth, "\$widgets->{'$name'} = ".
                "new_with_mnemonic Gtk2::CheckMenuItem(_('$label'));");
        } else {
            $class->add_to_UI($depth, "\$widgets->{'$name'} = ".
                "new_with_label Gtk2::CheckMenuItem(_('$label'));");
        }
    } else {
        $class->add_to_UI($depth, "\$widgets->{'$name'} = new Gtk2::CheckMenuItem();");
    }
#    $class->add_to_UI($depth,  "\$widgets->{'$name'} = ".
#        "new Gtk2::CheckMenuItem();");

#    if ($class->use_par($proto, 'right_justify',    $BOOL, 'False')) {
#        $class->add_to_UI($depth, "\$widgets->{'$name'}->right_justify;");
#    }
    $class->use_set_property($name, $proto, 'active', $BOOL, $depth);
    $class->use_set_property($name, $proto, 'always_show_toggle', $BOOL, $depth, 'set_show_toggle');

    $class->set_label_properties($parent, $name, $proto, $depth);
    $class->pack_widget($parent, $name, $proto, $depth);

    return $widgets->{$name};
}


sub new_GtkRadioMenuItem {
    my ($class, $parent, $proto, $depth) = @_;
    my $me = "$class->new_GtkRadioMenuItem";
    my $name = $proto->{'widget'}{'name'};
    my $label  = $class->use_par($proto, 'label', $DEFAULT, '');
    my $use_underline = $class->use_par($proto, 'use_underline',  $MAYBE);
    $class->load_class("Gtk2::AccelLabel");
    my $method;
    if ($use_underline) {
        $method = "new_with_mnemonic";
    } else {
        $method = "new_with_label";
    }
    my $group  = $class->use_par($proto, 'group',  $DEFAULT, $name);
    my $group_widget = "$current_form\{'rb_group'}{'$group'}";
    if (eval "defined $group_widget") {
        $class->add_to_UI($depth,  "\$widgets->{'$name'} = ".
            "$method Gtk2::RadioMenuItem($group_widget->get_group(), _('$label'));");
    } else {
        $class->add_to_UI($depth,  "\$widgets->{'$name'} = ".
            "$method Gtk2::RadioMenuItem(undef, _('$label'));");

        $class->add_to_UI($depth, "$group_widget = \$widgets->{'$name'};");
    }

    $class->use_set_property($name, $proto, 'active', $BOOL, $depth);
    $class->use_set_property($name, $proto, 'always_show_toggle', $BOOL, $depth, 'set_show_toggle');

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

Glade/Two/Gtk.pm  view on Meta::CPAN

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

    $class->add_to_UI($depth, "\$widgets->{'$name'} = new Gtk2::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->{'widget'}{'name'};
    my $item;
    my @items;
    my $count = 0;
    my $items          = $class->use_par($proto, 'items');
    my $history = $class->use_par($proto, 'history', $DEFAULT, 0);

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

    $class->add_to_UI($depth,  "\$widgets->{'${name}_menu'} = new Gtk2::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 Gtk2::MenuItem('$item');");
                $class->pack_widget("${name}_menu", "${name}_item$count", $proto, $depth+1);
                if ($count == $history) {
                    $class->add_to_UI($depth, 
                        "${current_form}\{'${name}_item$count'}\->activate;");
                }
                $count++;
            }
        }
        $class->add_to_UI($depth, 
            "${current_form}\{'$name'}->set_history( $history);");



( run in 1.093 second using v1.01-cache-2.11-cpan-49f99fa48dc )