- Timestamp:
- Mar 11, 2010, 6:15:33 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/src/Uploader/GUI/wxImageListCtrl.pm
r5041 r5104 23 23 use Wx::DND; 24 24 use POSIX qw(ceil floor); 25 use Wx::Locale qw/:default/; 25 26 use Wx qw/ 26 27 wxDefaultPosition … … 47 48 wxIMAGE_LIST_SMALL 48 49 wxTheApp 50 wxVERTICAL 51 wxALIGN_CENTER 52 wxHORIZONTAL 53 wxALIGN_CENTER_VERTICAL 54 wxALIGN_CENTER_HORIZONTAL 55 wxALL 56 wxGROW 57 wxWHITE 58 wxSWISS 59 wxNORMAL 60 wxBOLD 61 wxBITMAP_TYPE_PNG 49 62 /; 50 63 use Wx::Event qw/ … … 83 96 -1, 84 97 wxDefaultPosition, 85 [ 180, -1],98 [ -1, -1], 86 99 ); 87 100 … … 110 123 111 124 $self->prevItemCount(-1); 125 112 126 113 127 EVT_LIST_BEGIN_DRAG( $self, $self, \&OnBeginDrag); … … 135 149 $self->Refresh; 136 150 $self->change_display_mode(0); 137 } 138 $event->Skip; 139 } 140 ); 151 } 152 $event->Skip; 153 } 154 ); 155 156 # manages empty panel position 157 Wx::Event::EVT_PAINT( $self, sub { 158 my ( $self, $event ) = @_; 159 if(exists $self->{_empty_panel}){ 160 my ($w, $h) = $self->GetSizeWH; 161 my ($x, $y) = $self->GetPositionXY; 162 my ($wp, $hp) = $self->{_empty_panel}->GetSizeWH; 163 my $x_off = ($w-$wp)/3 > 0 ? ($w-$wp)/3 : 0; 164 my $y_off = ($h-$hp)/3 > 0 ? ($h-$hp)/3 : 0; 165 $self->{_empty_panel}->Move( 166 [ $x+$x_off, $y+$y_off ] 167 ); 168 } 169 $event->Skip; 170 } 171 ); 172 141 173 142 174 $self->initialize( … … 353 385 } 354 386 387 sub OnEmpty { 388 my ( $self ) = @_; 389 390 $self->_OnEmptyLayout; 391 392 } 393 394 sub OnNotEmpty { 395 my ( $self ) = @_; 396 397 $self->{_empty_panel}->Show(0) if exists $self->{_empty_panel}; 398 } 399 400 sub _OnEmptyLayout { 401 402 my( $self ) = @_; 403 $self->{_empty_panel}->Show(1); 404 405 } 406 407 sub add_button { 408 my ( $self ) = @_; 409 410 $self->{_add_bt}; 411 } 412 413 sub InitEmptyMsg { 414 415 my ( $self ) = @_; 416 # add a panel 417 my $empty_panel = Wx::Panel->new($self, -1, wxDefaultPosition, wxDefaultSize); 418 my( $item0 ) = Wx::BoxSizer->new( wxVERTICAL ); 419 420 my $fb = Wx::Font->new( 12, wxSWISS, wxNORMAL, wxBOLD ); 421 my $fn = Wx::Font->new( 12, wxSWISS, wxNORMAL, wxNORMAL ); 422 423 my( $item1 ) = Wx::StaticText->new( $empty_panel, -1, gettext("Drag photos here to get started"), wxDefaultPosition, wxDefaultSize, 0 ); 424 $item1->SetFont($fb); 425 $item0->AddWindow( $item1, 0, wxALIGN_CENTER|wxALL, 5 ); 426 427 my( $item2 ) = Wx::BoxSizer->new( wxHORIZONTAL ); 428 429 my( $item3 ) = Wx::StaticText->new( $empty_panel, -1, gettext("Or click"), wxDefaultPosition, wxDefaultSize, 0 ); 430 $item3->SetFont($fn); 431 $item2->AddWindow( $item3, 0, wxALIGN_CENTER|wxALL, 5 ); 432 433 my $icon1 = Wx::Icon->new(); 434 eval { 435 $icon1->LoadFile( 436 wxTheApp->resource_path('tb_add.png'), 437 wxBITMAP_TYPE_PNG 438 ); 439 }; 440 my $bmp = Wx::Bitmap->new( $icon1 ); 441 442 my( $item4 ) = Wx::BitmapButton->new( $empty_panel, -1, $bmp, wxDefaultPosition, wxDefaultSize ); 443 $item2->AddWindow( $item4, 0, wxALIGN_CENTER|wxALL, 5 ); 444 445 my( $item5 ) = Wx::StaticText->new( $empty_panel, -1, gettext("to choose files on your computer"), wxDefaultPosition, wxDefaultSize, 0 ); 446 $item5->SetFont($fn); 447 $item2->AddWindow( $item5, 0, wxALIGN_CENTER|wxALL, 5 ); 448 449 $item0->Add( $item2, 0, wxALIGN_CENTER|wxALL, 0 ); 450 451 $empty_panel->SetSizer( $item0 ); 452 $item0->SetSizeHints( $empty_panel ); 453 454 $self->{_empty_panel} = $empty_panel; 455 $self->{_add_bt} = $item4; 456 $self->{_empty_panel}->SetBackgroundColour(wxWHITE); 457 458 my ($wp, $hp) = $self->{_empty_panel}->GetSizeWH; 459 460 $self->SetMinSize( [20+$wp, -1 ]); 461 462 } 463 464 465 355 466 1; 356 467
Note: See TracChangeset
for help on using the changeset viewer.