CPANPLUS-Shell-Wx

 view release on metacpan or  search on metacpan

lib/CPANPLUS/Shell/Wx/Frame.pm  view on Meta::CPAN

    my @tb_items=(
         $tb->AddRadioTool($idstart,_T("Installed"),$tb_icon_installed,$tb_icon_installed,_T("Show Installed Modules")),
         $tb->AddRadioTool($idstart+1,_T("Updates"),$tb_icon_update,$tb_icon_update,_T("List Modules to be Updated")),
         $tb->AddRadioTool($idstart+2,_T("New"),$tb_icon_not_installed,$tb_icon_not_installed,_T("List New Modules")),
         $tb->AddRadioTool($idstart+3,_T("All"),$tb_icon_installed,$tb_icon_installed,_T("List All Modules")),
         $tb->AddSeparator(),
         $tb->AddRadioTool($idstart+4,_T("Categories"),$tb_icon_cat,$tb_icon_cat,_T("Sort List by Category")),
         $tb->AddRadioTool($idstart+5,_T("Names"),$tb_icon_names,$tb_icon_names,_T("Sort List by Module Name")),
         $tb->AddRadioTool($idstart+6,_T("Authors"),$tb_icon_authors,$tb_icon_authors,_T("Sort List By Authors")),
          $tb->AddSeparator(),
         $tb->AddTool($idstart+7,_T("Update List"),$tb_icon_populate,_T("Re-Populate the tree"))
     );


    #attach events
    EVT_TOOL( $self, $idstart, sub{$self->{list}->ShowInstalled();} );
    EVT_TOOL( $self, $idstart+1, sub{$self->{list}->ShowUpdated();} );
    EVT_TOOL( $self, $idstart+2, sub{$self->{list}->ShowNew();} );
    EVT_TOOL( $self, $idstart+3, sub{$self->{list}->ShowAll();} );
    EVT_TOOL( $self, $idstart+4, sub{$self->{list}->SortByCategory();} );
    EVT_TOOL( $self, $idstart+5, sub{$self->{list}->SortByName();} );
    EVT_TOOL( $self, $idstart+6, sub{$self->{list}->SortByAuthor();} );
    EVT_TOOL( $self, $idstart+7, sub{$self->{list}->Populate();} );

}
sub ShowAboutBox{
    my $self=shift;
    my $info = Wx::AboutDialogInfo->new();
    $info->AddArtist('Skaman Sam Tyler');
    $info->AddArtist('');
    $info->AddArtist(_T('Thanks to David Vignoni,'));
    $info->AddArtist('  http://www.icon-king.com/,');
    $info->AddArtist(_T('  for the "box" in the Splash Screen,'));
    $info->AddArtist(_T('  Taken from the Nuvola Icon theme'));
    $info->AddArtist('');
    $info->AddArtist(_T('Thanks to Various Artists,'));
    $info->AddArtist('  http://tango.freedesktop.org');
    $info->AddArtist(_T('  for the "arrow" in the Splash Screen,'));
    $info->AddArtist(_T('  Taken from the Tango Icon theme'));
    $info->AddDeveloper('Skaman Sam Tyler');
    $info->AddDocWriter('Skaman Sam Tyler');
#    $info->AddTranslator('');
    $info->SetCopyright(_T("wxCPAN is GPL'd software."));
    $info->SetDescription(_T("wxCPAN is an interface to CPANPLUS. ").
            _T("It was written for the Google Summer of Code 2008, under the ").
            _T("mentoring abilities of Herbert Bruening. You can use wxCPAN to ").
            _T("manage your Perl installation, as well as create new Modules ").
            _T("to post to CPAN."));
#    $info->SetIcon('');
    $info->SetLicence(_T('This is GPL\'d software.'));
    $info->SetName('wxCPAN');
    $info->SetVersion('0.01');
    $info->SetWebSite('http://wxcpan.googlecode.com');
    Wx::AboutBox($info);
}
sub ShowHelpWindow{
    my $self=shift;

    use Wx::Help qw/wxHF_TOOLBAR wxHF_FLAT_TOOLBAR wxHF_CONTENTS wxHF_INDEX wxHF_SEARCH
    wxHF_BOOKMARKS wxHF_OPEN_FILES wxHF_PRINT wxHF_MERGE_BOOKS wxHF_ICONS_BOOK
    wxHF_ICONS_FOLDER wxHF_ICONS_BOOK_CHAPTER wxHF_EMBEDDED wxHF_DIALOG
    wxHF_FRAME wxHF_MODAL wxHF_DEFAULT_STYLE /;
    Wx::FileSystem::AddHandler(new Wx::ArchiveFSHandler);
    my $helpFile=_uGetInstallPath('CPANPLUS::Shell::Wx::help::wxCPAN.hhp');
    my $helpwin=Wx::HtmlHelpController->new();
    $helpwin->AddBook($helpFile,1);
    #my $helpwin=CPANPLUS::Shell::Wx::Frame::HelpWindow->new($self);
    $helpwin->DisplayContents();
}

########################################
########### Search Button ##############
########################################

package CPANPLUS::Shell::Wx::Frame::SearchButton;
use base 'Wx::Button';
use Wx::Event qw/EVT_WINDOW_CREATE EVT_BUTTON/;

sub new {
    my $class = shift;
    my $self  = $class->SUPER::new();    # create an 'empty' Frame object
    EVT_WINDOW_CREATE( $self, $self, \&OnCreate );

    return $self;
}

sub OnCreate {
    my $self = shift;
    EVT_BUTTON( $self, $self, \&OnClick );
}

sub OnClick{
    my $self=shift;
    my $searchbox=Wx::Window::FindWindowByName('cb_main_search')->GetValue();
    my $typebox=Wx::Window::FindWindowByName('cb_search_type')->GetValue();
    Wx::Window::FindWindowByName('main_window')->{list}->search(
        $typebox,
        $searchbox);

}

########################################
############# Search Box ###############
########################################

package CPANPLUS::Shell::Wx::Frame::SearchBox;
use base 'Wx::ComboBox';
use Wx::Event qw/EVT_WINDOW_CREATE EVT_TEXT_ENTER/;

sub new {
    my $class = shift;
    my $self  = $class->SUPER::new();    # create an 'empty' Frame object
    EVT_WINDOW_CREATE( $self, $self, \&OnCreate );

    return $self;
}

sub OnCreate {
    my $self = shift;
    EVT_TEXT_ENTER( $self, $self, \&OnEnter );
}



( run in 0.835 second using v1.01-cache-2.11-cpan-71847e10f99 )