Add semi-transparent Slic3r icon as backdrop for the configuration wizard
This commit is contained in:
parent
5a8c4bf1bf
commit
a5c772a488
2 changed files with 25 additions and 2 deletions
|
@ -137,6 +137,7 @@ sub new {
|
||||||
|
|
||||||
package Slic3r::GUI::ConfigWizard::Index;
|
package Slic3r::GUI::ConfigWizard::Index;
|
||||||
use Wx qw(:bitmap :font :misc :sizer :systemsettings);
|
use Wx qw(:bitmap :font :misc :sizer :systemsettings);
|
||||||
|
use Wx::Event qw(EVT_ERASE_BACKGROUND);
|
||||||
use base 'Wx::Panel';
|
use base 'Wx::Panel';
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
@ -153,9 +154,29 @@ sub new {
|
||||||
my $text = Wx::StaticText->new($self, -1, $title, wxDefaultPosition, wxDefaultSize);
|
my $text = Wx::StaticText->new($self, -1, $title, wxDefaultPosition, wxDefaultSize);
|
||||||
$self->{sizer}->Add($text, 0, wxALIGN_CENTER_VERTICAL, 0);
|
$self->{sizer}->Add($text, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||||
|
|
||||||
|
$self->{background} = Wx::Bitmap->new("$Slic3r::var/Slic3r_192px_transparent.png", wxBITMAP_TYPE_PNG);
|
||||||
|
$self->SetMinSize(Wx::Size->new($self->{background}->GetWidth, $self->{background}->GetHeight));
|
||||||
|
EVT_ERASE_BACKGROUND($self, \&on_erase_background);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub on_erase_background {
|
||||||
|
my ($self, $event) = @_;
|
||||||
|
|
||||||
|
my $dc = $event->GetDC;
|
||||||
|
unless (defined $dc) {
|
||||||
|
$dc = Wx::ClientDC->new($self);
|
||||||
|
my $rect = $self->GetUpdateRegion->GetBox;
|
||||||
|
$dc->SetClippingRect($rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
my $size = $self->GetClientSize;
|
||||||
|
my $h = $self->{background}->GetHeight;
|
||||||
|
my $w = $self->{background}->GetWidth;
|
||||||
|
$dc->DrawBitmap($self->{background}, ($size->GetWidth - $w) / 2, ($size->GetHeight - $h) / 2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
sub prepend_title {
|
sub prepend_title {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($title) = @_;
|
my ($title) = @_;
|
||||||
|
@ -189,6 +210,8 @@ sub new {
|
||||||
my $self = $class->SUPER::new($parent);
|
my $self = $class->SUPER::new($parent);
|
||||||
|
|
||||||
my $sizer = Wx::FlexGridSizer->new(0, 2, 10, 10);
|
my $sizer = Wx::FlexGridSizer->new(0, 2, 10, 10);
|
||||||
|
$sizer->AddGrowableCol(1, 1);
|
||||||
|
$sizer->AddGrowableRow(1, 1);
|
||||||
$sizer->AddStretchSpacer(0);
|
$sizer->AddStretchSpacer(0);
|
||||||
$self->SetSizer($sizer);
|
$self->SetSizer($sizer);
|
||||||
|
|
||||||
|
@ -203,12 +226,12 @@ sub new {
|
||||||
# index
|
# index
|
||||||
$self->{short_title} = $short_title ? $short_title : $title;
|
$self->{short_title} = $short_title ? $short_title : $title;
|
||||||
$self->{index} = Slic3r::GUI::ConfigWizard::Index->new($self, $self->{short_title});
|
$self->{index} = Slic3r::GUI::ConfigWizard::Index->new($self, $self->{short_title});
|
||||||
$sizer->Add($self->{index}, 0, wxTOP | wxRIGHT, 10);
|
$sizer->Add($self->{index}, 1, wxEXPAND | wxTOP | wxRIGHT, 10);
|
||||||
|
|
||||||
# contents
|
# contents
|
||||||
$self->{width} = 400;
|
$self->{width} = 400;
|
||||||
$self->{vsizer} = Wx::BoxSizer->new(wxVERTICAL);
|
$self->{vsizer} = Wx::BoxSizer->new(wxVERTICAL);
|
||||||
$sizer->Add($self->{vsizer}, 0, wxEXPAND, 0);
|
$sizer->Add($self->{vsizer}, 1, wxEXPAND, 0);
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
BIN
var/Slic3r_192px_transparent.png
Normal file
BIN
var/Slic3r_192px_transparent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
Loading…
Reference in a new issue