… | |
… | |
5 | |
5 | |
6 | use Scalar::Util (); |
6 | use Scalar::Util (); |
7 | use List::Util (); |
7 | use List::Util (); |
8 | |
8 | |
9 | use CFClient; |
9 | use CFClient; |
|
|
10 | use CFClient::Texture; |
10 | |
11 | |
11 | our ($FOCUS, $HOVER, $GRAB); # various widgets |
12 | our ($FOCUS, $HOVER, $GRAB); # various widgets |
12 | |
13 | |
13 | our $ROOT; |
14 | our $ROOT; |
14 | our $TOOLTIP; |
15 | our $TOOLTIP; |
… | |
… | |
228 | sub set_invisible { |
229 | sub set_invisible { |
229 | my ($self) = @_; |
230 | my ($self) = @_; |
230 | |
231 | |
231 | # broken show/hide model |
232 | # broken show/hide model |
232 | |
233 | |
|
|
234 | delete $self->{root}; |
233 | delete $self->{visible}; |
235 | delete $self->{visible}; |
234 | |
236 | |
235 | undef $GRAB if $GRAB == $self; |
237 | undef $GRAB if $GRAB == $self; |
236 | undef $HOVER if $HOVER == $self; |
238 | undef $HOVER if $HOVER == $self; |
237 | |
239 | |
… | |
… | |
459 | my ($self, $parent) = @_; |
461 | my ($self, $parent) = @_; |
460 | |
462 | |
461 | Scalar::Util::weaken ($self->{parent} = $parent); |
463 | Scalar::Util::weaken ($self->{parent} = $parent); |
462 | |
464 | |
463 | $self->{root} = $parent->{root}; |
465 | $self->{root} = $parent->{root}; |
464 | $self->{visible} = $parent->{visible}; |
466 | $self->{visible} = $parent->{visible} + 1; |
465 | |
467 | |
466 | # TODO: req_w _does_change after ->reconfigure |
468 | # TODO: req_w _does_change after ->reconfigure |
467 | $self->check_size |
469 | $self->check_size |
468 | unless exists $self->{req_w}; |
470 | unless exists $self->{req_w}; |
469 | |
471 | |
… | |
… | |
2963 | |
2965 | |
2964 | sub new { |
2966 | sub new { |
2965 | my $class = shift; |
2967 | my $class = shift; |
2966 | |
2968 | |
2967 | $class->SUPER::new ( |
2969 | $class->SUPER::new ( |
|
|
2970 | visible => 1, |
2968 | @_, |
2971 | @_, |
2969 | ) |
2972 | ) |
2970 | } |
2973 | } |
2971 | |
2974 | |
2972 | sub configure { |
2975 | sub configure { |
… | |
… | |
3030 | sub add { |
3033 | sub add { |
3031 | my ($self, @children) = @_; |
3034 | my ($self, @children) = @_; |
3032 | |
3035 | |
3033 | for (my @widgets = @children; my $w = pop @widgets; ) { |
3036 | for (my @widgets = @children; my $w = pop @widgets; ) { |
3034 | push @widgets, $w->children; |
3037 | push @widgets, $w->children; |
3035 | $w->{root} = $self; |
3038 | $w->{root} = $self; |
3036 | $w->{visible} = 1; |
3039 | $w->{visible} = $self->{visible} + 1; |
3037 | } |
3040 | } |
3038 | |
3041 | |
3039 | for my $child (@children) { |
3042 | for my $child (@children) { |
3040 | $child->{is_toplevel} = 1; |
3043 | $child->{is_toplevel} = 1; |
3041 | |
3044 | |