27 lines
705 B
C++
27 lines
705 B
C++
#include "RectangleWidget.hpp"
|
|
|
|
RectangleWidget::RectangleWidget(const WidgetConfig& config)
|
|
: Widget(config)
|
|
{
|
|
}
|
|
|
|
lv_obj_t* RectangleWidget::create(lv_obj_t* parent) {
|
|
obj_ = lv_obj_create(parent);
|
|
if (obj_ == nullptr) return nullptr;
|
|
|
|
lv_obj_remove_style_all(obj_);
|
|
lv_obj_set_pos(obj_, config_.x, config_.y);
|
|
lv_obj_set_size(obj_,
|
|
config_.width > 0 ? config_.width : 180,
|
|
config_.height > 0 ? config_.height : 120);
|
|
lv_obj_clear_flag(obj_, LV_OBJ_FLAG_SCROLLABLE);
|
|
lv_obj_clear_flag(obj_, LV_OBJ_FLAG_CLICKABLE);
|
|
|
|
return obj_;
|
|
}
|
|
|
|
void RectangleWidget::applyStyle() {
|
|
if (obj_ == nullptr) return;
|
|
applyCommonStyle();
|
|
}
|