UiUiUi
A user interface library for micro controller sketches based on U8g2
Public Member Functions | Protected Member Functions | List of all members
UIEnvelope Class Reference

Envelope widget which contains exactly one other widget and changes its representation. More...

#include <UIEnvelope.h>

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

Public Member Functions

 UIEnvelope (UIExpansion expansion, UIAlignment alignment, UISize borderSize=UISize(), UIWidget *content=nullptr, UIWidget *next=nullptr)
 Create an envelope widget. More...
 
 UIEnvelope (UIExpansion expansion, UIAlignment alignment, UIWidget *content, UIWidget *next=nullptr)
 Create an envelope widget without border. More...
 
void layout (U8G2 *display, UIArea *dim)
 Layout the envelope. More...
 
UIArearender (U8G2 *display, bool force)
 Render the envelope - which also renders the content if it exists. More...
 
void childNeedsRendering (UIWidget *child)
 Called by the child of this envelope to indicate that it wants to be rendered. More...
 
- Public Member Functions inherited from UIWidget
UISize preferredSize (U8G2 *display)
 Return the preferred size of this widget, will be called before a call to layout(). More...
 
virtual void layout (U8G2 *display, UIArea *area)
 Layout widget in the given rectanglar area, will be called before first call to render(). More...
 
virtual UIArearender (U8G2 *display, bool force)=0
 Render component in the space given in layout(). More...
 
virtual void setParent (UIParent *parent)
 Set the parent widget group (if it exists). More...
 
virtual void childNeedsRendering (UIWidget *child)=0
 Called by any child of this group to indicate that it wants to be rendered. More...
 

Protected Member Functions

void computePreferredSize (U8G2 *display, UISize *preferredSize)
 Compute the preferred size which is determined by the content by may be changed by the envelope. More...
 
- Protected Member Functions inherited from UIWidget
 UIWidget (UIWidget *next=nullptr)
 Initialize this widget and potentially set its successor.
 
void clearBox (U8G2 *display, UIArea *dimm)
 Clear the given area.
 
void clearFull (U8G2 *display)
 Clear the full area of this widget.
 
void clip (U8G2 *display)
 Set U8g2's clip window to the area of this widget, should be called from render().
 
virtual void computePreferredSize (U8G2 *display, UISize *preferredSize)=0
 Store preferred size of this widget into the preferredSize reference. More...
 
void signalNeedsRendering ()
 Called internally: Signals to parent that this widget needs to be rendered.
 

Additional Inherited Members

- Public Attributes inherited from UIWidget
UIWidgetnext
 Pointer to the next widget on the same level.
 
- Protected Attributes inherited from UIWidget
UIArea dim
 Actual area of this widget, set in layout().
 
UIParentparent
 Reference to the group this widget is connected to.
 

Detailed Description

Envelope widget which contains exactly one other widget and changes its representation.

The envelope can do the following things:

Constructor & Destructor Documentation

◆ UIEnvelope() [1/2]

UIEnvelope::UIEnvelope ( UIExpansion  expansion,
UIAlignment  alignment,
UISize  borderSize = UISize(),
UIWidget content = nullptr,
UIWidget next = nullptr 
)

Create an envelope widget.

Parameters
expansionReport an enlarged preferred size to the caller for the axes given by this parameter.
alignmentAlign the content widget this way if it is smaller than the area of the envelope.
borderSizeGenerate an empty border of this size around the content widget
contentThe content of the envelope. If empty, the envelope renders an empty area.
nextNext widget on the same level as the envelope.

◆ UIEnvelope() [2/2]

UIEnvelope::UIEnvelope ( UIExpansion  expansion,
UIAlignment  alignment,
UIWidget content,
UIWidget next = nullptr 
)

Create an envelope widget without border.

Parameters
expansionReport an enlarged preferred size to the caller for the axes given by this parameter.
alignmentAlign the content widget this way if it is smaller than the area of the envelope.
contentThe content of the envelope. If empty, the envelope renders an empty area.
nextNext widget on the same level as the envelope.

Member Function Documentation

◆ childNeedsRendering()

void UIEnvelope::childNeedsRendering ( UIWidget child)
virtual

Called by the child of this envelope to indicate that it wants to be rendered.

Implements UIParent.

◆ computePreferredSize()

void UIEnvelope::computePreferredSize ( U8G2 *  display,
UISize preferredSize 
)
protectedvirtual

Compute the preferred size which is determined by the content by may be changed by the envelope.

Implements UIWidget.

◆ layout()

void UIEnvelope::layout ( U8G2 *  display,
UIArea dim 
)
virtual

Layout the envelope.

This includes shaping the content according to all the constraints.

Reimplemented from UIWidget.

◆ render()

UIArea * UIEnvelope::render ( U8G2 *  display,
bool  force 
)
virtual

Render the envelope - which also renders the content if it exists.

Implements UIWidget.


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