mirror of https://github.com/meshcore-dev/MeshCore
38 changed files with 386 additions and 11079 deletions
@ -1,7 +0,0 @@ |
|||
SET(SOURCES ui_Screen1.c |
|||
ui.c |
|||
ui_comp_hook.c |
|||
ui_helpers.c |
|||
ui_events.cpp) |
|||
|
|||
add_library(ui ${SOURCES}) |
|||
@ -1,5 +0,0 @@ |
|||
ui_Screen1.c |
|||
ui.c |
|||
ui_comp_hook.c |
|||
ui_helpers.c |
|||
ui_events.cpp |
|||
@ -1,59 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#include "ui.h" |
|||
#include "ui_helpers.h" |
|||
|
|||
///////////////////// VARIABLES ////////////////////
|
|||
|
|||
|
|||
// SCREEN: ui_Screen1
|
|||
void ui_Screen1_screen_init(void); |
|||
lv_obj_t* ui_Screen1; |
|||
lv_obj_t* ui_TabView1; |
|||
lv_obj_t* ui_TabPageContacts; |
|||
lv_obj_t* ui_Contacts; |
|||
lv_obj_t* ui_ContactMessages; |
|||
lv_obj_t* ui_TabPageChannels; |
|||
lv_obj_t* ui_Channels; |
|||
lv_obj_t* ui_ChannelMessages; |
|||
void ui_event_AutoLight(lv_event_t * e); |
|||
lv_obj_t* ui_AutoLight; |
|||
lv_obj_t* ui____initial_actions0; |
|||
|
|||
lv_obj_t* ui_DimOverlay; |
|||
lv_obj_t* ui_TabPageHome; |
|||
lv_obj_t* ui_ValueDate; |
|||
lv_obj_t* ui_ValueTime; |
|||
lv_obj_t* ui_TabPageSettings; |
|||
lv_obj_t* ui_DayLight; |
|||
lv_obj_t* ui____initial_actions0; |
|||
lv_obj_t* ui_ChannelInput; |
|||
lv_obj_t* ui_SendBtn; |
|||
lv_obj_t* ui_Keyboard; |
|||
lv_obj_t* iu_SendLabel; |
|||
lv_obj_t* ui_ChannelDivider; |
|||
|
|||
|
|||
///////////////////// TEST LVGL SETTINGS ////////////////////
|
|||
#if LV_COLOR_DEPTH != 16 |
|||
#error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" |
|||
#endif |
|||
#if LV_COLOR_16_SWAP !=0 |
|||
#error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings" |
|||
#endif |
|||
|
|||
///////////////////// SCREENS ////////////////////
|
|||
|
|||
void ui_init(void) |
|||
{ |
|||
lv_disp_t * dispp = lv_disp_get_default(); |
|||
lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), |
|||
false, LV_FONT_DEFAULT); |
|||
lv_disp_set_theme(dispp, theme); |
|||
ui_Screen1_screen_init(); |
|||
ui____initial_actions0 = lv_obj_create(NULL); |
|||
lv_disp_load_scr(ui_Screen1); |
|||
} |
|||
@ -1,66 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#ifndef _SQUARELINE_PROJECT_UI_H |
|||
#define _SQUARELINE_PROJECT_UI_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#if defined __has_include |
|||
#if __has_include("lvgl.h") |
|||
#include "lvgl.h" |
|||
#elif __has_include("lvgl/lvgl.h") |
|||
#include "lvgl/lvgl.h" |
|||
#else |
|||
#include "lvgl.h" |
|||
#endif |
|||
#else |
|||
#include "lvgl.h" |
|||
#endif |
|||
|
|||
#include "ui_helpers.h" |
|||
#include "ui_events.h" |
|||
#include "../fonts/fonts.h" |
|||
|
|||
// SCREEN: ui_Screen1
|
|||
void ui_Screen1_screen_init(void); |
|||
void setNightMode(bool night); |
|||
extern lv_obj_t* ui_Screen1; |
|||
extern lv_obj_t* ui_TabView1; |
|||
extern lv_obj_t* ui_TabPageContacts; |
|||
extern lv_obj_t* ui_Contacts; |
|||
extern lv_obj_t* ui_ContactMessages; |
|||
extern lv_obj_t* ui_TabPageChannels; |
|||
extern lv_obj_t* ui_Channels; |
|||
extern lv_obj_t* ui_ChannelMessages; |
|||
extern lv_obj_t* ui_TabPageSettings; |
|||
void ui_event_AutoLight(lv_event_t * e); |
|||
extern lv_obj_t* ui_AutoLight; |
|||
extern lv_obj_t* ui____initial_actions0; |
|||
|
|||
extern lv_obj_t* ui_DimOverlay; |
|||
extern lv_obj_t* ui_TabPageHome; |
|||
extern lv_obj_t* ui_ValueDate; |
|||
extern lv_obj_t* ui_ValueTime; |
|||
extern lv_obj_t* ui_TabPageSettings; |
|||
extern lv_obj_t* ui_DayLight; |
|||
extern lv_obj_t* ui_ChannelMessages; |
|||
extern lv_obj_t* ui_ChannelInput; |
|||
extern lv_obj_t* ui_SendBtn; |
|||
extern lv_obj_t* ui_Keyboard; |
|||
extern lv_obj_t* iu_SendLabel; |
|||
extern lv_obj_t* ui_ChannelDivider; |
|||
|
|||
extern void onDayLightPressed(bool pressed); |
|||
|
|||
void ui_init(void); |
|||
|
|||
#ifdef __cplusplus |
|||
} /*extern "C"*/ |
|||
#endif |
|||
|
|||
#endif |
|||
@ -1,341 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#include "ui.h" |
|||
static int channelInputBaseY = 185; |
|||
static int channelInputBaseKeybOnY = 0; |
|||
|
|||
void onShowKeyboard() { |
|||
lv_obj_clear_flag(ui_Keyboard, LV_OBJ_FLAG_HIDDEN); |
|||
//lv_obj_set_style_bg_opa(ui_DimOverlay, 160, 0);
|
|||
lv_obj_add_flag(ui_DimOverlay, LV_OBJ_FLAG_CLICKABLE); |
|||
|
|||
lv_obj_set_y(ui_ChannelInput, channelInputBaseKeybOnY); |
|||
lv_obj_set_y(ui_SendBtn, channelInputBaseKeybOnY); |
|||
} |
|||
|
|||
void onHideKeyboard() { |
|||
lv_obj_add_flag(ui_Keyboard, LV_OBJ_FLAG_HIDDEN); |
|||
//lv_obj_set_style_bg_opa(ui_DimOverlay, 0, 0);
|
|||
lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_CLICKABLE); |
|||
|
|||
lv_obj_set_y(ui_ChannelInput, channelInputBaseY); |
|||
lv_obj_set_y(ui_SendBtn, channelInputBaseY); |
|||
} |
|||
|
|||
void onChannelInputFocus(lv_event_t* e) |
|||
{ |
|||
lv_obj_t* ta = lv_event_get_target(e); |
|||
if(!ui_Keyboard || !ta) return; |
|||
|
|||
lv_keyboard_set_textarea(ui_Keyboard, ta); |
|||
onShowKeyboard(); |
|||
} |
|||
|
|||
void onDimOverlayClick(lv_event_t* e) |
|||
{ |
|||
onHideKeyboard(); |
|||
} |
|||
|
|||
void onSendClick(lv_event_t* e) |
|||
{ |
|||
char fullMessage[260]; |
|||
onHideKeyboard(); |
|||
|
|||
const char* msg = lv_textarea_get_text(ui_ChannelInput); |
|||
if(msg == NULL || strlen(msg) == 0) return; |
|||
|
|||
lv_textarea_set_text(ui_ChannelInput, ""); |
|||
|
|||
sprintf(fullMessage, "public %s", msg); |
|||
//handleCommand(fullMessage);
|
|||
} |
|||
|
|||
void onKeyboardEvent(lv_event_t* e) |
|||
{ |
|||
lv_event_code_t code = lv_event_get_code(e); |
|||
|
|||
if(code == LV_EVENT_READY || code == LV_EVENT_CANCEL) |
|||
{ |
|||
lv_obj_add_flag(ui_Keyboard, LV_OBJ_FLAG_HIDDEN); |
|||
|
|||
// Restore UI
|
|||
lv_obj_set_y(ui_ChannelInput, channelInputBaseY); |
|||
lv_obj_set_y(ui_SendBtn, channelInputBaseY); |
|||
|
|||
lv_obj_set_style_bg_opa(ui_DimOverlay, 0, 0); |
|||
lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_CLICKABLE); |
|||
} |
|||
} |
|||
|
|||
static void scroll_begin_event(lv_event_t* e) |
|||
{ |
|||
/*Disable the scroll animations. Triggered when a tab button is clicked */ |
|||
if (lv_event_get_code(e) == LV_EVENT_SCROLL_BEGIN) { |
|||
lv_anim_t* a = (lv_anim_t*)lv_event_get_param(e); |
|||
if (a) a->time = 0; |
|||
|
|||
} |
|||
} |
|||
|
|||
void event_handler(lv_event_t * e) |
|||
{ |
|||
lv_event_code_t code = lv_event_get_code(e); |
|||
lv_obj_t * target = lv_event_get_target(e); |
|||
|
|||
if(code == LV_EVENT_VALUE_CHANGED) { |
|||
if (target == ui_DayLight) { |
|||
onDayLightPressed(lv_obj_get_state(target) & LV_STATE_CHECKED); |
|||
} |
|||
} |
|||
} |
|||
|
|||
void ui_Screen1_screen_init(void) |
|||
{ |
|||
ui_Screen1 = lv_obj_create(NULL); |
|||
lv_obj_clear_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
|||
lv_obj_set_style_bg_color(ui_Screen1, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_bg_opa(ui_Screen1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
ui_TabView1 = lv_tabview_create(ui_Screen1, LV_DIR_TOP, 50); |
|||
|
|||
lv_obj_add_event_cb(lv_tabview_get_content(ui_TabView1), scroll_begin_event,LV_EVENT_SCROLL_BEGIN, NULL); |
|||
lv_obj_clear_flag(lv_tabview_get_content(ui_TabView1), LV_OBJ_FLAG_SCROLLABLE); |
|||
|
|||
lv_obj_set_width(ui_TabView1, 800); |
|||
lv_obj_set_height(ui_TabView1, 480); |
|||
lv_obj_set_align(ui_TabView1, LV_ALIGN_CENTER); |
|||
lv_obj_clear_flag(ui_TabView1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
|||
lv_obj_set_style_bg_color(ui_TabView1, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_bg_opa(ui_TabView1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
lv_obj_set_style_bg_color(lv_tabview_get_tab_btns(ui_TabView1), lv_color_hex(0x424242), |
|||
LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_bg_opa(lv_tabview_get_tab_btns(ui_TabView1), 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
lv_obj_set_style_text_color(lv_tabview_get_tab_btns(ui_TabView1), lv_color_hex(0xFFFFFF), |
|||
LV_PART_ITEMS | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_opa(lv_tabview_get_tab_btns(ui_TabView1), 255, LV_PART_ITEMS | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_font(lv_tabview_get_tab_btns(ui_TabView1), &lv_font_arial_18, |
|||
LV_PART_ITEMS | LV_STATE_DEFAULT); |
|||
|
|||
#if defined(LANG_EN) |
|||
ui_TabPageHome = lv_tabview_add_tab(ui_TabView1, "Home"); |
|||
#elif defined(LANG_GR) |
|||
ui_TabPageHome = lv_tabview_add_tab(ui_TabView1, "Αρχική"); |
|||
#endif |
|||
|
|||
ui_ValueDate = lv_label_create(ui_TabPageHome); |
|||
lv_obj_set_width(ui_ValueDate, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_height(ui_ValueDate, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_x(ui_ValueDate, 0); |
|||
lv_obj_set_y(ui_ValueDate, -165); |
|||
lv_obj_set_align(ui_ValueDate, LV_ALIGN_CENTER); |
|||
lv_label_set_text(ui_ValueDate, "--- --/--/----"); |
|||
lv_obj_set_style_text_color(ui_ValueDate, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_opa(ui_ValueDate, 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_font(ui_ValueDate, &lv_font_arial_40, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
ui_ValueTime = lv_label_create(ui_TabPageHome); |
|||
lv_obj_set_width(ui_ValueTime, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_height(ui_ValueTime, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_x(ui_ValueTime, 0); |
|||
lv_obj_set_y(ui_ValueTime, -100); |
|||
lv_obj_set_align(ui_ValueTime, LV_ALIGN_CENTER); |
|||
lv_label_set_text(ui_ValueTime, "--:--"); |
|||
lv_obj_set_style_text_color(ui_ValueTime, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_opa(ui_ValueTime, 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_font(ui_ValueTime, &lv_font_arial_48, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
#if defined(LANG_EN) |
|||
ui_TabPageContacts = lv_tabview_add_tab(ui_TabView1, "Contacts"); |
|||
#elif defined(LANG_GR) |
|||
ui_TabPageContacts = lv_tabview_add_tab(ui_TabView1, "Επαφές"); |
|||
#endif |
|||
// Prevent scrolling
|
|||
lv_obj_set_scrollbar_mode(ui_TabPageContacts, LV_SCROLLBAR_MODE_OFF); |
|||
lv_obj_clear_flag(ui_TabPageContacts, LV_OBJ_FLAG_SCROLLABLE); |
|||
|
|||
ui_Contacts = lv_list_create(ui_TabPageContacts); |
|||
//lv_list_set_options(ui_Contacts, "Contact", LV_list_MODE_NORMAL);
|
|||
lv_obj_set_width(ui_Contacts, 250); |
|||
lv_obj_set_height(ui_Contacts, 400); |
|||
lv_obj_set_x(ui_Contacts, -274); |
|||
lv_obj_set_y(ui_Contacts, 0); |
|||
lv_obj_set_align(ui_Contacts, LV_ALIGN_CENTER); |
|||
lv_obj_set_style_bg_opa(ui_Contacts, LV_OPA_TRANSP, 0); |
|||
lv_obj_set_style_border_width(ui_Contacts, 0, 0); |
|||
lv_obj_set_style_outline_width(ui_Contacts, 0, 0); |
|||
lv_obj_set_style_shadow_width(ui_Contacts, 0, 0); |
|||
//lv_obj_set_scrollbar_mode(ui_Contacts, LV_SCROLLBAR_MODE_OFF);
|
|||
lv_obj_set_style_bg_opa(ui_Contacts, LV_OPA_TRANSP, LV_PART_ITEMS); |
|||
lv_obj_set_style_border_width(ui_Contacts, 0, LV_PART_ITEMS); |
|||
|
|||
ui_ContactMessages = lv_list_create(ui_TabPageContacts); |
|||
//lv_list_set_options(ui_ContactMessages, "Contact", LV_list_MODE_NORMAL);
|
|||
lv_obj_set_width(ui_ContactMessages, 500); |
|||
lv_obj_set_height(ui_ContactMessages, 400); |
|||
lv_obj_set_x(ui_ContactMessages, 124); |
|||
lv_obj_set_y(ui_ContactMessages, 0); |
|||
lv_obj_set_align(ui_ContactMessages, LV_ALIGN_CENTER); |
|||
lv_obj_set_style_bg_color(ui_ContactMessages, lv_color_hex(0), 0); |
|||
lv_obj_set_style_bg_opa(ui_ContactMessages, LV_OPA_TRANSP, 0); |
|||
lv_obj_set_style_border_width(ui_ContactMessages, 0, 0); |
|||
lv_obj_set_style_outline_width(ui_ContactMessages, 0, 0); |
|||
lv_obj_set_style_shadow_width(ui_ContactMessages, 0, 0); |
|||
//lv_obj_set_scrollbar_mode(ui_ContactMessages, LV_SCROLLBAR_MODE_OFF);
|
|||
lv_obj_set_style_bg_opa(ui_ContactMessages, LV_OPA_TRANSP, LV_PART_ITEMS); |
|||
lv_obj_set_style_border_width(ui_ContactMessages, 0, LV_PART_ITEMS); |
|||
|
|||
lv_obj_t *divider = lv_obj_create(ui_TabPageContacts); |
|||
lv_obj_set_size(divider, 2, 400); |
|||
lv_obj_set_pos(divider, 222, 0); // align between lists
|
|||
lv_obj_set_style_bg_color(divider, lv_color_hex(0x444444), 0); |
|||
lv_obj_set_style_border_width(divider, 0, 0); |
|||
lv_obj_set_style_radius(divider, 0, 0); |
|||
|
|||
#if defined(LANG_EN) |
|||
ui_TabPageChannels = lv_tabview_add_tab(ui_TabView1, "Channels"); |
|||
#elif defined(LANG_GR) |
|||
ui_TabPageChannels = lv_tabview_add_tab(ui_TabView1, "Κανάλια"); |
|||
#endif |
|||
lv_obj_set_scrollbar_mode(ui_TabPageChannels, LV_SCROLLBAR_MODE_OFF); |
|||
lv_obj_clear_flag(ui_TabPageChannels, LV_OBJ_FLAG_SCROLLABLE); |
|||
lv_obj_set_style_bg_color(ui_TabPageChannels, lv_color_hex(0x000000), 0); |
|||
|
|||
ui_Channels = lv_dropdown_create(ui_TabPageChannels); |
|||
lv_dropdown_set_options(ui_Channels, "Public"); |
|||
lv_obj_set_width(ui_Channels, 291); |
|||
lv_obj_set_height(ui_Channels, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_x(ui_Channels, -243); |
|||
lv_obj_set_y(ui_Channels, -182); |
|||
lv_obj_set_align(ui_Channels, LV_ALIGN_CENTER); |
|||
lv_obj_add_flag(ui_Channels, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
|||
|
|||
ui_ChannelMessages = lv_list_create(ui_TabPageChannels); |
|||
//lv_list_set_options(ui_ChannelMessages, "Contact", LV_list_MODE_NORMAL);
|
|||
lv_obj_set_width(ui_ChannelMessages, 780); |
|||
lv_obj_set_height(ui_ChannelMessages, 260); |
|||
lv_obj_set_x(ui_ChannelMessages, 0); |
|||
lv_obj_set_y(ui_ChannelMessages, -40); |
|||
lv_obj_set_align(ui_ChannelMessages, LV_ALIGN_CENTER); |
|||
lv_obj_set_style_bg_color(ui_ChannelMessages, lv_color_hex(0), 0); |
|||
lv_obj_set_style_bg_opa(ui_ChannelMessages, LV_OPA_TRANSP, 0); |
|||
lv_obj_set_style_border_width(ui_ChannelMessages, 0, 0); |
|||
lv_obj_set_style_outline_width(ui_ChannelMessages, 0, 0); |
|||
lv_obj_set_style_shadow_width(ui_ChannelMessages, 0, 0); |
|||
//lv_obj_set_scrollbar_mode(ui_ChannelMessages, LV_SCROLLBAR_MODE_OFF);
|
|||
lv_obj_set_style_bg_opa(ui_ChannelMessages, LV_OPA_TRANSP, LV_PART_ITEMS); |
|||
lv_obj_set_style_border_width(ui_ChannelMessages, 0, LV_PART_ITEMS); |
|||
|
|||
ui_ChannelDivider = lv_obj_create(ui_TabPageChannels); |
|||
lv_obj_set_size(ui_ChannelDivider, 780, 1); |
|||
lv_obj_set_pos(ui_ChannelDivider, 0, 150); |
|||
lv_obj_set_align(ui_ChannelDivider, LV_ALIGN_CENTER); |
|||
lv_obj_set_style_bg_color(ui_ChannelDivider, lv_color_hex(0x444444), 0); |
|||
lv_obj_set_style_border_width(ui_ChannelDivider, 0, 0); |
|||
|
|||
#if defined(LANG_EN) |
|||
ui_TabPageSettings = lv_tabview_add_tab(ui_TabView1, "Settings"); |
|||
#elif defined(LANG_GR) |
|||
ui_TabPageSettings = lv_tabview_add_tab(ui_TabView1, "Ρυθμίσεις"); |
|||
#endif |
|||
|
|||
ui_DayLight = lv_checkbox_create(ui_TabPageSettings); |
|||
#if defined(LANG_EN) |
|||
lv_checkbox_set_text(ui_DayLight, "Day light (summer time)"); |
|||
#elif defined(LANG_GR) |
|||
lv_checkbox_set_text(ui_DayLight, "Θερινή ώρα"); |
|||
#endif |
|||
lv_obj_set_style_text_font(ui_DayLight, &lv_font_arial_20, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_width(ui_DayLight, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_height(ui_DayLight, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_x(ui_DayLight, -257); |
|||
lv_obj_set_y(ui_DayLight, -168); |
|||
lv_obj_set_align(ui_DayLight, LV_ALIGN_CENTER); |
|||
lv_obj_add_flag(ui_DayLight, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
|||
lv_obj_set_style_text_color(ui_DayLight, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_opa(ui_DayLight, 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
lv_obj_add_event_cb(ui_DayLight, event_handler, LV_EVENT_ALL, NULL); |
|||
lv_obj_add_state(ui_DayLight, LV_STATE_DEFAULT); |
|||
|
|||
ui_DimOverlay = lv_obj_create(ui_Screen1); |
|||
lv_obj_remove_style_all(ui_DimOverlay); // no border/padding
|
|||
lv_obj_set_size(ui_DimOverlay, LV_PCT(100), LV_PCT(100)); |
|||
lv_obj_set_align(ui_DimOverlay, LV_ALIGN_CENTER); |
|||
lv_obj_add_event_cb(ui_DimOverlay, onDimOverlayClick, LV_EVENT_CLICKED, NULL); |
|||
|
|||
// black semi transparent background
|
|||
lv_obj_set_style_bg_color(ui_DimOverlay, lv_color_hex(0x000000), 0); |
|||
lv_obj_set_style_bg_opa(ui_DimOverlay, 0, 0); // initially "off"
|
|||
|
|||
//Edit text
|
|||
ui_ChannelInput = lv_textarea_create(ui_TabPageChannels); |
|||
lv_obj_set_size(ui_ChannelInput, 670, 40); |
|||
lv_obj_set_pos(ui_ChannelInput, -50, channelInputBaseY); |
|||
lv_obj_set_align(ui_ChannelInput, LV_ALIGN_CENTER); |
|||
lv_obj_add_flag(ui_ChannelInput, LV_OBJ_FLAG_CLICKABLE); |
|||
lv_obj_add_flag(ui_ChannelInput, LV_OBJ_FLAG_SCROLL_ON_FOCUS); |
|||
|
|||
#if defined(LANG_EN) |
|||
lv_textarea_set_placeholder_text(ui_ChannelInput, "Write message..."); |
|||
#elif defined(LANG_GR) |
|||
lv_textarea_set_placeholder_text(ui_ChannelInput, "Γράψε μήνυμα..."); |
|||
#endif |
|||
lv_textarea_set_one_line(ui_ChannelInput, true); |
|||
lv_obj_set_style_text_font(ui_ChannelInput, &lv_font_arial_20, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
lv_obj_set_style_bg_color(ui_ChannelInput, lv_color_hex(0x111111), 0); |
|||
lv_obj_set_style_text_color(ui_ChannelInput, lv_color_white(), 0); |
|||
lv_obj_set_style_border_color(ui_ChannelInput, lv_color_hex(0x444444), 0); |
|||
lv_obj_set_style_border_width(ui_ChannelInput, 1, 0); |
|||
lv_obj_set_style_radius(ui_ChannelInput, 6, 0); |
|||
lv_obj_add_event_cb(ui_ChannelInput, onChannelInputFocus, LV_EVENT_CLICKED, NULL); |
|||
|
|||
// Send button
|
|||
ui_SendBtn = lv_btn_create(ui_TabPageChannels); |
|||
lv_obj_set_size(ui_SendBtn, 90, 42); |
|||
lv_obj_set_pos(ui_SendBtn, 350, channelInputBaseY); |
|||
lv_obj_set_align(ui_SendBtn, LV_ALIGN_CENTER); |
|||
lv_obj_set_style_text_font(ui_SendBtn, &lv_font_arial_20, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_bg_color(ui_SendBtn, lv_color_hex(0x3A7AFE), 0); |
|||
lv_obj_add_event_cb(ui_SendBtn, onSendClick, LV_EVENT_CLICKED, NULL); |
|||
|
|||
iu_SendLabel = lv_label_create(ui_SendBtn); |
|||
#if defined(LANG_EN) |
|||
lv_label_set_text(sendLabel, "Send"); |
|||
#elif defined(LANG_GR) |
|||
lv_label_set_text(iu_SendLabel, "Αποστολή"); |
|||
#endif |
|||
lv_obj_center(iu_SendLabel); |
|||
|
|||
// Keyboard
|
|||
ui_Keyboard = lv_keyboard_create(lv_layer_top()); |
|||
lv_obj_set_size(ui_Keyboard, 800, 200); |
|||
lv_obj_set_align(ui_Keyboard, LV_ALIGN_BOTTOM_MID); |
|||
lv_obj_add_flag(ui_Keyboard, LV_OBJ_FLAG_HIDDEN); |
|||
lv_obj_add_event_cb(ui_Keyboard, onKeyboardEvent, LV_EVENT_ALL, NULL); |
|||
|
|||
// Do not block touch/scroll
|
|||
lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_CLICKABLE); |
|||
lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_SCROLLABLE); |
|||
lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_SCROLL_CHAIN_HOR); |
|||
lv_obj_clear_flag(ui_DimOverlay, LV_OBJ_FLAG_SCROLL_CHAIN_VER); |
|||
|
|||
// always in front
|
|||
lv_obj_move_foreground(ui_DimOverlay); |
|||
|
|||
} |
|||
|
|||
void setNightMode(bool night) { |
|||
|
|||
if (!ui_DimOverlay) return; |
|||
if (night) { |
|||
lv_obj_set_style_bg_opa(ui_DimOverlay, 192, 0); // 75% dark
|
|||
} else { |
|||
lv_obj_set_style_bg_opa(ui_DimOverlay, 0, 0); // none
|
|||
} |
|||
} |
|||
@ -1,5 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
@ -1,7 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#include "ui.h" |
|||
|
|||
@ -1,17 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#ifndef _UI_EVENTS_H |
|||
#define _UI_EVENTS_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#ifdef __cplusplus |
|||
} /*extern "C"*/ |
|||
#endif |
|||
|
|||
#endif |
|||
@ -1,347 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#include "ui_helpers.h" |
|||
|
|||
void _ui_bar_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); |
|||
if(id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); |
|||
} |
|||
|
|||
void _ui_basic_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); |
|||
if(id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); |
|||
if(id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); |
|||
if(id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); |
|||
} |
|||
|
|||
|
|||
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); |
|||
} |
|||
|
|||
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val) |
|||
{ |
|||
if(id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); |
|||
} |
|||
|
|||
void _ui_label_set_property(lv_obj_t * target, int id, const char * val) |
|||
{ |
|||
if(id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); |
|||
} |
|||
|
|||
|
|||
void _ui_roller_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); |
|||
if(id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); |
|||
} |
|||
|
|||
void _ui_slider_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); |
|||
if(id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); |
|||
} |
|||
|
|||
|
|||
void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void)) |
|||
{ |
|||
if(*target == NULL) |
|||
target_init(); |
|||
lv_scr_load_anim(*target, fademode, spd, delay, false); |
|||
} |
|||
|
|||
void _ui_screen_delete(lv_obj_t ** target) |
|||
{ |
|||
if(*target == NULL) { |
|||
lv_obj_del(*target); |
|||
target = NULL; |
|||
} |
|||
} |
|||
|
|||
void _ui_arc_increment(lv_obj_t * target, int val) |
|||
{ |
|||
int old = lv_arc_get_value(target); |
|||
lv_arc_set_value(target, old + val); |
|||
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); |
|||
} |
|||
|
|||
void _ui_bar_increment(lv_obj_t * target, int val, int anm) |
|||
{ |
|||
int old = lv_bar_get_value(target); |
|||
lv_bar_set_value(target, old + val, anm); |
|||
} |
|||
|
|||
void _ui_slider_increment(lv_obj_t * target, int val, int anm) |
|||
{ |
|||
int old = lv_slider_get_value(target); |
|||
lv_slider_set_value(target, old + val, anm); |
|||
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); |
|||
} |
|||
|
|||
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea) |
|||
{ |
|||
lv_keyboard_set_textarea(keyboard, textarea); |
|||
} |
|||
|
|||
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value) |
|||
{ |
|||
if(value == _UI_MODIFY_FLAG_TOGGLE) { |
|||
if(lv_obj_has_flag(target, flag)) lv_obj_clear_flag(target, flag); |
|||
else lv_obj_add_flag(target, flag); |
|||
} |
|||
else if(value == _UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target, flag); |
|||
else lv_obj_clear_flag(target, flag); |
|||
} |
|||
void _ui_state_modify(lv_obj_t * target, int32_t state, int value) |
|||
{ |
|||
if(value == _UI_MODIFY_STATE_TOGGLE) { |
|||
if(lv_obj_has_state(target, state)) lv_obj_clear_state(target, state); |
|||
else lv_obj_add_state(target, state); |
|||
} |
|||
else if(value == _UI_MODIFY_STATE_ADD) lv_obj_add_state(target, state); |
|||
else lv_obj_clear_state(target, state); |
|||
} |
|||
|
|||
|
|||
void _ui_textarea_move_cursor(lv_obj_t * target, int val) |
|||
|
|||
{ |
|||
|
|||
if(val == UI_MOVE_CURSOR_UP) lv_textarea_cursor_up(target); |
|||
if(val == UI_MOVE_CURSOR_RIGHT) lv_textarea_cursor_right(target); |
|||
if(val == UI_MOVE_CURSOR_DOWN) lv_textarea_cursor_down(target); |
|||
if(val == UI_MOVE_CURSOR_LEFT) lv_textarea_cursor_left(target); |
|||
lv_obj_add_state(target, LV_STATE_FOCUSED); |
|||
} |
|||
|
|||
void scr_unloaded_delete_cb(lv_event_t * e) |
|||
|
|||
{ |
|||
|
|||
lv_obj_t ** var = lv_event_get_user_data(e); |
|||
lv_obj_del(*var); |
|||
(*var) = NULL; |
|||
|
|||
} |
|||
|
|||
void _ui_opacity_set(lv_obj_t * target, int val) |
|||
{ |
|||
lv_obj_set_style_opa(target, val, 0); |
|||
} |
|||
|
|||
void _ui_anim_callback_free_user_data(lv_anim_t * a) |
|||
{ |
|||
lv_mem_free(a->user_data); |
|||
a->user_data = NULL; |
|||
} |
|||
|
|||
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_x(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_y(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_width(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_height(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_style_opa(usr->target, v, 0); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_img_set_zoom(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_img_set_angle(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
usr->val = v; |
|||
|
|||
if(v < 0) v = 0; |
|||
if(v >= usr->imgset_size) v = usr->imgset_size - 1; |
|||
lv_img_set_src(usr->target, usr->imgset[v]); |
|||
} |
|||
|
|||
int32_t _ui_anim_callback_get_x(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_x_aligned(usr->target); |
|||
|
|||
} |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_y(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_y_aligned(usr->target); |
|||
|
|||
} |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_width(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_width(usr->target); |
|||
|
|||
} |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_height(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_height(usr->target); |
|||
|
|||
} |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_style_opa(usr->target, 0); |
|||
|
|||
} |
|||
|
|||
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_img_get_zoom(usr->target); |
|||
|
|||
} |
|||
|
|||
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_img_get_angle(usr->target); |
|||
|
|||
} |
|||
|
|||
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return usr->val; |
|||
|
|||
} |
|||
|
|||
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) |
|||
{ |
|||
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; |
|||
|
|||
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); |
|||
|
|||
lv_label_set_text(trg, buf); |
|||
} |
|||
|
|||
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) |
|||
{ |
|||
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; |
|||
|
|||
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); |
|||
|
|||
lv_label_set_text(trg, buf); |
|||
} |
|||
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off) |
|||
{ |
|||
if(lv_obj_has_state(src, LV_STATE_CHECKED)) lv_label_set_text(trg, txt_on); |
|||
else lv_label_set_text(trg, txt_off); |
|||
} |
|||
|
|||
|
|||
void _ui_spinbox_step(lv_obj_t * target, int val) |
|||
|
|||
{ |
|||
|
|||
if(val > 0) lv_spinbox_increment(target); |
|||
|
|||
else lv_spinbox_decrement(target); |
|||
|
|||
|
|||
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); |
|||
} |
|||
|
|||
void _ui_switch_theme(int val) |
|||
|
|||
{ |
|||
|
|||
#ifdef UI_THEME_ACTIVE |
|||
ui_theme_set(val); |
|||
#endif |
|||
} |
|||
|
|||
|
|||
@ -1,148 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#ifndef _SQUARELINE_PROJECT_UI_HELPERS_H |
|||
#define _SQUARELINE_PROJECT_UI_HELPERS_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#include "ui.h" |
|||
|
|||
#define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 |
|||
#define _UI_BAR_PROPERTY_VALUE 0 |
|||
#define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 |
|||
void _ui_bar_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
#define _UI_BASIC_PROPERTY_POSITION_X 0 |
|||
#define _UI_BASIC_PROPERTY_POSITION_Y 1 |
|||
#define _UI_BASIC_PROPERTY_WIDTH 2 |
|||
#define _UI_BASIC_PROPERTY_HEIGHT 3 |
|||
void _ui_basic_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
#define _UI_DROPDOWN_PROPERTY_SELECTED 0 |
|||
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
#define _UI_IMAGE_PROPERTY_IMAGE 0 |
|||
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val); |
|||
|
|||
#define _UI_LABEL_PROPERTY_TEXT 0 |
|||
void _ui_label_set_property(lv_obj_t * target, int id, const char * val); |
|||
|
|||
#define _UI_ROLLER_PROPERTY_SELECTED 0 |
|||
#define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 |
|||
void _ui_roller_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
#define _UI_SLIDER_PROPERTY_VALUE 0 |
|||
#define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 |
|||
void _ui_slider_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void)); |
|||
|
|||
void _ui_screen_delete(lv_obj_t ** target); |
|||
|
|||
void _ui_arc_increment(lv_obj_t * target, int val); |
|||
|
|||
void _ui_bar_increment(lv_obj_t * target, int val, int anm); |
|||
|
|||
void _ui_slider_increment(lv_obj_t * target, int val, int anm); |
|||
|
|||
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea); |
|||
|
|||
#define _UI_MODIFY_FLAG_ADD 0 |
|||
#define _UI_MODIFY_FLAG_REMOVE 1 |
|||
#define _UI_MODIFY_FLAG_TOGGLE 2 |
|||
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value); |
|||
|
|||
#define _UI_MODIFY_STATE_ADD 0 |
|||
#define _UI_MODIFY_STATE_REMOVE 1 |
|||
#define _UI_MODIFY_STATE_TOGGLE 2 |
|||
void _ui_state_modify(lv_obj_t * target, int32_t state, int value); |
|||
|
|||
#define UI_MOVE_CURSOR_UP 0 |
|||
#define UI_MOVE_CURSOR_RIGHT 1 |
|||
#define UI_MOVE_CURSOR_DOWN 2 |
|||
#define UI_MOVE_CURSOR_LEFT 3 |
|||
void _ui_textarea_move_cursor(lv_obj_t * target, int val) |
|||
; |
|||
|
|||
|
|||
void scr_unloaded_delete_cb(lv_event_t * e); |
|||
|
|||
void _ui_opacity_set(lv_obj_t * target, int val); |
|||
|
|||
/** Describes an animation*/ |
|||
typedef struct _ui_anim_user_data_t { |
|||
lv_obj_t * target; |
|||
lv_img_dsc_t ** imgset; |
|||
int32_t imgset_size; |
|||
int32_t val; |
|||
} ui_anim_user_data_t; |
|||
void _ui_anim_callback_free_user_data(lv_anim_t * a); |
|||
|
|||
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v); |
|||
|
|||
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v); |
|||
|
|||
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v); |
|||
|
|||
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_x(lv_anim_t * a); |
|||
|
|||
int32_t _ui_anim_callback_get_y(lv_anim_t * a); |
|||
|
|||
int32_t _ui_anim_callback_get_width(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_height(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a); |
|||
|
|||
|
|||
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix); |
|||
|
|||
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix); |
|||
|
|||
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off); |
|||
|
|||
void _ui_spinbox_step(lv_obj_t * target, int val) |
|||
; |
|||
|
|||
|
|||
void _ui_switch_theme(int val) |
|||
; |
|||
|
|||
|
|||
|
|||
#ifdef __cplusplus |
|||
} /*extern "C"*/ |
|||
#endif |
|||
|
|||
#endif |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
@ -1,4 +0,0 @@ |
|||
|
|||
def onDayLightPressed(event_struct): |
|||
return |
|||
|
|||
@ -1,8 +0,0 @@ |
|||
{ |
|||
"deftheme": { |
|||
"name": "Default", |
|||
"properties": [] |
|||
}, |
|||
"themes": [], |
|||
"selected_theme": "Default" |
|||
} |
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,7 +0,0 @@ |
|||
SET(SOURCES ui_Screen1.c |
|||
ui.c |
|||
ui_comp_hook.c |
|||
ui_helpers.c |
|||
ui_events.cpp) |
|||
|
|||
add_library(ui ${SOURCES}) |
|||
@ -1,5 +0,0 @@ |
|||
ui_Screen1.c |
|||
ui.c |
|||
ui_comp_hook.c |
|||
ui_helpers.c |
|||
ui_events.cpp |
|||
@ -1,58 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#include "ui.h" |
|||
#include "ui_helpers.h" |
|||
|
|||
///////////////////// VARIABLES ////////////////////
|
|||
|
|||
|
|||
// SCREEN: ui_Screen1
|
|||
void ui_Screen1_screen_init(void); |
|||
lv_obj_t * ui_Screen1; |
|||
lv_obj_t * ui_TabView1; |
|||
lv_obj_t * ui_TabPageContacts; |
|||
lv_obj_t * ui_Contacts; |
|||
lv_obj_t * ui_ContactMessages; |
|||
lv_obj_t * ui_TabPageChannels; |
|||
lv_obj_t * ui_Channels; |
|||
lv_obj_t * ui_ChannelMessages; |
|||
lv_obj_t * ui_TabPageSettings; |
|||
void ui_event_AutoLight(lv_event_t * e); |
|||
lv_obj_t * ui_AutoLight; |
|||
lv_obj_t * ui____initial_actions0; |
|||
|
|||
///////////////////// TEST LVGL SETTINGS ////////////////////
|
|||
#if LV_COLOR_DEPTH != 16 |
|||
#error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" |
|||
#endif |
|||
#if LV_COLOR_16_SWAP !=0 |
|||
#error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings" |
|||
#endif |
|||
|
|||
///////////////////// ANIMATIONS ////////////////////
|
|||
|
|||
///////////////////// FUNCTIONS ////////////////////
|
|||
void ui_event_AutoLight(lv_event_t * e) |
|||
{ |
|||
lv_event_code_t event_code = lv_event_get_code(e); |
|||
lv_obj_t * target = lv_event_get_target(e); |
|||
if(event_code == LV_EVENT_CLICKED) { |
|||
onDayLightPressed(e); |
|||
} |
|||
} |
|||
|
|||
///////////////////// SCREENS ////////////////////
|
|||
|
|||
void ui_init(void) |
|||
{ |
|||
lv_disp_t * dispp = lv_disp_get_default(); |
|||
lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), |
|||
false, LV_FONT_DEFAULT); |
|||
lv_disp_set_theme(dispp, theme); |
|||
ui_Screen1_screen_init(); |
|||
ui____initial_actions0 = lv_obj_create(NULL); |
|||
lv_disp_load_scr(ui_Screen1); |
|||
} |
|||
@ -1,56 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#ifndef _SQUARELINE_PROJECT_UI_H |
|||
#define _SQUARELINE_PROJECT_UI_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#if defined __has_include |
|||
#if __has_include("lvgl.h") |
|||
#include "lvgl.h" |
|||
#elif __has_include("lvgl/lvgl.h") |
|||
#include "lvgl/lvgl.h" |
|||
#else |
|||
#include "lvgl.h" |
|||
#endif |
|||
#else |
|||
#include "lvgl.h" |
|||
#endif |
|||
|
|||
#include "ui_helpers.h" |
|||
#include "ui_events.h" |
|||
|
|||
// SCREEN: ui_Screen1
|
|||
void ui_Screen1_screen_init(void); |
|||
extern lv_obj_t * ui_Screen1; |
|||
extern lv_obj_t * ui_TabView1; |
|||
extern lv_obj_t * ui_TabPageContacts; |
|||
extern lv_obj_t * ui_Contacts; |
|||
extern lv_obj_t * ui_ContactMessages; |
|||
extern lv_obj_t * ui_TabPageChannels; |
|||
extern lv_obj_t * ui_Channels; |
|||
extern lv_obj_t * ui_ChannelMessages; |
|||
extern lv_obj_t * ui_TabPageSettings; |
|||
void ui_event_AutoLight(lv_event_t * e); |
|||
extern lv_obj_t * ui_AutoLight; |
|||
extern lv_obj_t * ui____initial_actions0; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
void ui_init(void); |
|||
|
|||
#ifdef __cplusplus |
|||
} /*extern "C"*/ |
|||
#endif |
|||
|
|||
#endif |
|||
@ -1,87 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#include "ui.h" |
|||
|
|||
void ui_Screen1_screen_init(void) |
|||
{ |
|||
ui_Screen1 = lv_obj_create(NULL); |
|||
lv_obj_clear_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
|||
lv_obj_set_style_bg_color(ui_Screen1, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_bg_opa(ui_Screen1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
ui_TabView1 = lv_tabview_create(ui_Screen1, LV_DIR_TOP, 50); |
|||
lv_obj_set_width(ui_TabView1, 800); |
|||
lv_obj_set_height(ui_TabView1, 480); |
|||
lv_obj_set_align(ui_TabView1, LV_ALIGN_CENTER); |
|||
lv_obj_clear_flag(ui_TabView1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
|||
lv_obj_set_style_bg_color(ui_TabView1, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_bg_opa(ui_TabView1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
lv_obj_set_style_bg_color(lv_tabview_get_tab_btns(ui_TabView1), lv_color_hex(0x424242), |
|||
LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_bg_opa(lv_tabview_get_tab_btns(ui_TabView1), 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
lv_obj_set_style_text_color(lv_tabview_get_tab_btns(ui_TabView1), lv_color_hex(0xFFFFFF), |
|||
LV_PART_ITEMS | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_opa(lv_tabview_get_tab_btns(ui_TabView1), 255, LV_PART_ITEMS | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_font(lv_tabview_get_tab_btns(ui_TabView1), &lv_font_montserrat_18, |
|||
LV_PART_ITEMS | LV_STATE_DEFAULT); |
|||
|
|||
ui_TabPageContacts = lv_tabview_add_tab(ui_TabView1, "Contacts"); |
|||
|
|||
ui_Contacts = lv_roller_create(ui_TabPageContacts); |
|||
lv_roller_set_options(ui_Contacts, "Contact", LV_ROLLER_MODE_NORMAL); |
|||
lv_obj_set_width(ui_Contacts, 246); |
|||
lv_obj_set_height(ui_Contacts, 400); |
|||
lv_obj_set_x(ui_Contacts, -262); |
|||
lv_obj_set_y(ui_Contacts, 0); |
|||
lv_obj_set_align(ui_Contacts, LV_ALIGN_CENTER); |
|||
|
|||
ui_ContactMessages = lv_roller_create(ui_TabPageContacts); |
|||
lv_roller_set_options(ui_ContactMessages, "Contact", LV_ROLLER_MODE_NORMAL); |
|||
lv_obj_set_width(ui_ContactMessages, 500); |
|||
lv_obj_set_height(ui_ContactMessages, 400); |
|||
lv_obj_set_x(ui_ContactMessages, 124); |
|||
lv_obj_set_y(ui_ContactMessages, 0); |
|||
lv_obj_set_align(ui_ContactMessages, LV_ALIGN_CENTER); |
|||
|
|||
ui_TabPageChannels = lv_tabview_add_tab(ui_TabView1, "Channels"); |
|||
|
|||
ui_Channels = lv_dropdown_create(ui_TabPageChannels); |
|||
lv_dropdown_set_options(ui_Channels, "Public"); |
|||
lv_obj_set_width(ui_Channels, 291); |
|||
lv_obj_set_height(ui_Channels, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_x(ui_Channels, -243); |
|||
lv_obj_set_y(ui_Channels, -182); |
|||
lv_obj_set_align(ui_Channels, LV_ALIGN_CENTER); |
|||
lv_obj_add_flag(ui_Channels, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
|||
|
|||
|
|||
|
|||
ui_ChannelMessages = lv_roller_create(ui_TabPageChannels); |
|||
lv_roller_set_options(ui_ChannelMessages, "Contact", LV_ROLLER_MODE_NORMAL); |
|||
lv_obj_set_width(ui_ChannelMessages, 780); |
|||
lv_obj_set_height(ui_ChannelMessages, 342); |
|||
lv_obj_set_x(ui_ChannelMessages, 0); |
|||
lv_obj_set_y(ui_ChannelMessages, 30); |
|||
lv_obj_set_align(ui_ChannelMessages, LV_ALIGN_CENTER); |
|||
|
|||
ui_TabPageSettings = lv_tabview_add_tab(ui_TabView1, "Settings"); |
|||
|
|||
ui_AutoLight = lv_checkbox_create(ui_TabPageSettings); |
|||
lv_checkbox_set_text(ui_AutoLight, "Auto dim brightness"); |
|||
lv_obj_set_width(ui_AutoLight, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_height(ui_AutoLight, LV_SIZE_CONTENT); /// 1
|
|||
lv_obj_set_x(ui_AutoLight, -257); |
|||
lv_obj_set_y(ui_AutoLight, -168); |
|||
lv_obj_set_align(ui_AutoLight, LV_ALIGN_CENTER); |
|||
lv_obj_add_flag(ui_AutoLight, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
|||
lv_obj_set_style_text_color(ui_AutoLight, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
lv_obj_set_style_text_opa(ui_AutoLight, 255, LV_PART_MAIN | LV_STATE_DEFAULT); |
|||
|
|||
lv_obj_add_event_cb(ui_AutoLight, ui_event_AutoLight, LV_EVENT_ALL, NULL); |
|||
|
|||
} |
|||
@ -1,5 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
@ -1,11 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#include "ui.h" |
|||
|
|||
void onDayLightPressed(lv_event_t * e) |
|||
{ |
|||
// Your code here
|
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#ifndef _UI_EVENTS_H |
|||
#define _UI_EVENTS_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
void onDayLightPressed(lv_event_t * e); |
|||
|
|||
#ifdef __cplusplus |
|||
} /*extern "C"*/ |
|||
#endif |
|||
|
|||
#endif |
|||
@ -1,347 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#include "ui_helpers.h" |
|||
|
|||
void _ui_bar_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); |
|||
if(id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); |
|||
} |
|||
|
|||
void _ui_basic_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); |
|||
if(id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); |
|||
if(id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); |
|||
if(id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); |
|||
} |
|||
|
|||
|
|||
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); |
|||
} |
|||
|
|||
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val) |
|||
{ |
|||
if(id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); |
|||
} |
|||
|
|||
void _ui_label_set_property(lv_obj_t * target, int id, const char * val) |
|||
{ |
|||
if(id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); |
|||
} |
|||
|
|||
|
|||
void _ui_roller_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); |
|||
if(id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); |
|||
} |
|||
|
|||
void _ui_slider_set_property(lv_obj_t * target, int id, int val) |
|||
{ |
|||
if(id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); |
|||
if(id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); |
|||
} |
|||
|
|||
|
|||
void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void)) |
|||
{ |
|||
if(*target == NULL) |
|||
target_init(); |
|||
lv_scr_load_anim(*target, fademode, spd, delay, false); |
|||
} |
|||
|
|||
void _ui_screen_delete(lv_obj_t ** target) |
|||
{ |
|||
if(*target == NULL) { |
|||
lv_obj_del(*target); |
|||
target = NULL; |
|||
} |
|||
} |
|||
|
|||
void _ui_arc_increment(lv_obj_t * target, int val) |
|||
{ |
|||
int old = lv_arc_get_value(target); |
|||
lv_arc_set_value(target, old + val); |
|||
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); |
|||
} |
|||
|
|||
void _ui_bar_increment(lv_obj_t * target, int val, int anm) |
|||
{ |
|||
int old = lv_bar_get_value(target); |
|||
lv_bar_set_value(target, old + val, anm); |
|||
} |
|||
|
|||
void _ui_slider_increment(lv_obj_t * target, int val, int anm) |
|||
{ |
|||
int old = lv_slider_get_value(target); |
|||
lv_slider_set_value(target, old + val, anm); |
|||
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); |
|||
} |
|||
|
|||
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea) |
|||
{ |
|||
lv_keyboard_set_textarea(keyboard, textarea); |
|||
} |
|||
|
|||
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value) |
|||
{ |
|||
if(value == _UI_MODIFY_FLAG_TOGGLE) { |
|||
if(lv_obj_has_flag(target, flag)) lv_obj_clear_flag(target, flag); |
|||
else lv_obj_add_flag(target, flag); |
|||
} |
|||
else if(value == _UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target, flag); |
|||
else lv_obj_clear_flag(target, flag); |
|||
} |
|||
void _ui_state_modify(lv_obj_t * target, int32_t state, int value) |
|||
{ |
|||
if(value == _UI_MODIFY_STATE_TOGGLE) { |
|||
if(lv_obj_has_state(target, state)) lv_obj_clear_state(target, state); |
|||
else lv_obj_add_state(target, state); |
|||
} |
|||
else if(value == _UI_MODIFY_STATE_ADD) lv_obj_add_state(target, state); |
|||
else lv_obj_clear_state(target, state); |
|||
} |
|||
|
|||
|
|||
void _ui_textarea_move_cursor(lv_obj_t * target, int val) |
|||
|
|||
{ |
|||
|
|||
if(val == UI_MOVE_CURSOR_UP) lv_textarea_cursor_up(target); |
|||
if(val == UI_MOVE_CURSOR_RIGHT) lv_textarea_cursor_right(target); |
|||
if(val == UI_MOVE_CURSOR_DOWN) lv_textarea_cursor_down(target); |
|||
if(val == UI_MOVE_CURSOR_LEFT) lv_textarea_cursor_left(target); |
|||
lv_obj_add_state(target, LV_STATE_FOCUSED); |
|||
} |
|||
|
|||
void scr_unloaded_delete_cb(lv_event_t * e) |
|||
|
|||
{ |
|||
|
|||
lv_obj_t ** var = lv_event_get_user_data(e); |
|||
lv_obj_del(*var); |
|||
(*var) = NULL; |
|||
|
|||
} |
|||
|
|||
void _ui_opacity_set(lv_obj_t * target, int val) |
|||
{ |
|||
lv_obj_set_style_opa(target, val, 0); |
|||
} |
|||
|
|||
void _ui_anim_callback_free_user_data(lv_anim_t * a) |
|||
{ |
|||
lv_mem_free(a->user_data); |
|||
a->user_data = NULL; |
|||
} |
|||
|
|||
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_x(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_y(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_width(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_height(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_obj_set_style_opa(usr->target, v, 0); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_img_set_zoom(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
lv_img_set_angle(usr->target, v); |
|||
|
|||
} |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
usr->val = v; |
|||
|
|||
if(v < 0) v = 0; |
|||
if(v >= usr->imgset_size) v = usr->imgset_size - 1; |
|||
lv_img_set_src(usr->target, usr->imgset[v]); |
|||
} |
|||
|
|||
int32_t _ui_anim_callback_get_x(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_x_aligned(usr->target); |
|||
|
|||
} |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_y(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_y_aligned(usr->target); |
|||
|
|||
} |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_width(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_width(usr->target); |
|||
|
|||
} |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_height(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_height(usr->target); |
|||
|
|||
} |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_obj_get_style_opa(usr->target, 0); |
|||
|
|||
} |
|||
|
|||
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_img_get_zoom(usr->target); |
|||
|
|||
} |
|||
|
|||
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return lv_img_get_angle(usr->target); |
|||
|
|||
} |
|||
|
|||
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a) |
|||
|
|||
{ |
|||
|
|||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; |
|||
return usr->val; |
|||
|
|||
} |
|||
|
|||
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) |
|||
{ |
|||
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; |
|||
|
|||
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); |
|||
|
|||
lv_label_set_text(trg, buf); |
|||
} |
|||
|
|||
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) |
|||
{ |
|||
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; |
|||
|
|||
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); |
|||
|
|||
lv_label_set_text(trg, buf); |
|||
} |
|||
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off) |
|||
{ |
|||
if(lv_obj_has_state(src, LV_STATE_CHECKED)) lv_label_set_text(trg, txt_on); |
|||
else lv_label_set_text(trg, txt_off); |
|||
} |
|||
|
|||
|
|||
void _ui_spinbox_step(lv_obj_t * target, int val) |
|||
|
|||
{ |
|||
|
|||
if(val > 0) lv_spinbox_increment(target); |
|||
|
|||
else lv_spinbox_decrement(target); |
|||
|
|||
|
|||
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); |
|||
} |
|||
|
|||
void _ui_switch_theme(int val) |
|||
|
|||
{ |
|||
|
|||
#ifdef UI_THEME_ACTIVE |
|||
ui_theme_set(val); |
|||
#endif |
|||
} |
|||
|
|||
|
|||
@ -1,148 +0,0 @@ |
|||
// This file was generated by SquareLine Studio
|
|||
// SquareLine Studio version: SquareLine Studio 1.4.1
|
|||
// LVGL version: 8.3.11
|
|||
// Project name: SquareLine_Project
|
|||
|
|||
#ifndef _SQUARELINE_PROJECT_UI_HELPERS_H |
|||
#define _SQUARELINE_PROJECT_UI_HELPERS_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
#include "ui.h" |
|||
|
|||
#define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 |
|||
#define _UI_BAR_PROPERTY_VALUE 0 |
|||
#define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 |
|||
void _ui_bar_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
#define _UI_BASIC_PROPERTY_POSITION_X 0 |
|||
#define _UI_BASIC_PROPERTY_POSITION_Y 1 |
|||
#define _UI_BASIC_PROPERTY_WIDTH 2 |
|||
#define _UI_BASIC_PROPERTY_HEIGHT 3 |
|||
void _ui_basic_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
#define _UI_DROPDOWN_PROPERTY_SELECTED 0 |
|||
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
#define _UI_IMAGE_PROPERTY_IMAGE 0 |
|||
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val); |
|||
|
|||
#define _UI_LABEL_PROPERTY_TEXT 0 |
|||
void _ui_label_set_property(lv_obj_t * target, int id, const char * val); |
|||
|
|||
#define _UI_ROLLER_PROPERTY_SELECTED 0 |
|||
#define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 |
|||
void _ui_roller_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
#define _UI_SLIDER_PROPERTY_VALUE 0 |
|||
#define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 |
|||
void _ui_slider_set_property(lv_obj_t * target, int id, int val); |
|||
|
|||
void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void)); |
|||
|
|||
void _ui_screen_delete(lv_obj_t ** target); |
|||
|
|||
void _ui_arc_increment(lv_obj_t * target, int val); |
|||
|
|||
void _ui_bar_increment(lv_obj_t * target, int val, int anm); |
|||
|
|||
void _ui_slider_increment(lv_obj_t * target, int val, int anm); |
|||
|
|||
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea); |
|||
|
|||
#define _UI_MODIFY_FLAG_ADD 0 |
|||
#define _UI_MODIFY_FLAG_REMOVE 1 |
|||
#define _UI_MODIFY_FLAG_TOGGLE 2 |
|||
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value); |
|||
|
|||
#define _UI_MODIFY_STATE_ADD 0 |
|||
#define _UI_MODIFY_STATE_REMOVE 1 |
|||
#define _UI_MODIFY_STATE_TOGGLE 2 |
|||
void _ui_state_modify(lv_obj_t * target, int32_t state, int value); |
|||
|
|||
#define UI_MOVE_CURSOR_UP 0 |
|||
#define UI_MOVE_CURSOR_RIGHT 1 |
|||
#define UI_MOVE_CURSOR_DOWN 2 |
|||
#define UI_MOVE_CURSOR_LEFT 3 |
|||
void _ui_textarea_move_cursor(lv_obj_t * target, int val) |
|||
; |
|||
|
|||
|
|||
void scr_unloaded_delete_cb(lv_event_t * e); |
|||
|
|||
void _ui_opacity_set(lv_obj_t * target, int val); |
|||
|
|||
/** Describes an animation*/ |
|||
typedef struct _ui_anim_user_data_t { |
|||
lv_obj_t * target; |
|||
lv_img_dsc_t ** imgset; |
|||
int32_t imgset_size; |
|||
int32_t val; |
|||
} ui_anim_user_data_t; |
|||
void _ui_anim_callback_free_user_data(lv_anim_t * a); |
|||
|
|||
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v); |
|||
|
|||
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v); |
|||
|
|||
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v); |
|||
|
|||
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_x(lv_anim_t * a); |
|||
|
|||
int32_t _ui_anim_callback_get_y(lv_anim_t * a); |
|||
|
|||
int32_t _ui_anim_callback_get_width(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_height(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a); |
|||
|
|||
|
|||
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a); |
|||
|
|||
|
|||
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix); |
|||
|
|||
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix); |
|||
|
|||
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off); |
|||
|
|||
void _ui_spinbox_step(lv_obj_t * target, int val) |
|||
; |
|||
|
|||
|
|||
void _ui_switch_theme(int val) |
|||
; |
|||
|
|||
|
|||
|
|||
#ifdef __cplusplus |
|||
} /*extern "C"*/ |
|||
#endif |
|||
|
|||
#endif |
|||
Loading…
Reference in new issue