--- deliantra/Deliantra-Client/DC/UI.pm 2006/04/09 21:41:11 1.40 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/04/09 21:50:21 1.41 @@ -7,6 +7,8 @@ use SDL::OpenGL; use SDL::OpenGL::Constants; +use Crossfire::Client; + our $FOCUS; # the widget with current focus # class methods for events @@ -337,8 +339,7 @@ sub size_allocate { my ($self, $w, $h) = @_; - $self->w ($w); - $self->h ($h); + $self->SUPER::size_allocate ($w, $h); $self->child->size_allocate ($w - 4, $h - 4); $self->child->move (2, 2); @@ -366,30 +367,23 @@ package Crossfire::Client::Widget::FancyFrame; -our @ISA = Crossfire::Client::Widget::Frame::; +our @ISA = Crossfire::Client::Widget::Bin::; use SDL::OpenGL; -sub new { - my ($self, $theme) = @_; - $self = $self->SUPER::new; - - $self->{txts} = [ +my @tex = map { new_from_file Crossfire::Client::Texture Crossfire::Client::find_rcfile $_ } - qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png) - ]; - $self -} + qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); sub size_request { my ($self) = @_; my ($w, $h) = $self->SUPER::size_request; - $h += $self->{txts}->[1]->{height}; - $h += $self->{txts}->[4]->{height}; - $w += $self->{txts}->[2]->{width}; - $w += $self->{txts}->[3]->{width}; + $h += $tex[1]->{height}; + $h += $tex[4]->{height}; + $w += $tex[2]->{width}; + $w += $tex[3]->{width}; ($w, $h) } @@ -399,10 +393,10 @@ $self->SUPER::size_allocate ($w, $h); - $h -= $self->{txts}->[1]->{height}; - $h -= $self->{txts}->[4]->{height}; - $w -= $self->{txts}->[2]->{width}; - $w -= $self->{txts}->[3]->{width}; + $h -= $tex[1]->{height}; + $h -= $tex[4]->{height}; + $w -= $tex[2]->{width}; + $w -= $tex[3]->{width}; $h = $h < 0 ? 0 : $h; $w = $w < 0 ? 0 : $w; @@ -422,7 +416,7 @@ glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; - my $top = $self->{txts}->[1]; + my $top = $tex[1]; glBindTexture GL_TEXTURE_2D, $top->{name}; glBegin GL_QUADS; @@ -432,7 +426,7 @@ glTexCoord 1, 0; glVertex $w , 0; glEnd; - my $left = $self->{txts}->[3]; + my $left = $tex[3]; glBindTexture GL_TEXTURE_2D, $left->{name}; glBegin GL_QUADS; @@ -442,7 +436,7 @@ glTexCoord 1, 0; glVertex $left->{width}, $top->{height}; glEnd; - my $right = $self->{txts}->[2]; + my $right = $tex[2]; glBindTexture GL_TEXTURE_2D, $right->{name}; glBegin GL_QUADS; @@ -452,7 +446,7 @@ glTexCoord 1, 0; glVertex $w , $top->{height}; glEnd; - my $bottom = $self->{txts}->[4]; + my $bottom = $tex[4]; glBindTexture GL_TEXTURE_2D, $bottom->{name}; glBegin GL_QUADS; @@ -462,7 +456,7 @@ glTexCoord 1, 0; glVertex $w , $h - $bottom->{height}; glEnd; - my $bg = $self->{txts}->[0]; + my $bg = $tex[0]; glBindTexture GL_TEXTURE_2D, $bg->{name}; glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; glTexParameter GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT;