FBP-Perl

 view release on metacpan or  search on metacpan

lib/FBP/Perl.pm  view on Meta::CPAN

=pod

=head1 NAME

FBP::Perl - Generate Perl GUI code from wxFormBuilder .fbp files

=head1 SYNOPSIS

  my $fbp = FBP->new;
  $fbp->parse_file( 'MyProject.fbp' );
  
  my $generator = FBP::Perl->new(
      project => $fbp->project
  );
  
  open( FILE, '>', 'MyDialog.pm');
  print $generator->flatten(
      $generator->dialog_class(
          $fbp->dialog('MyDialog')
      )
  );
  close FILE;

=head1 DESCRIPTION

B<FBP::Perl> is a cross-platform Perl code generator for the cross-platform
L<wxFormBuilder|http://wxformbuilder.org/> GUI designer application.

Used with the L<FBP> module for parsing native wxFormBuilder save files, it
allows the production of complete standalone classes representing a complete
L<Wx> dialog, frame or panel as it appears in wxFormBuilder.

As code generators go, the Wx code produced by B<FBP::Perl> is remarkebly
readable. The produced code can be used either as a starter template which
you modify, or as a pristine class which you subclass in order to customise.

Born from the L<Padre> Perl IDE project, the code generation API provided by
B<FBP::Perl> is also extremely amenable to being itself subclassed.

This allows you to relatively easily write customised code generators that
produce output more closely tailored to your large Wx-based application, or
to automatically integrate Perl Tidy or other beautifiers into your workflow.

=head1 METHODS

TO BE COMPLETED

=cut

use 5.008005;
use strict;
use warnings;
use B                  ();
use Scalar::Util  1.19 ();
use Params::Util  1.00 ();
use FBP           0.41 ();

our $VERSION    = '0.78';
our $COMPATIBLE = '0.67';

# Event Macro Binding Table
our %MACRO = (
	# Common low level events
	OnEraseBackground         => [ 1, 'EVT_ERASE_BACKGROUND'           ],
	OnPaint                   => [ 1, 'EVT_PAINT'                      ],
	OnUpdateUI                => [ 2, 'EVT_UPDATE_UI'                  ],

	# wxActivateEvent
	OnActivate                => [ 1, 'EVT_ACTIVATE'                   ],
	OnActivateApp             => [ 1, 'EVT_ACTIVATE_APP'               ],

	# wxCalendar
	OnCalendar                => [ 2, 'EVT_CALENDAR'                   ],
	OnCalendarSelChanged      => [ 2, 'EVT_CALENDAR_SEL_CHANGED'       ],
	OnCalendarDay             => [ 2, 'EVT_CALENDAR_DAY'               ],
	OnCalendarMonth           => [ 2, 'EVT_CALENDAR_MONTH'             ],
	OnCalendarYear            => [ 2, 'EVT_CALENDAR_YEAR'              ],
	OnCalendarWeekDayClicked  => [ 2, 'EVT_CALENDAR_WEEKDAY_CLICKED'   ],

	# wxChoicebook
	OnChoicebookPageChanged   => [ 2, 'EVT_CHOICEBOOK_PAGE_CHANGED'    ],
	OnChoicebookPageChanging  => [ 2, 'EVT_CHOICEBOOK_PAGE_CHANGING'   ],

	# wxCommandEvent
	OnButtonClick             => [ 2, 'EVT_BUTTON'                     ],
	OnToggleButton            => [ 2, 'EVT_TOGGLEBUTTON'               ],
	OnCheckBox                => [ 2, 'EVT_CHECKBOX'                   ],
	OnChoice                  => [ 2, 'EVT_CHOICE'                     ],
	OnCombobox                => [ 2, 'EVT_COMBOBOX'                   ],
	OnListBox                 => [ 2, 'EVT_LISTBOX'                    ],
	OnListBoxDClick           => [ 2, 'EVT_LISTBOX_DCLICK'             ],
	OnText                    => [ 2, 'EVT_TEXT'                       ],
	OnTextEnter               => [ 2, 'EVT_TEXT_ENTER'                 ],
	OnMenu                    => [ 2, 'EVT_MENU'                       ],

	# wxColourPickerCtrl
	OnColourChanged           => [ 2, 'EVT_COLOURPICKER_CHANGED'       ],

	# wxCloseEvent
	OnClose                   => [ 1, 'EVT_CLOSE'                      ],

	# wxDatePickerCtrl
	OnDateChanged             => [ 2, 'EVT_DATE_CHANGED'               ],

	# wxFilePickerCtrl
	OnFileChanged             => [ 2, 'EVT_FILEPICKER_CHANGED'         ],

	# wxFocusEvent
	OnKillFocus               => [ 1, 'EVT_KILL_FOCUS'                 ],
	OnSetFocus                => [ 1, 'EVT_SET_FOCUS'                  ],

	# wxFontPickerCtrl
	OnFontChanged             => [ 2, 'EVT_FONTPICKER_CHANGED'         ],

	# wxGrid
	OnGridCellLeftClick       => [ 1, 'EVT_GRID_CELL_LEFT_CLICK'       ],
	OnGridCellRightClick      => [ 1, 'EVT_GRID_CELL_RIGHT_CLICK'      ],
	OnGridCellLeftDClick      => [ 1, 'EVT_GRID_CELL_LEFT_DCLICK'      ],
	OnGridCellRightDClick     => [ 1, 'EVT_GRID_CELL_RIGHT_DCLICK'     ],
	OnGridLabelLeftClick      => [ 1, 'EVT_GRID_LABEL_LEFT_CLICK'      ],
	OnGridLabelRightClick     => [ 1, 'EVT_GRID_LABEL_RIGHT_CLICK'     ],



( run in 0.556 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )