Heaven v0.1.0-1
C++ global-menu library for Wayland sessions
Loading...
Searching...
No Matches
Public Member Functions
HNWithParent Class Reference

Mixin interface for client objects that can be nested inside a parent. More...

#include "HNWithParent.h"

Inheritance diagram for HNWithParent:
Inheritance graph
[legend]
Collaboration diagram for HNWithParent:
Collaboration graph
[legend]

Public Member Functions

virtual ~HNWithParent () noexcept
 Destructor. Detaches this object from its parent.
 
HNObjectparent () const noexcept
 Returns the parent object.
 
bool setParent (HNObject *parent) noexcept
 Sets the parent.
 
bool insertBefore (HNObject *sibling) noexcept
 Inserts this object before the specified sibling.
 

Detailed Description

Mixin interface for client objects that can be nested inside a parent.

Provides the API to attach an object to a parent implementing HNWithChildren and to reorder it among its siblings.

Constructor & Destructor Documentation

◆ ~HNWithParent()

virtual ~HNWithParent ( )
virtualnoexcept

Destructor. Detaches this object from its parent.

Declared virtual so the mixin is polymorphic, enabling safe cross-casts (via dynamic_cast) between the base subobjects of a concrete object.

Member Function Documentation

◆ insertBefore()

bool insertBefore ( HNObject sibling)
noexcept

Inserts this object before the specified sibling.

If sibling is nullptr, the object is inserted at the end of the current parent's children list.

If sibling has no parent, the operation has no effect. If sibling belongs to a different parent, this object is reparented to match the sibling's parent.

Parameters
siblingPointer to the sibling object before which this object will be inserted. May be nullptr.
Returns
true if the insertion succeeds; false if sibling is invalid.

◆ parent()

HNObject * parent ( ) const
inlinenoexcept

Returns the parent object.

Returns
The parent, or nullptr if none is set.

◆ setParent()

bool setParent ( HNObject parent)
noexcept

Sets the parent.

Appends this object to the parent's children list. If the same parent is provided, the object is not reinserted at the end. Passing nullptr detaches it from its current parent.

Parameters
parentObject implementing HNWithChildren, or nullptr.
Returns
false if parent is non-null and invalid, true otherwise.

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