UiUiUi
A user interface library for micro controller sketches based on U8g2
UIWidgetGroup.h
1 // SPDX-License-Identifier: BSD-2-Clause
2 // (C) 2022 Dirk Hillbrecht
3 
4 #pragma once
5 
6 #include "Arduino.h"
7 #include <U8g2lib.h>
8 
9 #include "UIArea.h"
10 #include "UIWidget.h"
11 #include "UIParent.h"
12 
29 class UIWidgetGroup: public UIWidget, public UIParent {
30 
31  public:
32 
35 
37  UIArea* render(U8G2* display,bool force);
38 
40  virtual void childNeedsRendering(UIWidget *child);
41 
42  protected:
43 
46 
49  // Note: This is protected as UICards handles this on its own.
50  // With a better abstraction, this could be made private.
51 
52  private:
53 
55  UIArea rendered;
56 
57 };
58 
59 // end of file
Area consisting of left, top, right, and bottom value.
Definition: UIArea.h:20
Simple abstraction of elements which have at least one child.
Definition: UIParent.h:14
Main abstraction of a group of interface widgets.
Definition: UIWidgetGroup.h:29
UIArea * render(U8G2 *display, bool force)
Default implementation of rendering a widget group is to render all of its sub-widgets.
Definition: UIWidgetGroup.cpp:22
bool renderChildren
Flag whether any child of this group needs to be rendered.
Definition: UIWidgetGroup.h:48
UIWidget * firstChild
The first of the widgets grouped by this widget group.
Definition: UIWidgetGroup.h:45
UIWidgetGroup(UIWidget *firstChild, UIWidget *next=nullptr)
Create a widget group with a linked list of sub-widgets and a potential successor.
Definition: UIWidgetGroup.cpp:12
virtual void childNeedsRendering(UIWidget *child)
Called by any child of this group to indicate that it wants to be rendered.
Definition: UIWidgetGroup.cpp:36
Basic widget class, ancestor of all UI widgets.
Definition: UIWidget.h:36
UIWidget * next
Pointer to the next widget on the same level.
Definition: UIWidget.h:65