FBP-Perl
view release on metacpan or search on metacpan
lib/FBP/Perl.pm view on Meta::CPAN
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);
} elsif ( $window->isa('FBP::Slider') ) {
$lines = $self->slider_create($window, $parent);
} elsif ( $window->isa('FBP::SpinButton') ) {
$lines = $self->spinbutton_create($window, $parent);
} elsif ( $window->isa('FBP::SpinCtrl') ) {
$lines = $self->spinctrl_create($window, $parent);
} elsif ( $window->isa('FBP::SplitterWindow') ) {
$lines = $self->splitterwindow_create($window, $parent);
lib/FBP/Perl.pm view on Meta::CPAN
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,
");",
);
}
sub choicebook_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);
return $self->nested(
$self->object_new($control),
"$parent,",
"$id,",
"$position,",
"$size,",
$self->window_style($control),
");",
);
}
sub combobox_create {
my $self = shift;
my $control = shift;
my $parent = $self->object_parent(@_);
my $id = $self->object_id($control);
my $value = $self->quote( $control->value );
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,",
"$value,",
"$position,",
"$size,",
$items,
$self->window_style($control),
");",
);
}
sub colourpickerctrl_create {
my $self = shift;
my $control = shift;
my $parent = $self->object_parent(@_);
my $id = $self->object_id($control);
my $colour = $self->colour( $control->colour );
my $position = $self->object_position($control);
my $size = $self->object_wxsize($control);
# Wx::ColourPickerCtrl does not support defaulting null colours.
# Use an explicit black instead until we find a better option.
if ( $colour eq 'undef' ) {
$colour = $self->colour('0,0,0');
}
return $self->nested(
$self->object_new($control),
"$parent,",
"$id,",
"$colour,",
"$position,",
"$size,",
$self->window_style($control),
");",
);
}
# Completely generic custom control
sub customcontrol_create {
my $self = shift;
my $control = shift;
my $parent = $self->object_parent(@_);
my $id = $self->object_id($control);
return $self->nested(
$self->object_new($control),
"$parent,",
"$id,",
( run in 3.147 seconds using v1.01-cache-2.11-cpan-98e64b0badf )