r28333 - in /trunk/libwx-perl-dialog-perl: Build.PL Changes MANIFEST META.yml Makefile.PL debian/changelog eg/12_multitab.pl inc/ lib/Wx/Perl/Dialog.pm lib/Wx/Perl/Dialog/Frame.pm lib/Wx/Perl/Dialog/Simple.pm lib/Wx/Perl/Dialog/SingleChoice.pm
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Wed Dec 17 19:16:54 UTC 2008
Author: gregoa
Date: Wed Dec 17 19:16:51 2008
New Revision: 28333
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=28333
Log:
New upstream release.
Added:
trunk/libwx-perl-dialog-perl/Makefile.PL
- copied unchanged from r28332, branches/upstream/libwx-perl-dialog-perl/current/Makefile.PL
trunk/libwx-perl-dialog-perl/eg/12_multitab.pl
- copied unchanged from r28332, branches/upstream/libwx-perl-dialog-perl/current/eg/12_multitab.pl
trunk/libwx-perl-dialog-perl/inc/
- copied from r28332, branches/upstream/libwx-perl-dialog-perl/current/inc/
Removed:
trunk/libwx-perl-dialog-perl/Build.PL
Modified:
trunk/libwx-perl-dialog-perl/Changes
trunk/libwx-perl-dialog-perl/MANIFEST
trunk/libwx-perl-dialog-perl/META.yml
trunk/libwx-perl-dialog-perl/debian/changelog
trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog.pm
trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Frame.pm
trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Simple.pm
trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/SingleChoice.pm
Modified: trunk/libwx-perl-dialog-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwx-perl-dialog-perl/Changes?rev=28333&op=diff
==============================================================================
--- trunk/libwx-perl-dialog-perl/Changes (original)
+++ trunk/libwx-perl-dialog-perl/Changes Wed Dec 17 19:16:51 2008
@@ -1,3 +1,7 @@
+v0.04 2008.12.13
+ Add FontPickerCtrl and ColourPickerCtrl (HJANSEN)
+ Switching to use Module::Install (SZABGAB)
+
v0.03 2008.11.23
Add support to wxTextCtrl, add wxStaticLine (KAARE)
Modified: trunk/libwx-perl-dialog-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwx-perl-dialog-perl/MANIFEST?rev=28333&op=diff
==============================================================================
--- trunk/libwx-perl-dialog-perl/MANIFEST (original)
+++ trunk/libwx-perl-dialog-perl/MANIFEST Wed Dec 17 19:16:51 2008
@@ -1,20 +1,4 @@
-Build.PL
Changes
-MANIFEST
-README
-META.yml
-
-lib/Wx/Perl/Dialog.pm
-lib/Wx/Perl/Dialog/Simple.pm
-lib/Wx/Perl/Dialog/Frame.pm
-lib/Wx/Perl/Dialog/SingleChoice.pm
-
-t/01-load.t
-
-xt/99-critic.t
-xt/90-pod.t
-
-eg/wxer
eg/01_prompt.pl
eg/02_password.pl
eg/03_filename.pl
@@ -26,3 +10,25 @@
eg/09_file_picker.pl
eg/10_date_picker.pl
eg/11_colour_picker.pl
+eg/12_multitab.pl
+eg/wxer
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Share.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+lib/Wx/Perl/Dialog.pm
+lib/Wx/Perl/Dialog/Frame.pm
+lib/Wx/Perl/Dialog/Simple.pm
+lib/Wx/Perl/Dialog/SingleChoice.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/01-load.t
+xt/90-pod.t
+xt/99-critic.t
Modified: trunk/libwx-perl-dialog-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwx-perl-dialog-perl/META.yml?rev=28333&op=diff
==============================================================================
--- trunk/libwx-perl-dialog-perl/META.yml (original)
+++ trunk/libwx-perl-dialog-perl/META.yml Wed Dec 17 19:16:51 2008
@@ -1,16 +1,32 @@
---
+abstract: 'Abstract dialog class for simple dialog creation'
+author:
+ - 'Gabor Szabo'
+build_requires:
+ ExtUtils::MakeMaker: 6.11
+ Test::Exception: 0.27
+ Test::More: 0.47
+ Test::NeedsDisplay: 1.05
+ Test::NoWarnings: 0.084
+distribution_type: module
+generated_by: 'Module::Install version 0.77'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
name: Wx-Perl-Dialog
-version: 0.03
-author:
- - Gabor Szabo
-abstract: Abstract dialog class for simple dialog creation
-license: perl
-resources:
- MailingList: http://mail.perlide.org/mailman/listinfo/padre-dev
- Repository: http://svn.perlide.org/padre
- bugtracker: http://padre.perlide.org/
- homepage: http://padre.perlide.org/
- license: http://dev.perl.org/licenses/
+no_index:
+ directory:
+ -
+ - t
+ - xt
+ - eg
+ - share
+ - inc
+ - privinc
+ - eg
+ - inc
+ - t
requires:
Exporter: 0
File::Copy::Recursive: 0
@@ -19,30 +35,10 @@
FindBin: 0
Wx: 0
Wx::Perl::ProcessStream: 0
- perl: 5.008
-build_requires:
- Test::Exception: 0
- Test::More: 0.47
- Test::NoWarnings: 0
-provides:
- Wx::Perl::Dialog:
- file: lib/Wx/Perl/Dialog.pm
- version: 0.03
- Wx::Perl::Dialog::Frame:
- file: lib/Wx/Perl/Dialog/Frame.pm
- version: 0.03
- Wx::Perl::Dialog::Simple:
- file: lib/Wx/Perl/Dialog/Simple.pm
- version: 0.03
- Wx::Perl::Dialog::SingleChoice:
- file: lib/Wx/Perl/Dialog/SingleChoice.pm
- version: 0.03
-generated_by: Module::Build version 0.280801
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.2.html
- version: 1.2
-no_index:
- directory:
- - t
- - eg
- - share
+ perl: 5.008001
+resources:
+ bugtracker: http://padre.perlide.org/
+ homepage: http://padre.perlide.org/
+ license: http://dev.perl.org/licenses/
+ repository: http://svn.perlide.org/padre/trunk/Wx-Perl-Dialog
+version: 0.04
Modified: trunk/libwx-perl-dialog-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwx-perl-dialog-perl/debian/changelog?rev=28333&op=diff
==============================================================================
--- trunk/libwx-perl-dialog-perl/debian/changelog (original)
+++ trunk/libwx-perl-dialog-perl/debian/changelog Wed Dec 17 19:16:51 2008
@@ -1,3 +1,9 @@
+libwx-perl-dialog-perl (0.04-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org> Wed, 17 Dec 2008 20:15:23 +0100
+
libwx-perl-dialog-perl (0.03-1) unstable; urgency=low
* New upstream release.
Modified: trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog.pm?rev=28333&op=diff
==============================================================================
--- trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog.pm (original)
+++ trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog.pm Wed Dec 17 19:16:51 2008
@@ -4,7 +4,7 @@
use strict;
use warnings;
-our $VERSION = '0.03';
+our $VERSION = '0.04';
use Wx ':everything';
@@ -38,6 +38,20 @@
my $data = $dialog->get_data;
+ #### You may also create a tabbed dialog for more complex tasks:
+
+ my $tabbed_dialog = Wx::Perl::Dialog->new(
+ parent => $win,
+ title => 'Widgetry dialog',
+ layout => [ $layout_a, $layout_b, ]
+ multipage => {
+ auto_ok_cancel => 1,
+ ok_widgetid => '_ok_',
+ cancel_widgetid => '_cancel_',
+ pagenames => [ 'Basic', 'Advanced' ]
+ },
+ );
+
Where $win is the Wx::Frame of your application.
=head1 B<WARNING>
@@ -63,7 +77,7 @@
The rest of the values in the array depend on the widget.
-Supported widgets and their parameters:
+=head2 Supported widgets and their parameters
=over 4
@@ -88,7 +102,45 @@
3. array ref for list of values
+=item Wx::FontPickerCtrl
+
+ 3. A string describing the font
+
+=item Wx::ColourPickerCtrl
+
+ 3. A HTML-compatible colour description string: '#' plus 6 hex digits; i.e. #FF0000
+
=back
+
+=head2 Multipage Layout (with a Wx::Notebook)
+
+If you pass in a parameter 'multipage', a tabbed dialog will be created using a
+Wx::Notebook.
+The value of the 'layout' parameter will be interpreted as an arrayref where each
+value represents the contents of one page (see section "Layout").
+
+The value of the 'multipage' param should be a hash containing extra options.
+
+=over 4
+
+=item auto_ok_cancel
+
+ If set to a true value, an OK and a CANCEL button will be displayed automatically
+ below the tabbed pages.
+
+=item ok_widgetid
+
+ An identifier for the automatically genereated OK button.
+ Useful if you want to have access to the button via
+ $dialog->{_widgets_}{<ok_widgetid>}
+
+=item cancel_widgetid
+
+ Same as above but for the CANCEL button
+
+=item pagenames
+
+ An arrayref of strings which represent the tab titles.
=head1 METHODS
@@ -114,11 +166,18 @@
bottom => 20,
right => 5,
element_spacing => [0, 5],
+ multipage => undef,
);
%args = (%default, %args);
my $self = $class->SUPER::new( @args{qw(parent id title pos size style)});
- $self->_build_layout( map {$_ => $args{$_} } qw(layout width top left bottom right element_spacing) );
+ if ( defined( $args{multipage} ) ) {
+ $self->_build_multipage_layout( map {$_ => $args{$_} } qw(layout width top left bottom right element_spacing multipage) );
+ $self->{_multipage_} = $args{multipage};
+ }
+ else {
+ $self->_build_layout( map {$_ => $args{$_} } qw(layout width top left bottom right element_spacing) );
+ }
$self->{_layout_} = $args{layout};
return $self;
@@ -137,7 +196,27 @@
my ( $dialog ) = @_;
my $layout = $dialog->{_layout_};
- my %data;
+ my %data = ();
+
+ if ( $dialog->{_multipage_} ) {
+ foreach my $tab ( @$layout ) {
+ %data = ( %data, _extract_data( $dialog, $tab ) );
+ }
+ }
+ else {
+ %data = _extract_data( $dialog, $layout );
+ }
+
+ return \%data;
+}
+
+# Internal function
+#
+
+sub _extract_data {
+ my( $dialog, $layout ) = @_;
+ my %data = ();
+
foreach my $i (0..@$layout-1) {
foreach my $j (0..@{$layout->[$i]}-1) {
next if not @{ $layout->[$i][$j] }; # [] means Expand
@@ -151,6 +230,10 @@
$data{$name} = $dialog->{_widgets_}{$name}->GetPath;
} elsif ($class eq 'Wx::Choice') {
$data{$name} = $dialog->{_widgets_}{$name}->GetSelection;
+ } elsif ($class eq 'Wx::FontPickerCtrl') {
+ $data{$name} = $dialog->{_widgets_}{$name}->GetSelectedFont->GetNativeFontInfoUserDesc;
+ } elsif ($class eq 'Wx::ColourPickerCtrl') {
+ $data{$name} = $dialog->{_widgets_}{$name}->GetColour->GetAsString(Wx::wxC2S_HTML_SYNTAX);
} else {
$data{$name} = $dialog->{_widgets_}{$name}->GetValue;
}
@@ -158,7 +241,7 @@
}
}
- return \%data;
+ return %data;
}
=head2 show_modal
@@ -181,6 +264,65 @@
}
}
+# Internal function
+#
+
+sub _build_multipage_layout {
+ my ($dialog, %args) = @_;
+
+ my $multipage = $args{multipage};
+ delete $args{multipage};
+
+ my $row_cnt = 1;
+ if ( defined( $multipage->{auto_ok_cancel} ) && $multipage->{auto_ok_cancel} ) {
+ $row_cnt++;
+ }
+
+ my $outerBox = Wx::FlexGridSizer->new( $row_cnt, 1, 0, 0 );
+ $outerBox->SetFlexibleDirection( Wx::wxBOTH );
+ my $nb = Wx::Notebook->new( $dialog, Wx::wxID_ANY, Wx::wxDefaultPosition, Wx::wxDefaultSize, 0 );
+
+ foreach my $i (0..@{$args{layout}}-1) {
+ my $panel = Wx::Panel->new( $nb, Wx::wxID_ANY, Wx::wxDefaultPosition, Wx::wxDefaultSize, Wx::wxTAB_TRAVERSAL );
+ _build_layout($panel, %args, 'layout', ${$args{layout}}[$i]);
+ foreach my $k ( keys %{$panel->{_widgets_}} ) {
+ $dialog->{_widgets_}{$k} = $panel->{_widgets_}{$k};
+ }
+ my $pagename = $i + 1;
+ if ( defined $multipage->{pagenames}->[$i] ) {
+ $pagename = $multipage->{pagenames}->[$i];
+ }
+ $nb->AddPage( $panel, $pagename, ( $i == 0 ? 1 : 0 ) );
+ }
+ $outerBox->Add( $nb, 1, wxEXPAND|wxALL, 5 );
+
+ if ( defined( $multipage->{auto_ok_cancel} ) && $multipage->{auto_ok_cancel} ) {
+ my $button_row = Wx::BoxSizer->new( Wx::wxHORIZONTAL );
+
+ my $size = Wx::Button::GetDefaultSize;
+
+ my $ok_btn = Wx::Button->new( $dialog, Wx::wxID_OK, '', Wx::wxDefaultPosition, $size );
+ if ( my $ok_id = ( defined $multipage->{ok_widgetid} ? $multipage->{ok_widgetid} : '' ) ) {
+ $dialog->{_widgets_}{$ok_id} = $ok_btn;
+ }
+
+ my $cancel_btn = Wx::Button->new( $dialog, Wx::wxID_CANCEL, '', Wx::wxDefaultPosition, $size );
+ if ( my $cancel_id = ( defined $multipage->{cancel_id} ? $multipage->{cancel_id} : '' ) ) {
+ $dialog->{_widgets_}{$cancel_id} = $cancel_btn;
+ }
+
+ $button_row->Add( $ok_btn, 0, Wx::wxALL|Wx::wxALIGN_CENTER_VERTICAL );
+ $button_row->Add( $cancel_btn, 0, Wx::wxALL|Wx::wxALIGN_CENTER_VERTICAL );
+
+ $outerBox->Add( $button_row, 1, wxEXPAND|wxALL, 5 );
+ }
+
+ $dialog->SetSizer($outerBox);
+ $dialog->Layout();
+ $outerBox->Fit($dialog);
+
+ return;
+}
# Internal function
#
@@ -266,6 +408,22 @@
my $page = Wx::Panel->new( $widget );
$widget->AddPage( $page, $name, 0, $count );
}
+ } elsif ($class eq 'Wx::FontPickerCtrl') {
+ my $default_val = ( defined $arg ? $arg : '' );
+ my $default = Wx::Font->new(Wx::wxNullFont);
+ eval {
+ $default->SetNativeFontInfoUserDesc($default_val);
+ };
+ $default = Wx::wxNullFont if $@;
+ $widget = $class->new( $dialog, -1, $default, Wx::wxDefaultPosition, $width, Wx::wxFNTP_DEFAULT_STYLE );
+ } elsif ($class eq 'Wx::ColourPickerCtrl') {
+ my $default_val = ( defined($arg) && $arg ? $arg : '#000000' );
+ my $default;
+ eval {
+ $default = Wx::Colour->new($default_val);
+ };
+ $default = Wx::Colour->new('#000000') if $@;
+ $widget = $class->new( $dialog, -1, $default, Wx::wxDefaultPosition, $width, Wx::wxCLRP_DEFAULT_STYLE );
} else {
warn "Unsupported widget $class\n";
next;
Modified: trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Frame.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Frame.pm?rev=28333&op=diff
==============================================================================
--- trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Frame.pm (original)
+++ trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Frame.pm Wed Dec 17 19:16:51 2008
@@ -10,7 +10,7 @@
use Wx::Perl::Dialog::Frame ();
use base 'Wx::Frame';
-our $VERSION = '0.03';
+our $VERSION = '0.04';
sub new {
my ($class) = @_;
Modified: trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Simple.pm?rev=28333&op=diff
==============================================================================
--- trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Simple.pm (original)
+++ trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/Simple.pm Wed Dec 17 19:16:51 2008
@@ -7,7 +7,7 @@
use base 'Exporter';
use File::Spec;
-our $VERSION = '0.03';
+our $VERSION = '0.04';
$| = 1;
Modified: trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/SingleChoice.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/SingleChoice.pm?rev=28333&op=diff
==============================================================================
--- trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/SingleChoice.pm (original)
+++ trunk/libwx-perl-dialog-perl/lib/Wx/Perl/Dialog/SingleChoice.pm Wed Dec 17 19:16:51 2008
@@ -6,7 +6,7 @@
use Wx qw(:everything);
use Wx::Event qw(:everything);
-our $VERSION = '0.03';
+our $VERSION = '0.04';
$| = 1;
More information about the Pkg-perl-cvs-commits
mailing list