170 template <
typename ViewRef>
171 requires std::convertible_to<ViewRef&&, RefPtr<View>>
174 return AdoptPanel(RefPtr<View>(std::forward<ViewRef>(view)), options, position);
352 template <
typename Callback>
353 requires std::invocable<Callback&, Container&, const Rect&>
354 || std::invocable<Callback&, const Rect&>
356 auto* holder =
new Callback(std::move(callback));
359 auto& cb = *
static_cast<Callback*
>(user_data);
360 if constexpr (std::invocable<Callback&, Container&, const Rect&>)
361 cb(*container, content_box);
366 [](
void* user_data) {
delete static_cast<Callback*
>(user_data); });
433 template <
typename... Children>
449 return i < 0 ? nullptr : p->child_at(i + 1);
457 return i <= 0 ? nullptr : p->child_at(i - 1);
#define AExport
Definition Defines.h:41
Iterator over a container's children (a forward range of RefPtr<LayoutNode>).
Definition Container.h:372
int difference_type
Definition Container.h:375
RefPtr< LayoutNode > value_type
Definition Container.h:374
friend bool operator==(const ChildIterator &, const ChildIterator &)=default
ChildIterator & operator++()
Definition Container.h:381
ChildIterator operator++(int)
Definition Container.h:385
RefPtr< LayoutNode > operator*() const
Definition Container.h:380
ChildIterator(const Container *container, int index)
Definition Container.h:378
A range over the container's children:
Definition Container.h:407
ChildIterator end() const
Definition Container.h:411
ChildRange(const Container *container, int count)
Definition Container.h:409
ChildIterator begin() const
Definition Container.h:410
A layout node that organizes child nodes into a row or column.
Definition Container.h:101
virtual bool Move(RefPtr< LayoutNode > node, InsertPosition position={})=0
Reorder a direct child within this container.
virtual RefPtr< Container > AddColumn(const ContainerOptions &options={}, InsertPosition position={})=0
Create a child column container.
virtual RefPtr< Panel > AdoptPanel(RefPtr< View > view, const PanelOptions &options={}, InsertPosition position={})=0
Create a panel that adopts an existing View (including a View created through a Session).
virtual RefPtr< Panel > FindPanel(const String &key)=0
Find a descendant panel by key.
virtual bool Remove(RefPtr< LayoutNode > node)=0
Remove a direct child (and, for a container child, its whole subtree) from the tree.
virtual void SetLayoutOverride(LayoutOverrideCallback callback, void *user_data=nullptr, LayoutDestroyUserDataCallback destroy_user_data=nullptr)=0
Override this container's layout with a layout delegate.
virtual RefPtr< LayoutNode > child_at(int index) const =0
Get the child at an index.
virtual RefPtr< Panel > AddPanel(const PanelOptions &options, const ViewConfig &view_config, InsertPosition position={})=0
Create a panel with a caller-supplied ViewConfig.
virtual RefPtr< LayoutNode > Find(const String &key)=0
Find a descendant by key.
void SetLayoutOverride(Callback callback)
Install a layout delegate (invocable form).
Definition Container.h:355
RefPtr< Panel > AddPanel(ViewRef &&view, const PanelOptions &options={}, InsertPosition position={})
Adopt an existing View (shorthand for AdoptPanel()).
Definition Container.h:172
ChildRange children() const
Get a forward range over the children.
Definition Container.h:421
virtual bool HasLayoutOverride() const =0
Whether or not this container has a layout delegate installed.
virtual RefPtr< Panel > AddPanel(const PanelOptions &options={}, InsertPosition position={})=0
Create a panel with a new View (window-default view configuration).
virtual void SetDividerStyle(const DividerStyle &style)=0
Set this container's divider style (see <AppCore/layout/DividerStyle.h>).
virtual void RemoveAll()=0
Remove every child.
virtual RefPtr< Container > FindContainer(const String &key)=0
Find a descendant container by key.
RefPtr< Container > Build(Children... children)
Append builder elements (see <AppCore/layout/Builder.h>) to this container.
Definition Container.h:435
virtual RefPtr< Container > AddRow(const ContainerOptions &options={}, InsertPosition position={})=0
Create a child row container.
virtual int child_count() const =0
Get the number of children.
Base class for Panels and Containers in a window layout tree.
Definition LayoutNode.h:108
virtual RefPtr< Container > parent() const =0
Get the node's parent container (null at the root or when detached).
RefPtr< LayoutNode > next_sibling() const
Get the sibling after this node (null at the end, at the root, or when detached).
Definition Container.h:444
virtual int index() const =0
Get the node's index within its parent (-1 when detached).
RefPtr< LayoutNode > previous_sibling() const
Get the sibling before this node (null at the start, at the root, or when detached).
Definition Container.h:452
virtual String key() const =0
Get the node's key (empty if unkeyed).
A nullable smart pointer.
Definition RefPtr.h:126
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32.
Definition String.h:31
A builder element (see <AppCore/layout/Builder.h>): anything that can append itself to a container.
Definition Container.h:21
Root namespace for every public Ultralight type, function, and enumeration.
void(*) LayoutOverrideCallback(void *user_data, Container *container, Rect content_box)
Layout delegate, called to place a container's children yourself.
Definition Callback.h:92
void(*) LayoutDestroyUserDataCallback(void *user_data)
Destroy hook for a callback registration's user data.
Definition Callback.h:27
Configuration options for a row or column container.
Definition Options.h:265
Line thickness, colors, and grab width for draggable pane dividers.
Definition DividerStyle.h:47
Position relative to an existing sibling in a container.
Definition Options.h:348
Configuration options for a panel in a row or column.
Definition Options.h:182
Float Rectangle Helper.
Definition Geometry.h:416
View-specific configuration settings.
Definition View.h:100