LVGLPlusPlus
C++ library on top of the lovely LVGL project.
Loading...
Searching...
No Matches
lvpp.h
Go to the documentation of this file.
1// Copyright 2023 Robert M. Wolff (bob dot wolff 68 at gmail dot com)
2//
3// Redistribution and use in source and binary forms, with or without modification,
4// are permitted provided that the following conditions are met:
5//
6// 1. Redistributions of source code must retain the above copyright notice, this
7// list of conditions and the following disclaimer.
8//
9// 2. Redistributions in binary form must reproduce the above copyright notice,
10// this list of conditions and the following disclaimer in the documentation and/or
11// other materials provided with the distribution.
12//
13// 3. Neither the name of the copyright holder nor the names of its contributors
14// may be used to endorse or promote products derived from this software without
15// specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27//
28#pragma once
29
30#ifdef LV_LVGL_H_INCLUDE_SIMPLE
31#include "lvgl.h"
32#else
33#include "lvgl/lvgl.h"
34#endif
35
36#ifdef USE_SDL
37#include "app_hal.h"
38#endif
39
40#include "lvppBase.h"
41
42#include <vector>
43#include <string>
44#include <map>
45
68class lvppScreen {
69public:
77 lvppScreen(lv_obj_t* _pInitScreen=nullptr);
78 ~lvppScreen() { if (pScreen) lv_obj_del(pScreen); };
92 void addObject(lvppBase* pObj);
98 lv_obj_t* getScreen() { return pScreen; };
99 //
100 // LV_SCR_LOAD_ANIM_OUT_RIGHT
112 void activateScreen(uint32_t anim_time=0, lv_scr_load_anim_t anim=LV_SCR_LOAD_ANIM_NONE);
119 void activatePriorScreen();
130 void disableScrollBars();
144 lvppBase* findObj(const char* pName);
152 bool setObjValue(const char* objName, int16_t val);
157 void setObjText(std::string str);
158protected:
159 lv_obj_t* pScreen=nullptr;
160 lv_obj_t* pPriorScreen;
161 std::vector<lvppBase*> objects;
162};
163
170class lvppSwitch : public lvppBase {
171public:
178 lvppSwitch(const char* fName, lv_obj_t* parent=nullptr);
184 void setEnabled(bool bEnable=true);
190 void setCheckedState(bool bChecked=true);
197 bool getCheckedState();
198};
199
206class lvppButton : public lvppBase {
207public:
215 lvppButton(const char* fName, const char* pText=nullptr, lv_obj_t* parent=nullptr);
216};
217
218//
219// Button has multiple "values"
220// Each click cycles forward through the list of values.
221//
229class lvppCycleButton : public lvppButton, public lvppOptions {
230public:
237 lvppCycleButton(const char* fName, lv_obj_t* parent=nullptr);
242 void clearOptions(void);
248 void setOptions(const char* pOption);
254 void setOptions(std::vector<std::string> &inOptions);
260 uint16_t getSelectedIndex() { return currentIndex; };
266 const char* getSelectedText() { return options[currentIndex].c_str(); };
267 void internalOnClicked();
268protected:
276 void lvOptionSetter(const char* pOpts) { setText(options[currentIndex].c_str()); };
282 virtual uint16_t lvOptionGetIndex() { return currentIndex; };
283 uint16_t currentIndex;
284};
285
291public:
298 lvppFullImageToggleButton(const char* fName, lv_obj_t* parent=nullptr);
307 lvppFullImageToggleButton(const char* fName, lv_img_dsc_t uncheckedImg, lv_img_dsc_t checkedImg, lv_obj_t* parent=nullptr);
314 void setImageSourceUnChecked(const lv_img_dsc_t img);
320 void setImageSourceChecked(const lv_img_dsc_t img);
321 virtual void onValueChanged();
322 virtual void onButtonChecked() { };
323 virtual void onButtonUnChecked() { };
324 bool getCheckedState(void);
325 void setCheckedState(bool bSetChecked=true);
326protected:
327 lv_img_dsc_t imgReleased;
328 lv_img_dsc_t imgPressed;
329 lv_obj_t* pImage;
331};
332
337class lvppImage : public lvppBase {
338public:
345 lvppImage(const char* fName, lv_obj_t* parent=nullptr);
346 ~lvppImage();
352 void setImage(const lv_img_dsc_t* pImg);
360 virtual void setSize(lv_coord_t width, lv_coord_t height);
366 void setRotation(int16_t rotTenthsOfDegrees);
372 void setPivotPoint(lv_coord_t xPivot, lv_coord_t yPivot);
373protected:
374 const lv_img_dsc_t* pImage;
377};
378
383class lvppLabel : public lvppBase {
384public:
392 lvppLabel(const char* fName, const char* pText=nullptr, lv_obj_t* parent=nullptr);
398 virtual void setText(const char* pText);
405 void setTextColor(lv_color_t newColor);
406};
407
415public:
422 lvppBar(const char* fName, lv_obj_t* parent=nullptr);
429 void setRange(int16_t range_min, int16_t range_max);
430protected:
436 int16_t baseGetter();
444 void baseSetter(int16_t nVal, bool animate=true);
445};
446
452public:
459 lvppSlider(const char* fName, lv_obj_t* parent=nullptr);
466 void setRange(int16_t range_min, int16_t range_max);
467protected:
473 int16_t baseGetter();
481 void baseSetter(int16_t nVal, bool animate=true);
482};
483
489public:
496 lvppArc(const char* fName, lv_obj_t* parent=nullptr);
502 void setArcColor(lv_color_t newColor);
508 void setArcIndicatorColor(lv_color_t newColor);
515 void setRange(int16_t range_min, int16_t range_max);
537 void setArcRotationAndSweep(uint16_t rot, uint16_t startAngle=361, uint16_t endAngle=361);
538protected:
544 int16_t baseGetter();
552 void baseSetter(int16_t nVal, bool animate=true);
553 lv_style_t style_ind;
555};
556
562class lvppDropdown : public lvppBase, public lvppOptions {
563public:
571 lvppDropdown(const char* fName, const char* pOptions=nullptr, lv_obj_t* parent=nullptr);
577 void setOptions(const char* pOptions);
583 void setOptions(std::vector<std::string> &options);
588 void clearOptions(void);
595 void setDropdownDirection(lv_dir_t dropDirection);
601 uint16_t getSelectedIndex() { return (uint16_t)lv_dropdown_get_selected(obj); };
607 void setSelectedIndex(uint16_t curInd);
615 void getSelectedText(char* selStr, uint8_t selStrLen) { lv_dropdown_get_selected_str(obj, selStr, selStrLen); };
616protected:
623 void lvOptionSetter(const char* pOpts);
629 virtual uint16_t lvOptionGetIndex();
630};
631
636class lvppRoller : public lvppBase, public lvppOptions {
637public:
645 lvppRoller(const char* fName, const char* pOptions=nullptr, lv_obj_t* parent=nullptr);
651 void setOptions(const char* pOptions);
657 void setOptions(std::vector<std::string> &options);
662 void clearOptions(void);
668 uint16_t getSelectedIndex() { return lv_roller_get_selected(obj); };
674 void setSelectedIndex(uint16_t curInd);
682 void getSelectedText(char* selStr, uint8_t selStrLen) { lv_roller_get_selected_str(obj, selStr, selStrLen); };
683protected:
690 virtual void lvOptionSetter(const char* pOpts);
696 virtual uint16_t lvOptionGetIndex();
697 // TODO: Add a vector of pair<int,string> and a map<int,int> indexToID and map<int,int> IDToIndex
698 // Then we can have a simple 'addOptions' where the user only can get the index or value out.
699 // But they can also addOptions(vector<pair<int,string>>) which then utilizes the map entries too.
700 // Might want to sort the options list prior to mapping everything?
701};
702
717public:
729 lvppCanvasFullColor(const char* fName, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h, lv_color_t* providedBuffer=nullptr, lv_obj_t* parent=nullptr);
730 virtual ~lvppCanvasFullColor();
736 void setbgColor(lv_color_t bgColor);
744 void drawPixel(lv_coord_t x, lv_coord_t y, lv_color_t color);
756 void drawRect(lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h,
757 lv_coord_t borderThickness, lv_color_t borderColor, lv_color_t fillColor, uint16_t radius, lv_opa_t opa);
766 void drawLine(lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2, lv_coord_t width, lv_color_t color);
778 void drawLabel(lv_coord_t x, lv_coord_t y, lv_coord_t maxW, lv_color_t color, const char* pText);
779protected:
780 lv_draw_rect_dsc_t* pDscRect; //< LVGL attribute for rectangle drawing
781 lv_draw_line_dsc_t* pDscLine; //< LVGL attribute for line drawing
782 lv_draw_label_dsc_t* pDscLabel; //< LVGL attribute for label drawing
783 lv_point_t twoPoints[2]; //< Supporting the two-point line draw
784 lv_color_t* pBuffer; //< Location of canvas color buffer if allocated internally.
785 lv_coord_t width, height; //< Width and Height of this canvas.
786};
787
836public:
853 lvppCanvasIndexed(const char* fName, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h, uint8_t colorDepth, lv_color_t* providedBuffer=nullptr, lv_obj_t* parent=nullptr);
854 virtual ~lvppCanvasIndexed();
862 bool addColorToIndex(lv_color_t col);
877 bool addPaletteToIndex(lv_palette_t pal);
882 void clearColorIndex();
891 bool getIndexFromColor(lv_color_t col, lv_color_t& ind);
897 void setbgColor(lv_color_t bgColor);
903 void setbgColorByIndex(lv_color_t bgColorIndex);
911 void drawPixel(lv_coord_t x, lv_coord_t y, lv_color_t color);
919 void drawPixelByIndex(lv_coord_t x, lv_coord_t y, lv_color_t colorIndex);
927 void drawLineVert(lv_coord_t x1, lv_coord_t y1, lv_coord_t h, lv_color_t color);
935 void drawLineVertByIndex(lv_coord_t x1, lv_coord_t y1, lv_coord_t h, lv_color_t indexCol);
943 void drawLineHoriz(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_color_t color);
951 void drawLineHorizByIndex(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_color_t indexCol);
959 void drawRectWithoutFill(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_coord_t h,
960 lv_color_t borderColor);
968 void drawRectWithoutFillByIndex(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_coord_t h,
969 lv_color_t borderColorInd);
978 void drawRectWithFill(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_coord_t h,
979 lv_color_t borderColor, lv_color_t fillColor);
988 void drawRectWithFillByIndex(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_coord_t h,
989 lv_color_t borderColorInd, lv_color_t fillColorInd);
996 void drawCenteredRectWithoutFill(lv_coord_t xBorder, lv_coord_t yBorder, lv_color_t borderColor);
1004 void drawCenteredRectWithoutFillByIndex(lv_coord_t xBorder, lv_coord_t yBorder, lv_color_t borderColorInd);
1012 void drawCenteredRectWithFill(lv_coord_t xBorder, lv_coord_t yBorder,
1013 lv_color_t borderColor, lv_color_t fillColor);
1022 void drawCenteredRectWithFillByIndex(lv_coord_t xBorder, lv_coord_t yBorder,
1023 lv_color_t borderColorInd, lv_color_t fillColorInd);
1024protected:
1028#if LV_COLOR_DEPTH == 16
1029 std::map<uint16_t, uint8_t> colorToIndex;
1030#elif LV_COLOR_DEPTH == 8
1031 std::map<uint8_t, uint8_t> colorToIndex;
1032#endif
1033 lv_color_t* pBuffer; //< Location of canvas color buffer if allocated internally.
1034 lv_coord_t width, height; //< Width and Height of this canvas.
1035};
Support file for app_hal.c which is only used in simulation/native builds.
Create an Arc widget - also based on lvppBaseWithValue like Bar and Slider.
Definition: lvpp.h:488
void baseSetter(int16_t nVal, bool animate=true)
Implementation which sets the current value of the widget itself. This function generally gets called...
Definition: lvppArc.cpp:50
lv_style_t style_pressed_color
Definition: lvpp.h:554
void setArcIndicatorColor(lv_color_t newColor)
Set the Arc's indicator Color - can be useful for custom values/ranges corresponding to different vis...
void setRange(int16_t range_min, int16_t range_max)
Set the Range of your new arc widget.
Definition: lvppArc.cpp:70
void setArcRotationAndSweep(uint16_t rot, uint16_t startAngle=361, uint16_t endAngle=361)
Set the Arc Rotation And Sweep amounts.
Definition: lvppArc.cpp:59
lv_style_t style_ind
Definition: lvpp.h:553
void setArcColor(lv_color_t newColor)
Set the Arc Color - can be useful for custom values/ranges corresponding to different visual represen...
Definition: lvppArc.cpp:54
int16_t baseGetter()
Implementation of getting the value from the widget.
Definition: lvppArc.cpp:46
Create a 'bar' widget from LVGL and allow range and value to be used.
Definition: lvpp.h:414
int16_t baseGetter()
Implementation of getting the value from the widget.
Definition: lvppBar.cpp:42
void setRange(int16_t range_min, int16_t range_max)
Set the Range of your new bar widget.
Definition: lvppBar.cpp:50
void baseSetter(int16_t nVal, bool animate=true)
Implementation which sets the current value of the widget itself. This function generally gets called...
Definition: lvppBar.cpp:46
lvppBase is the root of the C++ library LVGLPlusPlus. It strives to create consistent ways to manipul...
Definition: lvppBase.h:70
lv_obj_t * obj
The LVGL object that was created for this widget.
Definition: lvppBase.h:359
virtual void setText(const char *pText)
Set the Text for the primary text label. For a button, for instance, this is the text on top of the b...
Definition: lvppBase.cpp:190
Derivation from lvppBase. Those widgets which have an inherant 'value' to show are based on this slig...
Definition: lvppBase.h:408
Basic button class.
Definition: lvpp.h:206
Construct a canvas which uses FULL_COLOR rather than indexed color methods.
Definition: lvpp.h:716
lv_draw_rect_dsc_t * pDscRect
Definition: lvpp.h:780
lv_coord_t width
Definition: lvpp.h:785
void drawPixel(lv_coord_t x, lv_coord_t y, lv_color_t color)
Draw a single pixel on to the canvas.
Definition: lvppCanvas.cpp:405
virtual ~lvppCanvasFullColor()
Definition: lvppCanvas.cpp:386
lv_point_t twoPoints[2]
Definition: lvpp.h:783
void drawRect(lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h, lv_coord_t borderThickness, lv_color_t borderColor, lv_color_t fillColor, uint16_t radius, lv_opa_t opa)
Draw a rectangle on the canvas.
Definition: lvppCanvas.cpp:409
lv_color_t * pBuffer
Definition: lvpp.h:784
void drawLabel(lv_coord_t x, lv_coord_t y, lv_coord_t maxW, lv_color_t color, const char *pText)
Draw a text label onto the canvas.
Definition: lvppCanvas.cpp:447
void setbgColor(lv_color_t bgColor)
Set the background color of the canvas.
Definition: lvppCanvas.cpp:401
lv_draw_label_dsc_t * pDscLabel
Definition: lvpp.h:782
void drawLine(lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2, lv_coord_t width, lv_color_t color)
Draw a line on the canvas.
Definition: lvppCanvas.cpp:429
lv_draw_line_dsc_t * pDscLine
Definition: lvpp.h:781
lv_coord_t height
Definition: lvpp.h:785
Construct a canvas which uses INDEXED color rather than FULL color methods.
Definition: lvpp.h:835
lv_coord_t height
Definition: lvpp.h:1034
void drawRectWithoutFillByIndex(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_coord_t h, lv_color_t borderColorInd)
Draw a rectangle on the canvas without filling in the rectangle using an index color.
Definition: lvppCanvas.cpp:248
lv_color_t * pBuffer
Definition: lvpp.h:1033
void setbgColorByIndex(lv_color_t bgColorIndex)
Set the backgrond color from an index color.
Definition: lvppCanvas.cpp:163
void drawRectWithFillByIndex(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_coord_t h, lv_color_t borderColorInd, lv_color_t fillColorInd)
Draw a rectangle on the canvas and fill in the center of the rectangle. This uses index colors.
Definition: lvppCanvas.cpp:281
void drawPixelByIndex(lv_coord_t x, lv_coord_t y, lv_color_t colorIndex)
Draw a single pixel on to the canvas using an index color.
Definition: lvppCanvas.cpp:182
void clearColorIndex()
Remove all colors from the indexed color set.
Definition: lvppCanvas.cpp:137
void drawLineHoriz(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_color_t color)
Draw a horizontal line on the canvas.
Definition: lvppCanvas.cpp:214
bool getIndexFromColor(lv_color_t col, lv_color_t &ind)
Get the Index of a single Color.
Definition: lvppCanvas.cpp:142
void drawPixel(lv_coord_t x, lv_coord_t y, lv_color_t color)
Draw a single pixel on to the canvas.
Definition: lvppCanvas.cpp:172
uint16_t maxColorIndexesAllowed
Number of color indexes available based on the color depth at creation time.
Definition: lvpp.h:1025
void drawRectWithFill(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_coord_t h, lv_color_t borderColor, lv_color_t fillColor)
Draw a rectangle on the canvas and fill in the center of the rectangle.
Definition: lvppCanvas.cpp:270
void drawLineHorizByIndex(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_color_t indexCol)
Draw a horizontal line on the canvas using an index color.
Definition: lvppCanvas.cpp:224
lv_coord_t width
Definition: lvpp.h:1034
void drawCenteredRectWithoutFillByIndex(lv_coord_t xBorder, lv_coord_t yBorder, lv_color_t borderColorInd)
Draw a centered rectangle on the canvas. Will have xBorder/yBorder around it. This uses index colors.
Definition: lvppCanvas.cpp:324
virtual ~lvppCanvasIndexed()
Definition: lvppCanvas.cpp:91
bool addPaletteToIndex(lv_palette_t pal)
Add a full palette of color to the indexed color set. This is 10 colors.
Definition: lvppCanvas.cpp:114
void drawLineVertByIndex(lv_coord_t x1, lv_coord_t y1, lv_coord_t h, lv_color_t indexCol)
Draw a verical line on the canvas using an index color.
Definition: lvppCanvas.cpp:201
void drawRectWithoutFill(lv_coord_t x1, lv_coord_t y1, lv_coord_t w, lv_coord_t h, lv_color_t borderColor)
Draw a rectangle on the canvas without filling in the rectangle.
Definition: lvppCanvas.cpp:237
bool addColorToIndex(lv_color_t col)
Add a single color to the indexed color set.
Definition: lvppCanvas.cpp:100
void drawCenteredRectWithFillByIndex(lv_coord_t xBorder, lv_coord_t yBorder, lv_color_t borderColorInd, lv_color_t fillColorInd)
Draw a centered rectangle on the canvas and fill in the rectangle. Will have xBorder/yBorder around i...
Definition: lvppCanvas.cpp:350
void setbgColor(lv_color_t bgColor)
Set the background color of the canvas.
Definition: lvppCanvas.cpp:153
void drawCenteredRectWithFill(lv_coord_t xBorder, lv_coord_t yBorder, lv_color_t borderColor, lv_color_t fillColor)
Draw a centered rectangle on the canvas and fill in the rectangle. Will have xBorder/yBorder around i...
Definition: lvppCanvas.cpp:339
void drawCenteredRectWithoutFill(lv_coord_t xBorder, lv_coord_t yBorder, lv_color_t borderColor)
Draw a centered rectangle on the canvas. Will have xBorder/yBorder around it.
Definition: lvppCanvas.cpp:314
uint8_t colorIndexesUsed
Definition: lvpp.h:1026
void drawLineVert(lv_coord_t x1, lv_coord_t y1, lv_coord_t h, lv_color_t color)
Draw a verical line on the canvas.
Definition: lvppCanvas.cpp:191
Derived from lvppButton, this is a button who's clicks cycle through a list of options.
Definition: lvpp.h:229
void lvOptionSetter(const char *pOpts)
This is the implementation of the pure virtual in lvppOptions. It is responsible for doing the actual...
Definition: lvpp.h:276
void setOptions(const char *pOption)
Add button options using a single char* with options separated by \n
Definition: lvppButton.cpp:57
const char * getSelectedText()
Get the Current Text of the button label.
Definition: lvpp.h:266
void clearOptions(void)
Remove all options from the current options list.
Definition: lvppButton.cpp:52
uint16_t getSelectedIndex()
Get the Current Index of which option is the active label on the button.
Definition: lvpp.h:260
uint16_t currentIndex
Current value of which option is active on the button label.
Definition: lvpp.h:283
virtual uint16_t lvOptionGetIndex()
This is the implementation of the pure virtual in lvppOptions. It is responsible for doing the actual...
Definition: lvpp.h:282
void internalOnClicked()
Internal version of the onClicked() callback which is used for other derived internal objects in the ...
Definition: lvppButton.cpp:72
Support for drop-down lists and choosing from a dropdown. Utilizes multiple inheritance of lvppBase a...
Definition: lvpp.h:562
virtual uint16_t lvOptionGetIndex()
This is the implementation of the pure virtual in lvppOptions. It is responsible for doing the actual...
Definition: lvppDropdown.cpp:46
void setOptions(const char *pOptions)
sets the complete list of options by way of a char pointer with options separated by \n
Definition: lvppDropdown.cpp:53
void setSelectedIndex(uint16_t curInd)
Set the selected option manually/programmatically.
Definition: lvppDropdown.cpp:76
void getSelectedText(char *selStr, uint8_t selStrLen)
Get the Text value of the currently selected option.
Definition: lvpp.h:615
void lvOptionSetter(const char *pOpts)
This is the implementation of the pure virtual in lvppOptions. It is responsible for doing the actual...
Definition: lvppDropdown.cpp:42
uint16_t getSelectedIndex()
Get the Index of the selected option.
Definition: lvpp.h:601
void clearOptions(void)
Removes all options from the dropdown.
Definition: lvppDropdown.cpp:61
void setDropdownDirection(lv_dir_t dropDirection)
Set the Dropdown Direction. Depending on the screen location of the drop-down, it may be desirable to...
Definition: lvppDropdown.cpp:72
Button which is all image based and simply toggles on/off between the images.
Definition: lvpp.h:290
~lvppFullImageToggleButton()
Definition: lvppButton.cpp:111
virtual void onButtonChecked()
Definition: lvpp.h:322
virtual void onButtonUnChecked()
Definition: lvpp.h:323
void setImageSourceChecked(const lv_img_dsc_t img)
Set the Image Source for the checked image.
Definition: lvppButton.cpp:122
void setCheckedState(bool bSetChecked=true)
Definition: lvppButton.cpp:145
virtual void onValueChanged()
Callback that derived objects can use to get notification when the value changes of an object.
Definition: lvppButton.cpp:126
bool bIsChecked
Definition: lvpp.h:330
lv_img_dsc_t imgReleased
Definition: lvpp.h:327
lv_img_dsc_t imgPressed
Definition: lvpp.h:328
bool getCheckedState(void)
Definition: lvppButton.cpp:141
lv_obj_t * pImage
Definition: lvpp.h:329
void setImageSourceUnChecked(const lv_img_dsc_t img)
Set the Image Source for the unchecked image.
Definition: lvppButton.cpp:118
Object for loading and displaying an image on a screen.
Definition: lvpp.h:337
void setImage(const lv_img_dsc_t *pImg)
Set the Image to be displayed. This is a pre-prepared lv_img_dsc_t directly from LVGL.
Definition: lvppImage.cpp:47
bool noRotation
Definition: lvpp.h:376
void setRotation(int16_t rotTenthsOfDegrees)
Set the Rotation angle of the image about the setPivot point.
Definition: lvppImage.cpp:102
virtual void setSize(lv_coord_t width, lv_coord_t height)
Set the Size object. In the case of lvppImage, we need to scale/zoom the image to match the size desi...
Definition: lvppImage.cpp:65
int16_t deferred_w
Definition: lvpp.h:375
int16_t deferred_h
Definition: lvpp.h:375
~lvppImage()
Definition: lvppImage.cpp:43
void setPivotPoint(lv_coord_t xPivot, lv_coord_t yPivot)
Set the Pivot Point for the image. Rotations will happen about this point.
Definition: lvppImage.cpp:111
const lv_img_dsc_t * pImage
Definition: lvpp.h:374
Enable the display of a text item.
Definition: lvpp.h:383
void setTextColor(lv_color_t newColor)
Set the Text Color of the label (not the background)
Definition: lvppLabel.cpp:60
virtual void setText(const char *pText)
Set the Text value to display.
Definition: lvppLabel.cpp:51
Utility class to aid in consistent handling of all lv_ widgets which have a list of choices....
Definition: lvppBase.h:547
std::vector< std::string > options
The vector of options kept locally.
Definition: lvppBase.h:632
Construct a roller list widget for option selection.
Definition: lvpp.h:636
void setSelectedIndex(uint16_t curInd)
Set the selected option manually/programmatically.
Definition: lvppDropdown.cpp:127
virtual void lvOptionSetter(const char *pOpts)
This is the implementation of the pure virtual in lvppOptions. It is responsible for doing the actual...
Definition: lvppDropdown.cpp:95
void clearOptions(void)
Removes all options from the roller.
Definition: lvppDropdown.cpp:117
void setOptions(const char *pOptions)
sets the complete list of options by way of a char pointer with options separated by \n
Definition: lvppDropdown.cpp:106
virtual uint16_t lvOptionGetIndex()
This is the implementation of the pure virtual in lvppOptions. It is responsible for doing the actual...
Definition: lvppDropdown.cpp:99
void getSelectedText(char *selStr, uint8_t selStrLen)
Get the Text value of the currently selected option.
Definition: lvpp.h:682
uint16_t getSelectedIndex()
Get the Index of the currently selected option.
Definition: lvpp.h:668
The lvppScreen is a non - lvppBase object for organizing the use of multiple screens in a project.
Definition: lvpp.h:68
lv_obj_t * pPriorScreen
Holder for prior screen when activateScreen() is called. Used in activatePriorScreen()
Definition: lvpp.h:160
~lvppScreen()
Definition: lvpp.h:78
bool setObjValue(const char *objName, int16_t val)
Set the value of the object objName to val if found.
Definition: lvppScreen.cpp:92
lv_obj_t * pScreen
The actual underlying LVGL screen pointer.
Definition: lvpp.h:159
std::vector< lvppBase * > objects
Data structure used to hold all of the object pointers.
Definition: lvpp.h:161
lvppBase * findObj(const char *pName)
Obtain a pointer to an object which was prior added to the lvppScreen by addObject().
Definition: lvppScreen.cpp:78
void activateScreen(uint32_t anim_time=0, lv_scr_load_anim_t anim=LV_SCR_LOAD_ANIM_NONE)
Load/Activate this screen either with or without animation based on parameters given.
Definition: lvppScreen.cpp:55
lv_obj_t * getScreen()
Get a pointer to the LVGL lv_obj_t screen object.
Definition: lvpp.h:98
void activatePriorScreen()
If you've activated this screen via activateScreen(), then this method will activate the screen which...
Definition: lvppScreen.cpp:65
void disableScrollBars()
Defeats the automatic use of scrollbars by LVGL when certain drawing operations might cause them to a...
Definition: lvppScreen.cpp:51
void addObject(lvppBase *pObj)
Add any lvppBase object pointer to the screen to keep track of.
Definition: lvppScreen.cpp:72
void setObjText(std::string str)
Construct a new Slider widget (similar to a bar in LVGL parlance).
Definition: lvpp.h:451
void setRange(int16_t range_min, int16_t range_max)
Set the Range of your new slider widget.
Definition: lvppBar.cpp:80
int16_t baseGetter()
Implementation of getting the value from the widget.
Definition: lvppBar.cpp:72
void baseSetter(int16_t nVal, bool animate=true)
Implementation which sets the current value of the widget itself. This function generally gets called...
Definition: lvppBar.cpp:76
On/Off switch widget.
Definition: lvpp.h:170
bool getCheckedState()
Get the Checked State of the switch.
Definition: lvppButton.cpp:186
void setCheckedState(bool bChecked=true)
Set the Checked State either on or off.
Definition: lvppButton.cpp:177
void setEnabled(bool bEnable=true)
Set the switch to be enabled or disabled.
Definition: lvppButton.cpp:168
Base class for LVGLPlusPlus widgets (lvppBase)