FBP-Perl
view release on metacpan or search on metacpan
lib/FBP/Perl.pm view on Meta::CPAN
next if $done{$method}++;
push @methods, $self->object_event($object, $event);
}
}
# Convert back to a single block of lines
return [
map { ( "", @$_ ) } grep { scalar @$_ } @methods
];
}
######################################################################
# Window and Control Generators
sub children_create {
my $self = shift;
my $object = shift;
my $parent = shift;
my @windows = ();
foreach my $child ( @{$object->children} ) {
# Skip elements we create outside the main recursion
next if $child->isa('FBP::StatusBar');
if ( $child->isa('FBP::Window') ) {
push @windows, $self->window_create($child, $parent);
} elsif ( $child->isa('FBP::StdDialogButtonSizer') ) {
push @windows, $self->stddialogbuttonsizer_create($child, $parent);
}
# Descend to child windows
next unless $child->does('FBP::Children');
if ( $object->isa('FBP::Window') ) {
push @windows, $self->children_create($child, $object);
} else {
push @windows, $self->children_create($child, $parent);
}
}
return @windows;
}
sub window_create {
my $self = shift;
my $window = shift;
my $parent = shift;
my $lines = undef;
if ( $window->isa('FBP::AnimationCtrl') ) {
$lines = $self->animationctrl_create($window, $parent);
} elsif ( $window->isa('FBP::BitmapButton') ) {
$lines = $self->bitmapbutton_create($window, $parent);
} elsif ( $window->isa('FBP::Button') ) {
$lines = $self->button_create($window, $parent);
} elsif ( $window->isa('FBP::CalendarCtrl') ) {
$lines = $self->calendarctrl_create($window, $parent);
} elsif ( $window->isa('FBP::CheckBox') ) {
$lines = $self->checkbox_create($window, $parent);
} elsif ( $window->isa('FBP::Choice') ) {
$lines = $self->choice_create($window, $parent);
} elsif ( $window->isa('FBP::Choicebook') ) {
$lines = $self->choicebook_create($window, $parent);
} elsif ( $window->isa('FBP::ComboBox') ) {
$lines = $self->combobox_create($window, $parent);
} elsif ( $window->isa('FBP::ColourPickerCtrl') ) {
$lines = $self->colourpickerctrl_create($window, $parent);
} elsif ( $window->isa('FBP::CustomControl' ) ) {
$lines = $self->customcontrol_create($window, $parent);
} elsif ( $window->isa('FBP::DatePickerCtrl') ) {
die "Wx::DatePickerCtrl is not supported by Wx.pm";
$lines = $self->datepickerctrl_create($window, $parent);
} elsif ( $window->isa('FBP::DirPickerCtrl') ) {
$lines = $self->dirpickerctrl_create($window, $parent);
} elsif ( $window->isa('FBP::FilePickerCtrl') ) {
$lines = $self->filepickerctrl_create($window, $parent);
} elsif ( $window->isa('FBP::FontPickerCtrl') ) {
$lines = $self->fontpickerctrl_create($window, $parent);
} elsif ( $window->isa('FBP::Gauge') ) {
$lines = $self->gauge_create($window, $parent);
} elsif ( $window->isa('FBP::GenericDirCtrl') ) {
$lines = $self->genericdirctrl_create($window, $parent);
} elsif ( $window->isa('FBP::Grid') ) {
$lines = $self->grid_create($window, $parent);
} elsif ( $window->isa('FBP::HtmlWindow') ) {
$lines = $self->htmlwindow_create($window, $parent);
} elsif ( $window->isa('FBP::HyperlinkCtrl') ) {
$lines = $self->hyperlink_create($window, $parent);
} elsif ( $window->isa('FBP::Listbook') ) {
# We emulate the creation of simple listbooks via treebooks
if ( $window->wxclass eq 'Wx::Treebook' ) {
$lines = $self->treebook_create($window, $parent);
} else {
$lines = $self->listbook_create($window, $parent);
}
} elsif ( $window->isa('FBP::ListBox') ) {
$lines = $self->listbox_create($window, $parent);
} elsif ( $window->isa('FBP::ListCtrl') ) {
$lines = $self->listctrl_create($window, $parent);
} elsif ( $window->isa('FBP::MenuBar') ) {
$lines = $self->menubar_create($window, $parent);
} elsif ( $window->isa('FBP::Notebook') ) {
$lines = $self->notebook_create($window, $parent);
} elsif ( $window->isa('FBP::Panel') ) {
$lines = $self->panel_create($window, $parent);
} elsif ( $window->isa('FBP::RadioBox') ) {
$lines = $self->radiobox_create($window, $parent);
} elsif ( $window->isa('FBP::RadioButton') ) {
$lines = $self->radiobutton_create($window, $parent);
} elsif ( $window->isa('FBP::RichTextCtrl') ) {
$lines = $self->richtextctrl_create($window, $parent);
} elsif ( $window->isa('FBP::ScrollBar') ) {
$lines = $self->scrollbar_create($window, $parent);
} elsif ( $window->isa('FBP::ScrolledWindow') ) {
$lines = $self->scrolledwindow_create($window, $parent);
} elsif ( $window->isa('FBP::SearchCtrl') ) {
$lines = $self->searchctrl_create($window, $parent);
lib/FBP/Perl.pm view on Meta::CPAN
");",
);
}
if ( $selected ne $null ) {
push @$lines, (
"$variable->SetBitmapSelected(",
"\t$selected",
");",
);
}
if ( $hover ne $null ) {
push @$lines, (
"$variable->SetBitmapHover(",
"\t$hover",
");",
);
}
if ( $focus ne $null ) {
push @$lines, (
"$variable->SetBitmapFocus(",
"\t$focus",
");",
);
}
if ( $control->default ) {
push @$lines, "$variable->SetDefault;";
}
return $lines;
}
sub button_create {
my $self = shift;
my $control = shift;
my $parent = $self->object_parent(@_);
my $id = $self->object_id($control);
my $label = $self->object_label($control);
my $position = $self->object_position($control);
my $size = $self->object_wxsize($control);
my $variable = $self->object_variable($control);
my $lines = $self->nested(
$self->object_new($control),
"$parent,",
"$id,",
"$label,",
"$position,",
"$size,",
$self->window_style($control),
");",
);
if ( $control->default ) {
push @$lines, "$variable->SetDefault;";
}
return $lines;
}
sub calendarctrl_create {
my $self = shift;
my $control = shift;
my $parent = $self->object_parent(@_);
my $id = $self->object_id($control);
# my $value = $self->wx('wxDefaultDateTime'); # NOT IMPLEMENTED
my $value = 'Wx::DateTime->new'; # Believed to be equivalent
my $position = $self->object_position($control);
my $size = $self->object_wxsize($control);
return $self->nested(
$self->object_new($control),
"$parent,",
"$id,",
"$value,",
"$position,",
"$size,",
$self->window_style($control),
");",
);
}
sub checkbox_create {
my $self = shift;
my $control = shift;
my $parent = $self->object_parent(@_);
my $id = $self->object_id($control);
my $label = $self->object_label($control);
my $position = $self->object_position($control);
my $size = $self->object_wxsize($control);
return $self->nested(
$self->object_new($control),
"$parent,",
"$id,",
"$label,",
"$position,",
"$size,",
$self->window_style($control),
");",
);
}
sub choice_create {
my $self = shift;
my $control = shift;
my $parent = $self->object_parent(@_);
my $id = $self->object_id($control);
my $position = $self->object_position($control);
my $size = $self->object_wxsize($control);
my $items = $self->control_items($control);
return $self->nested(
$self->object_new($control),
"$parent,",
"$id,",
"$position,",
"$size,",
$items,
");",
);
( run in 2.206 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )