Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::Layout Class Reference

Base layout container that arranges resizable elements. More...

#include <spk_layout.hpp>

Inheritance diagram for spk::Layout:
Inheritance graph
Collaboration diagram for spk::Layout:
Collaboration graph

Classes

struct  Element
 Layout element entry with sizing policy and extra data. More...
struct  SizePolicy
 Defines sizing policies for layout elements. More...

Public Member Functions

void setPadding (const spk::Vector2UInt &p_padding)
 Sets layout padding between elements.
const spk::Vector2UIntpadding () const
 Returns layout padding.
void clear ()
 Removes all elements from the layout.
template<typename TExtra>
void addElement (ResizableElement *p_element, const SizePolicy &p_sizePolicy, TExtra &&p_extra)
 Adds an element with extra layout data.
void addElement (ResizableElement *p_element, const SizePolicy &p_sizePolicy)
 Adds an element with a size policy.
Public Member Functions inherited from spk::ResizableElement
virtual void setGeometry (const Extend2D &p_extend)=0
 Sets the element geometry.
SizeHintsizeHint ()
 Returns mutable size hint data.
const SizeHintsizeHint () const
 Returns const size hint data.

Protected Types

using ElementContainer = std::vector<Element>
 Container type used to store elements.

Protected Member Functions

const ElementContainer_elements () const
 Returns the stored elements.

Protected Attributes

ElementContainer _elementContainer
 Stored layout elements.

Detailed Description

Base layout container that arranges resizable elements.

spk::Layout layout;
layout.setPadding({4, 4});
Base layout container that arranges resizable elements.
Definition spk_layout.hpp:24
void setPadding(const spk::Vector2UInt &p_padding)
Sets layout padding between elements.
Definition spk_layout.cpp:5

Member Function Documentation

◆ _elements()

const Layout::ElementContainer & spk::Layout::_elements ( ) const
protected

Returns the stored elements.

Returns
Const container reference.
Here is the caller graph for this function:

◆ addElement() [1/2]

void spk::Layout::addElement ( ResizableElement * p_element,
const SizePolicy & p_sizePolicy )

Adds an element with a size policy.

Parameters
p_elementElement pointer.
p_sizePolicySize policy to apply.
Here is the call graph for this function:

◆ addElement() [2/2]

template<typename TExtra>
void spk::Layout::addElement ( ResizableElement * p_element,
const SizePolicy & p_sizePolicy,
TExtra && p_extra )
inline

Adds an element with extra layout data.

Template Parameters
TExtraExtra data type.
Parameters
p_elementElement pointer.
p_sizePolicySize policy to apply.
p_extraExtra data to store.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ padding()

const spk::Vector2UInt & spk::Layout::padding ( ) const

Returns layout padding.

Returns
Padding vector.
Here is the caller graph for this function:

◆ setPadding()

void spk::Layout::setPadding ( const spk::Vector2UInt & p_padding)

Sets layout padding between elements.

Parameters
p_paddingPadding vector.
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files:
  • includes/structure/widget/spk_layout.hpp
  • srcs/structure/widget/spk_layout.cpp