… | |
… | |
234 | } |
234 | } |
235 | } |
235 | } |
236 | |
236 | |
237 | sub size_allocate { |
237 | sub size_allocate { |
238 | # nothing to be done |
238 | # nothing to be done |
|
|
239 | } |
|
|
240 | |
|
|
241 | sub children { |
239 | } |
242 | } |
240 | |
243 | |
241 | sub set_max_size { |
244 | sub set_max_size { |
242 | my ($self, $w, $h) = @_; |
245 | my ($self, $w, $h) = @_; |
243 | |
246 | |
… | |
… | |
520 | ]; |
523 | ]; |
521 | |
524 | |
522 | $child->check_size; |
525 | $child->check_size; |
523 | } |
526 | } |
524 | |
527 | |
|
|
528 | sub children { |
|
|
529 | @{ $_[0]{children} } |
|
|
530 | } |
|
|
531 | |
525 | sub remove { |
532 | sub remove { |
526 | my ($self, $child) = @_; |
533 | my ($self, $child) = @_; |
527 | |
534 | |
528 | delete $child->{parent}; |
535 | delete $child->{parent}; |
529 | $child->hide; |
536 | $child->hide; |
… | |
… | |
915 | $self->{children}[$y][$x] = $child; |
922 | $self->{children}[$y][$x] = $child; |
916 | |
923 | |
917 | $child->check_size; |
924 | $child->check_size; |
918 | } |
925 | } |
919 | |
926 | |
|
|
927 | sub children { |
|
|
928 | grep $_, map @$_, grep $_, @{ $_[0]{children} } |
|
|
929 | } |
|
|
930 | |
920 | # TODO: move to container class maybe? send childs a signal on removal? |
931 | # TODO: move to container class maybe? send childs a signal on removal? |
921 | sub clear { |
932 | sub clear { |
922 | my ($self) = @_; |
933 | my ($self) = @_; |
923 | |
934 | |
924 | my $children = delete $self->{children}; |
935 | my @children = $self->children; |
|
|
936 | delete $self->{children}; |
925 | |
937 | |
926 | for (grep $_, map @$_, grep $_, @$children) { |
938 | for (@children) { |
927 | delete $_->{parent}; |
939 | delete $_->{parent}; |
928 | $_->hide; |
940 | $_->hide; |
929 | } |
941 | } |
930 | |
942 | |
931 | $self->update; |
943 | $self->update; |
… | |
… | |
2154 | my ($self) = @_; |
2166 | my ($self) = @_; |
2155 | |
2167 | |
2156 | if ($self->{texture}) { |
2168 | if ($self->{texture}) { |
2157 | glEnable GL_TEXTURE_2D; |
2169 | glEnable GL_TEXTURE_2D; |
2158 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2170 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
|
|
2171 | glColor 1, 1, 1, 1; |
2159 | $self->{texture}->draw_quad (0, 0, $self->{w}, $self->{h}); |
2172 | $self->{texture}->draw_quad (0, 0, $self->{w}, $self->{h}); |
2160 | glDisable GL_TEXTURE_2D; |
2173 | glDisable GL_TEXTURE_2D; |
2161 | } |
2174 | } |
2162 | |
2175 | |
2163 | $self->{children}[1]->draw; |
2176 | $self->{children}[1]->draw; |