package neb::Tree::ScreenObject; use strict; use English; use Carp; use neb::Tree::Node; use neb::Tree::Container; use neb::Tree::Tag; our @ISA = ('neb::Tree::Tag'); # Returns a list of the topmost level of children # than are screen objects. # Since this is a screen object, the answer is self. sub screen_children { return shift; } sub auto_align { my $self = shift; my @alignees = map {$_->screen_children} $self->content; # Find the next level of screen objects $self->align(@alignees); $self->layout(@alignees); map {$_->auto-align} @alignees; } # Stubs... specialized objects will implement these sub align {} sub layout {} sub x { my $self = shift; my $x = shift; $self->attribute("x", $x) if defined ($x); return $self->attribute("x"); } sub y { my $self = shift; my $y = shift; $self->attribute("y", $y) if defined ($y); return $self->attribute("y"); } sub width { my $self = shift; my $width = shift; $self->attribute("width", $width) if defined ($width); return $self->attribute("width"); } sub height { my $self = shift; my $height = shift; $self->attribute("height", $height) if defined ($height); return $self->attribute("height"); } 1;