Glade-Perl-Two
view release on metacpan or search on metacpan
Glade/Two/Generate.pm view on Meta::CPAN
foreach $work (split(/\|/, $string)) {
$work =~ s/\s*//g; # Trim off any whitespace
$work = Glade::Two::Gtk->lookup($work);
push @elements, $work;
}
my $arrayref_string = "[]";
$arrayref_string = "['".join("', '", @elements)."']" if scalar @elements;
return $arrayref_string;
}
sub internal_pack_widget {
my ($class, $parentname, $childname, $proto, $depth) = @_;
my $me = (ref $class || $class)."->internal_pack_widget";
# return if $proto->{'internal-child'};
my $refpar;
# When we add/pack/append we do it to ${current_form}->{$parentname}
# rather than $widgets->{$parentname} so that we are sure that everything
# is packed in the right order and we can check for duplicate names
my $refwid = (ref $widgets->{$childname});
my $child_type;
my $postpone_show;
if ($current_form && eval "exists ${current_form}\{'$childname'}") {
die sprintf(("\nerror %s - There is already a widget called ".
"'%s' constructed and packed - I will not overwrite it !"),
$me, $childname);
}
if ($proto->{'internal-child'}) {
if ($widgets->{$childname}) {
# Nothing to pack just tidy up
delete $failures->{$INTERNAL_CHILD}{$parentname}{$proto->{'internal-child'}};
}
} elsif (" $Glade_Perl->{'widgets'}{'dialogs'} $Glade_Perl->{'widgets'}{'toplevel'} " =~ m/ $refwid /) {
# We are a window so don't have a parent to pack into
$Glade_Perl->diag_print (4, "%s- Constructing a toplevel component ".
"(window/dialog) '%s'", $indent, $childname);
# $child_type = $widgets->{$childname}->type;
# if (' toplevel dialog '=~ m/ $child_type /) {
# Add a default delete_event signal connection
$class->load_class("Gtk2::Tooltips;");
$class->add_to_UI($depth,
"${current_form}\{'tooltips'} = new Gtk2::Tooltips;");
$class->load_class("Gtk2::AccelGroup;");
$class->add_to_UI($depth,
"${current_form}\{'accelgroup'} = new Gtk2::AccelGroup;");
$class->add_to_UI($depth,
"\$widgets->{'$childname'}->add_accel_group(${current_form}\{'accelgroup'});");
# "${current_form}\{'accelgroup'}->attach(\$widgets->{'$childname'});");
# } else {
# 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();");
#---------------------------------------
} elsif (" $Glade_Perl->{'widgets'}{'composite'} " =~ m/ $refpar /) {
# We do not need to do anything for this widget
# $class->use_par($proto->{'packing'}, 'type', $NOT_WIDGET|$MAYBE)) {
#---------------------------------------
} elsif (' Gtk2::HPaned Gtk2::VPaned ' =~ m/ $refpar /) {
my $resize = $class->use_par($proto->{'packing'}, 'resize', $BOOL|$NOT_WIDGET, 'False');
my $shrink = $class->use_par($proto->{'packing'}, 'shrink', $BOOL|$NOT_WIDGET, 'True');
if (eval "${current_form}\{$FIRST_PANE_FULL}{'$parentname'}") {
$class->add_to_UI($depth,
"${current_form}\{'$parentname'}->pack2(".
"\$widgets->{'$childname'}, $resize, $shrink);");
} else {
$class->add_to_UI($depth,
"${current_form}\{'$parentname'}->pack1(".
"\$widgets->{'$childname'}, $resize, $shrink);");
# print "${current_form}\{$FIRST_PANE_FULL}{'$parentname'} = 1;\n";
eval "${current_form}\{$FIRST_PANE_FULL}{'$parentname'} = 1;";
}
#---------------------------------------
} elsif (eval "${current_form}\{'$parentname'}->can(".
"'pack_start')") {# and !defined $proto->{'child_name'}) {
# We have a '$refpar' widget '$parentname' that can pack_start
my $ignore = $class->use_par($proto, 'child_name', $DEFAULT, '');
my $pack_type = $class->use_par($proto->{'packing'}, 'pack_type', $LOOKUP|$NOT_WIDGET, 'start');
my $expand = $class->use_par($proto->{'packing'}, 'expand', $BOOL|$NOT_WIDGET, 'False');
my $fill = $class->use_par($proto->{'packing'}, 'fill', $BOOL|$NOT_WIDGET, 'False');
my $padding = $class->use_par($proto->{'packing'}, 'padding', $DEFAULT|$NOT_WIDGET, 0);
$class->add_to_UI($depth,
"${current_form}\{'$parentname'}->pack_$pack_type(".
Glade/Two/Generate.pm view on Meta::CPAN
'GtkGammaCurve' => {
'curve_type' => $OBSOLETE,
'max_x' => $OBSOLETE,
'max_y' => $OBSOLETE,
'min_' => $OBSOLETE,
'min_y' => $OBSOLETE,
},
'GtkHPaned' => {
'handle_size' => $OBSOLETE,
'gutter_size' => $OBSOLETE,
},
'GtkVPaned' => {
'handle_size' => $OBSOLETE,
'gutter_size' => $OBSOLETE,
},
'GtkHScale' => {
'policy' => $OBSOLETE,
},
'GtkVScale' => {
'policy' => $OBSOLETE,
},
'GtkHScrollbar' => {
'policy' => $OBSOLETE,
},
'GtkVScrollbar' => {
'policy' => $OBSOLETE,
},
'GtkHRuler' => {
'metric' => $OBSOLETE,
},
'GtkVRuler' => {
'metric' => $OBSOLETE,
},
'GtkHandleBox' => {
'shadow_type' => 'shadow',
},
'GtkImage' => {
'image_width' => $OBSOLETE,
'image_height' => $OBSOLETE,
'image_visual' => $OBSOLETE,
'image_type' => $OBSOLETE,
},
'GtkLabel' => {
'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 => {
'xpad' => 'x_padding',
'ypad' => 'y_padding',
},
'rows' => 'n-rows',
'columns' => 'n-columns',
},
'GtkText' => {
$WIDGET => $BROKEN,
},
'GtkToolbar' => {
'space_size' => $OBSOLETE,
'space_style' => $OBSOLETE,
'relief' => $OBSOLETE,
'tooltips' => $OBSOLETE,
'type' => 'toolbar-style',
},
'GtkTree' => {
$WIDGET => $BROKEN,
},
'GtkTreeItem' => {
$WIDGET => $BROKEN,
},
'GtkWindow' => {
'auto_shrink' => $OBSOLETE,
'position' => 'window-position',
},
'GnomeCalculator' => {
$WIDGET => $REMOVED,
},
'GnomeDialog' => {
$WIDGET => $DEPRECATED,
},
'GnomeDruidPageStandard' => {
'title_color' => 'title_foreground',
'background_color' => 'background',
'logo_background_color' => 'logo_background',
'logo_image' => 'logo',
},
( run in 1.341 second using v1.01-cache-2.11-cpan-364913b4093 )