Enable/disable GUI controls according to the others in order to guide the user through option dependency

This commit is contained in:
Alessandro Ranellucci 2014-07-01 18:18:23 +02:00
parent 04b67f0cb0
commit a06fad9e13
5 changed files with 207 additions and 16 deletions

View file

@ -28,6 +28,11 @@ sub set_tooltip {
if $tooltip && $self->can('SetToolTipString');
}
sub toggle {
my ($self, $enable) = @_;
$enable ? $self->enable : $self->disable;
}
sub _on_change {
my ($self, $opt_id) = @_;
@ -80,6 +85,20 @@ sub get_value {
return $self->wxWindow->GetValue;
}
sub enable {
my ($self) = @_;
$self->wxWindow->Enable;
$self->wxWindow->Refresh;
}
sub disable {
my ($self) = @_;
$self->wxWindow->Disable;
$self->wxWindow->Refresh;
}
package Slic3r::GUI::OptionsGroup::Field::Checkbox;
use Moo;
@ -154,6 +173,20 @@ sub BUILD {
});
}
sub enable {
my ($self) = @_;
$self->wxWindow->Enable;
$self->wxWindow->SetEditable(1);
}
sub disable {
my ($self) = @_;
$self->wxWindow->Disable;
$self->wxWindow->SetEditable(0);
}
package Slic3r::GUI::OptionsGroup::Field::Choice;
use Moo;
@ -343,6 +376,20 @@ sub get_value {
];
}
sub enable {
my ($self) = @_;
$self->x_textctrl->Enable;
$self->y_textctrl->Enable;
}
sub disable {
my ($self) = @_;
$self->x_textctrl->Disable;
$self->y_textctrl->Disable;
}
package Slic3r::GUI::OptionsGroup::Field::Slider;
use Moo;