Skip to content

Commit

Permalink
Initialisation of UI elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz committed Dec 12, 2023
1 parent 7b16373 commit 78a5908
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions radio/src/gui/colorlcd/layouts/sliders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ MainViewSlider::MainViewSlider(Window* parent, const rect_t& rect, uint8_t idx,
}

sliderIcon = new SliderIcon(this);
coord_t x = 0, y = 0;
if (isVertical)
y = (height() - TRIM_SQUARE_SIZE) / 2;
else
y = (width() - TRIM_SQUARE_SIZE) / 2;
lv_obj_set_pos(sliderIcon->getLvObj(), x, y);
}

void MainViewSlider::deleteLater(bool detach, bool trash)
Expand Down
6 changes: 6 additions & 0 deletions radio/src/gui/colorlcd/layouts/trims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ MainViewTrim::MainViewTrim(Window* parent, const rect_t& rect, uint8_t idx,
}

trimIcon = new TrimIcon(this, isVertical);
coord_t x = 0, y = 0;
if (isVertical)
y = (height() - TRIM_SQUARE_SIZE) / 2;
else
y = (width() - TRIM_SQUARE_SIZE) / 2;
lv_obj_set_pos(trimIcon->getLvObj(), x, y);

trimValue = new DynamicNumber<int16_t>(
this, {0, 0, TRIM_SQUARE_SIZE, 12},
Expand Down
2 changes: 2 additions & 0 deletions radio/src/gui/colorlcd/widgets/outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ class ChannelValue : public Window
lv_obj_set_style_bg_opa(bar, LV_OPA_COVER, LV_PART_MAIN);
lv_obj_add_style(bar, &style, LV_PART_MAIN);
lv_obj_clear_flag(bar, LV_OBJ_FLAG_CLICKABLE);
lv_obj_set_size(bar, 0, ROW_HEIGHT - 1);

valueLabel = lv_label_create(lvobj);
etx_font(valueLabel, FONT_XS_INDEX);
etx_obj_add_style(valueLabel, styles->text_align_right, LV_PART_MAIN);
lv_obj_add_style(valueLabel, &style, LV_PART_MAIN);
lv_label_set_text(valueLabel, "");

chanLabel = lv_label_create(lvobj);
etx_font(chanLabel, FONT_XS_INDEX);
Expand Down
4 changes: 4 additions & 0 deletions radio/src/gui/colorlcd/widgets/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,28 @@ class ValueWidget : public Widget
labelShadow = lv_label_create(lvobj);
lv_obj_add_style(labelShadow, &labelStyle, LV_PART_MAIN);
lv_obj_set_style_text_color(labelShadow, lv_color_black(), LV_PART_MAIN);
lv_label_set_text(labelShadow, "");

label = lv_label_create(lvobj);
lv_obj_add_style(label, &labelStyle, LV_PART_MAIN);
etx_txt_color(label, COLOR_THEME_WARNING_INDEX, ETX_STATE_TIMER_ELAPSED);
etx_txt_color(label, COLOR_THEME_DISABLED_INDEX, ETX_STATE_TELEM_STALE);
lv_label_set_text(label, "");

valueShadow = lv_label_create(lvobj);
lv_obj_add_style(valueShadow, &valueStyle, LV_PART_MAIN);
lv_obj_set_style_text_color(valueShadow, lv_color_black(), LV_PART_MAIN);
etx_font(valueShadow, FONT_L_INDEX);
etx_font(valueShadow, FONT_XL_INDEX, ETX_STATE_LARGE_FONT);
lv_label_set_text(valueShadow, "");

value = lv_label_create(lvobj);
lv_obj_add_style(value, &valueStyle, LV_PART_MAIN);
etx_txt_color(value, COLOR_THEME_WARNING_INDEX, ETX_STATE_TIMER_ELAPSED);
etx_txt_color(value, COLOR_THEME_DISABLED_INDEX, ETX_STATE_TELEM_STALE);
etx_font(value, FONT_L_INDEX);
etx_font(value, FONT_XL_INDEX, ETX_STATE_LARGE_FONT);
lv_label_set_text(value, "");

update();
}
Expand Down

0 comments on commit 78a5908

Please sign in to comment.