docs
Loading...
Searching...
No Matches
InsertPosition

#include <AppCore/layout/Options.h>

Overview

Position relative to an existing sibling in a container.

An InsertPosition places a node before or after an existing sibling instead of appending to the end of the container. You pass it when adding panels or rearranging children.

The helper functions Before() and After() position nodes around an existing child:

RefPtr<Panel> toolbar = window->layout()->AddPanel(
{ .key = "toolbar", .size = "44px" }, Before(content));
body->Move(sidebar, After(content)); // put the sidebar on the right
A nullable smart pointer.
Definition RefPtr.h:126
InsertPosition Before(RefPtr< LayoutNode > anchor)
Create an insertion position immediately before a sibling.
Definition Options.h:365
InsertPosition After(RefPtr< LayoutNode > anchor)
Create an insertion position immediately after a sibling.
Definition Options.h:372

Relative Placement

Container methods accept helper functions or default construction:

  • Before() places the child immediately before an anchor sibling.
  • After() places the child immediately after an anchor sibling.
  • A default-constructed position appends the child at the end of the container. This applies whenever you omit the position argument or construct one with no anchor.

When the anchor sibling isn't a direct child of the container, the library logs a warning and appends the node at the end.

Note
The anchor member here is an existing sibling LayoutNode within the container. Floating panels use the Anchor class instead to position overlays in window space.
See also
Before(), After(), Container::AddPanel(), Container::Move()

Public Attributes

RefPtr< LayoutNode > anchor
 The sibling the position is relative to.
bool after = false
 Whether or not the position is after the anchor (Before() when false).

Member Data Documentation

◆ after

bool after = false

Whether or not the position is after the anchor (Before() when false).

◆ anchor

RefPtr<LayoutNode> anchor

The sibling the position is relative to.

Null means append at the end.


The documentation for this struct was generated from the following file: