UiUiUi
A user interface library for micro controller sketches based on U8g2
UIHorizontalLine.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 
12 
14 class UIHorizontalLine : public UIWidget {
15 
16  public:
17 
22  UIHorizontalLine(uint16_t border=0,uint16_t lineWidth=1,UIWidget* next=nullptr);
23 
26 
28  UIArea* render(U8G2 *display,bool force);
29 
30  protected:
31 
33  void computePreferredSize(U8G2 *display,UISize *preferredSize);
34 
35  private:
36 
38  uint16_t border;
39 
41  uint16_t lineWidth;
42 
43 };
44 
45 // end of file
Area consisting of left, top, right, and bottom value.
Definition: UIArea.h:20
Horizontal line with optional empty border on top and bottom, always spreads as wide as possible to t...
Definition: UIHorizontalLine.h:14
UIHorizontalLine(uint16_t border=0, uint16_t lineWidth=1, UIWidget *next=nullptr)
Create a horizontal line.
Definition: UIHorizontalLine.cpp:16
UIArea * render(U8G2 *display, bool force)
A line is only rendered if rendering is forced, otherwise it never changes.
Definition: UIHorizontalLine.cpp:23
void computePreferredSize(U8G2 *display, UISize *preferredSize)
The preferred size of a line is 1+2*border in height and "as wide as possible".
Definition: UIHorizontalLine.cpp:37
Representation of a size, i.e.
Definition: UISize.h:9
Basic widget class, ancestor of all UI widgets.
Definition: UIWidget.h:36
UISize preferredSize(U8G2 *display)
Return the preferred size of this widget, will be called before a call to layout().
Definition: UIWidget.cpp:16
UIWidget * next
Pointer to the next widget on the same level.
Definition: UIWidget.h:65