71 lines
1.8 KiB
C++
71 lines
1.8 KiB
C++
/*
|
|
* Copyright (c) 2023 Fancy Code.
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, softwareZhoufuwuqimima123
|
|
*
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
#ifndef LVGL_WIDGET_H
|
|
#define LVGL_WIDGET_H
|
|
#include "GuiEngine.h"
|
|
#include "lvgl.h"
|
|
|
|
|
|
|
|
class LvglWidget : public Widget
|
|
{
|
|
public:
|
|
LvglWidget()
|
|
{
|
|
mWidget = nullptr;
|
|
}
|
|
virtual ~LvglWidget() = default;
|
|
void SetSize(const int16_t width, const int16_t height) override;
|
|
// void Load(void) override; // 好像挺有用的, 但不知道什么意思
|
|
void Center(void) override;
|
|
void SetColor(uint32_t color) override;
|
|
void AlignTo(std::shared_ptr<Widget> base, i_lv_align_t align, int16_t posX, int16_t posY) override;
|
|
void SetPos(int16_t posX, int16_t posY) override;
|
|
void SetOpa(const uint8_t opaValue) override;
|
|
void SetEventCb(i_lv_event_cb_t eventCb) override;
|
|
void EventSend(i_lv_event_code_t e, void * userData) override;
|
|
void Delete(void) override;
|
|
|
|
public:
|
|
lv_obj_t *mWidget;
|
|
i_lv_event_cb_t mEventCb;
|
|
};
|
|
|
|
|
|
class ImageWidget : public LvglWidget
|
|
{
|
|
public:
|
|
void ImageSetSrc(const void *src) override;
|
|
};
|
|
|
|
|
|
class ButtonWidget : public LvglWidget
|
|
{
|
|
public:
|
|
void SetColor(uint32_t color) override;
|
|
|
|
};
|
|
|
|
|
|
class LabelWidget : public LvglWidget
|
|
{
|
|
public:
|
|
void SetText(const char *text) override;
|
|
};
|
|
|
|
|
|
#endif // !LVGL_WIDGET_H
|