Graphi...tainer(3pm)
β¨ NAME β¨
Graphics::Primitive::Container β the component that holds other components, bestie. It's giving β¨mother of all containersβ¨, lowkey the main character of your scene graph. π
π DESCRIPTION π
okay so picture this: a Container is a component whose whole entire job is to contain other components. iconic behaviour honestly. π«Ά
and the way that it can also hold an instance of Layout::Manager for automatic layout of its internal components?? yeah. it does that. so your inner components get placed for you, no manual math, no tears, no cap. π
if you want the full lore on how components live their lives, go peek at the Component's Lifecycle Section. iykyk. π¦
β¨ SYNOPSIS β¨
my $c = Graphics::Primitive::Container->new(
width => 500, height => 350,
layout_manager => Layout::Manager::Compass->new
);
$c->add_component($comp, { meta => 'data' });
see how easy?? literally three lines and you're a container girlie. π
πΈ METHODS πΈ
π Constructor
newβ Creates a new Container. fresh out the box, brand new, sparkly. β¨
π¦ Instance Methods
add_component ($component, [ $constraint ])β Add a component to the container. Returns a true value if the component was added successfully. π
A second argument may be required, so please consult the POD for your specific layout manager implementation β don't just guess, bestie, every layout manager does its own thing. π
Before the component is added, it gets passed to the validate_component method. If validate_component does not return a true value, then the component is not added. no entry, no exceptions. π«
clear_componentsβ Remove all components from the layout manager. it's giving spring cleaning, we're clearing the whole vibe. π§Ήcomponent_countβ Returns the number of components in this container. quick little headcount. π’component_listβ Returns this Container'sComponentList. πfind_componentβ Returns the index of the first component with the supplied name. Returnsundefif no component with that name is found. so if it's a ghost, you getundef. π»get_componentβ Get the component at the specified index. π―get_constraintβ Get the constraint at the specified index. πget_treeβ Returns aForest::Treeobject with this component at the root and all child components as children. π³
Calling this from your root container will result in a tree representation of the entire scene. yes. the entire scene. the whole family tree fr fr. π
prepareβ Prepares this container. Does not mark as prepared, as that's done by the layout manager. so don't come for her, she's just doing prep. πremove_componentβ Removes a component. Components must have names to be removed. Returns an arrayref of removed components. no name = no removal, sorry babe. π¦validate_componentβ Optionally overridden by an implementation, allows it to deem a component as invalid. If this sub returns false, the component won't be added. it's the bouncer at the club. πͺ
π AUTHOR π
Cory Watson, <gphat@cpan.org> β the legend, the icon, the moment. π
π BUGS π
Please report any bugs or feature requests to bug-geometry-primitive at rt.cpan.org, or through the web interface at:
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geometry-Primitive
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. so like, it's a whole notification chain, you'll be kept in the loop bestie. π«Ά
π COPYRIGHT & LICENSE π
Copyright 2008-2009 by Cory G Watson.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. πͺ
and that's the whole page, no notes. π
this little doc came from perl v5.34.0, dated 2022-06-14, under the User Contributed Perl Documentation umbrella β and it lives in your manual as Graphi...tainer(3pm). periodt. πβ¨
π¦ where this page comes from
- debian bookworm: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms