portrait: size adjustments

This commit is contained in:
Raphael Coeffic
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent cf8a532e2d
commit ae5d1759f1
3 changed files with 15 additions and 2 deletions
+4 -1
View File
@@ -42,6 +42,10 @@ ChoiceBase::ChoiceBase(Window* parent, const rect_t& rect, ChoiceType type,
FormField(parent, rect, windowFlags), type(type)
{
lv_obj_set_height(lvobj, LV_SIZE_CONTENT);
lv_obj_set_width(lvobj, LV_SIZE_CONTENT);
lv_obj_set_layout(lvobj, LV_LAYOUT_FLEX);
lv_obj_set_flex_flow(lvobj, LV_FLEX_FLOW_ROW);
lv_obj_add_event_cb(lvobj, choicePaintCallback, LV_EVENT_DRAW_MAIN_BEGIN, lvobj);
label = lv_label_create(lvobj);
@@ -62,7 +66,6 @@ ChoiceBase::ChoiceBase(Window* parent, const rect_t& rect, ChoiceType type,
lv_obj_set_style_bg_color(lvobj, makeLvColor(COLOR_THEME_FOCUS), LV_PART_MAIN | LV_STATE_FOCUSED);
lv_obj_set_style_text_color(lvobj, makeLvColor(COLOR_THEME_PRIMARY2), LV_PART_MAIN | LV_STATE_FOCUSED);
lv_obj_set_width(label, lv_pct(80));
lv_obj_set_style_pad_left(label, FIELD_PADDING_LEFT, LV_PART_MAIN);
lv_obj_set_style_pad_top(label, FIELD_PADDING_TOP, LV_PART_MAIN);
+10 -1
View File
@@ -55,7 +55,16 @@ static void numberedit_cb(lv_event_t* e)
}
// create a new class for number edit so we can set the sytles differently if needed.
lv_obj_class_t lv_numberedit_class = lv_textarea_class;
const lv_obj_class_t lv_numberedit_class = {
.constructor_cb = lv_textarea_class.constructor_cb,
.destructor_cb = lv_textarea_class.destructor_cb,
.event_cb = lv_textarea_class.event_cb,
.group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE,
.width_def = LV_DPI_DEF / 2,
.height_def = LV_SIZE_CONTENT,
.instance_size = sizeof(lv_textarea_t),
.base_class = &lv_obj_class
};
lv_obj_t *lv_numberedit_create(lv_obj_t *parent)
{
+1
View File
@@ -50,3 +50,4 @@ class NumberEdit : public BaseNumberEdit
std::function<bool(int)> isValueAvailable;
};
extern const lv_obj_class_t lv_numberedit_class;