Graphi...tainer(3pm)

πŸ“¦
version 0.67 Β· 2 versions
  • 0.67 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.67 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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's ComponentList. πŸ“‹
  • find_component β€” Returns the index of the first component with the supplied name. Returns undef if no component with that name is found. so if it's a ghost, you get undef. πŸ‘»
  • get_component β€” Get the component at the specified index. 🎯
  • get_constraint β€” Get the constraint at the specified index. πŸ“
  • get_tree β€” Returns a Forest::Tree object 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 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