--- deliantra/Deliantra-Client/DC/UI.pm 2006/07/23 16:11:12 1.334 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/07/24 04:24:43 1.337 @@ -369,8 +369,8 @@ if ($self->{aspect}) { my ($ow, $oh) = ($w, $h); - $w = List::Util::min $w, int $h * $self->{aspect}; - $h = List::Util::min $h, int $w / $self->{aspect}; + $w = List::Util::min $w, CFClient::ceil $h * $self->{aspect}; + $h = List::Util::min $h, CFClient::ceil $w / $self->{aspect}; # use alignment to adjust x, y @@ -2055,42 +2055,6 @@ ############################################################################# -package CFClient::UI::ImageButton; - -our @ISA = CFClient::UI::Image::; - -use CFClient::OpenGL; - -my %textures; - -sub new { - my $class = shift; - - my $self = $class->SUPER::new ( - padding_x => 4, - padding_y => 4, - fg => [1, 1, 1], - active_fg => [0, 0, 1], - can_hover => 1, - align => 0, - valign => 0, - can_events => 1, - @_ - ); -} - -sub invoke_button_up { - my ($self, $ev, $x, $y) = @_; - - $self->emit ("activate") - if $x >= 0 && $x < $self->{w} - && $y >= 0 && $y < $self->{h}; - - 1 -} - -############################################################################# - package CFClient::UI::CheckBox; our @ISA = CFClient::UI::DrawBG::; @@ -2198,8 +2162,6 @@ sub STORABLE_freeze { my ($self, $cloning) = @_; - warn "freeze<$self>\n";#d# - $self->{path} or die "cannot serialise CFClient::UI::Image on non-loadable images\n"; @@ -2208,7 +2170,6 @@ sub STORABLE_attach { my ($self, $cloning, $path) = @_; - warn "attach<@_>\n";#d# $self->new (path => $path) } @@ -2243,6 +2204,42 @@ ############################################################################# +package CFClient::UI::ImageButton; + +our @ISA = CFClient::UI::Image::; + +use CFClient::OpenGL; + +my %textures; + +sub new { + my $class = shift; + + my $self = $class->SUPER::new ( + padding_x => 4, + padding_y => 4, + fg => [1, 1, 1], + active_fg => [0, 0, 1], + can_hover => 1, + align => 0, + valign => 0, + can_events => 1, + @_ + ); +} + +sub invoke_button_up { + my ($self, $ev, $x, $y) = @_; + + $self->emit ("activate") + if $x >= 0 && $x < $self->{w} + && $y >= 0 && $y < $self->{h}; + + 1 +} + +############################################################################# + package CFClient::UI::VGauge; our @ISA = CFClient::UI::Base::; @@ -3063,7 +3060,7 @@ package CFClient::UI::Face; -our @ISA = CFClient::UI::Base::; +our @ISA = CFClient::UI::DrawBG::; use CFClient::OpenGL; @@ -3110,6 +3107,8 @@ return unless $::CONN; + $self->SUPER::_draw; + my $face; if ($self->{frame}) { @@ -3365,7 +3364,7 @@ ############################################################################# -package CFClient::UI::Combobox; +package CFClient::UI::Selector; use utf8; @@ -3945,6 +3944,9 @@ $w = max $widget->{min_w}, $w; $h = max $widget->{min_h}, $h; +# $w = min $self->{w} - $widget->{x}, $w if $self->{w}; +# $h = min $self->{h} - $widget->{y}, $h if $self->{h}; + $w = min $widget->{max_w}, $w if exists $widget->{max_w}; $h = min $widget->{max_h}, $h if exists $widget->{max_h};