/*
 * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
 *
 * SPDX-License-Identifier: Apache-2.0
 */
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.0
// LVGL version: 9.1.0
// Project name: Smart_Gadget

#include "ui_comp.h"

#if ESP_BROOKESIA_SQUARELINE_ENABLE_UI_COMP

static uint32_t lv_event_get_comp_child = 0;

typedef struct {
    uint32_t child_idx;
    lv_obj_t *child;
} ui_comp_get_child_t;

lv_obj_t *ui_comp_get_child(lv_obj_t *comp, uint32_t child_idx)
{
    ui_comp_get_child_t info;
    info.child = NULL;
    info.child_idx = child_idx;
    lv_obj_send_event(comp, LV_EVENT_GET_COMP_CHILD, &info);
    return info.child;
}

void get_component_child_event_cb(lv_event_t *e)
{
    lv_obj_t **c = lv_event_get_user_data(e);
    ui_comp_get_child_t *info = lv_event_get_param(e);
    info->child = c[info->child_idx];
}

void del_component_child_event_cb(lv_event_t *e)
{
    lv_obj_t **c = lv_event_get_user_data(e);
    lv_free(c);
}

void esp_brookesia_squareline_ui_comp_init(void)
{
    if (lv_event_get_comp_child != 0) {
        return;
    }
    lv_event_get_comp_child = lv_event_register_id();
}

lv_event_code_t ui_comp_get_event_code(void)
{
    return lv_event_get_comp_child;
}

#endif // ESP_BROOKESIA_SQUARELINE_ENABLE_UI_COMP
