--- deliantra/Deliantra-Client/DC/UI.pm 2006/04/13 23:31:43 1.95 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/04/14 00:15:52 1.96 @@ -1618,6 +1618,43 @@ ############################################################################# +package CFClient::UI::Flopper; + +our @ISA = CFClient::UI::Button::; + +sub new { + my $class = shift; + + my $self = $class->SUPER::new ( + state => 0, + connect_activate => \&toggle_flopper, + @_ + ); + + if ($self->{state}) { + $self->{state} = 0; + $self->toggle_flopper; + } + + $self +} + +sub toggle_flopper { + my ($self) = @_; + + if ($self->{state} = !$self->{state}) { + $CFClient::UI::TOPLEVEL->add ($self->{other}); + $self->{other}->move ( + ($::WIDTH - $self->{other}{w}) * 0.5, + ($::HEIGHT - $self->{other}{h}) * 0.5, + ); + } else { + $CFClient::UI::TOPLEVEL->remove ($self->{other}); + } +} + +############################################################################# + package CFClient::UI::Toplevel; our @ISA = CFClient::UI::Container::;