lvgl/src/lv_objx/lv_cont.c
/**
 * Create a container objects
 * @param par pointer to an object, it will be the parent of the new container
 * @param copy pointer to a container object, if not NULL then the new object will be copied from it
 * @return pointer to the created container
 */
Create a container objects
@param par pointer to an object, it will be the parent of the new container
@param copy pointer to a container object, if not NULL then the new object will be copied from it
@return pointer to the created container
Create a container objects @param par pointer to an object it will be the parent of the new container @param copy pointer to a container object if not NULL then the new object will be copied from it @return pointer to the created container
lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("container create started");
    lv_obj_t * new_cont = lv_obj_create(par, copy);
    LV_ASSERT_MEM(new_cont);
    if(new_cont == NULL) return NULL;
    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_cont);
    lv_obj_allocate_ext_attr(new_cont, sizeof(lv_cont_ext_t));
    lv_cont_ext_t * ext = lv_obj_get_ext_attr(new_cont);
    if(ext == NULL) return NULL;
    LV_ASSERT_MEM(ext);
    ext->fit_left   = LV_FIT_NONE;
    ext->fit_right  = LV_FIT_NONE;
    ext->fit_top    = LV_FIT_NONE;
    ext->fit_bottom = LV_FIT_NONE;
    ext->layout     = LV_LAYOUT_OFF;
    lv_obj_set_signal_cb(new_cont, lv_cont_signal);
    if(copy == NULL) {
        if(par != NULL) {
            lv_theme_t * th = lv_theme_get_current();
            if(th) {
                lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, th->style.cont);
            } else {
                lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, &lv_style_pretty);
            }
        }
    }
    else {
        lv_cont_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->fit_left            = copy_ext->fit_left;
        ext->fit_right           = copy_ext->fit_right;
        ext->fit_top             = copy_ext->fit_top;
        ext->fit_bottom          = copy_ext->fit_bottom;
        ext->layout              = copy_ext->layout;
        lv_obj_refresh_style(new_cont);
    }
    LV_LOG_INFO("container created");
    return new_cont;
}
lv_obj_t * lv_cont_create ( lv_obj_t * par , const lv_obj_t * copy ) { LV_LOG_TRACE ( " " ) ; lv_obj_t * new_cont = lv_obj_create ( par , copy ) ; LV_ASSERT_MEM ( new_cont ) ; if ( new_cont == NULL ) return NULL ; if ( ancestor_signal == NULL ) ancestor_signal = lv_obj_get_signal_cb ( new_cont ) ; lv_obj_allocate_ext_attr ( new_cont , sizeof ( lv_cont_ext_t ) ) ; lv_cont_ext_t * ext = lv_obj_get_ext_attr ( new_cont ) ; if ( ext == NULL ) return NULL ; LV_ASSERT_MEM ( ext ) ; ext -> fit_left = LV_FIT_NONE ; ext -> fit_right = LV_FIT_NONE ; ext -> fit_top = LV_FIT_NONE ; ext -> fit_bottom = LV_FIT_NONE ; ext -> layout = LV_LAYOUT_OFF ; lv_obj_set_signal_cb ( new_cont , lv_cont_signal ) ; if ( copy == NULL ) { if ( par != NULL ) { lv_theme_t * th = lv_theme_get_current ( ) ; if ( th ) { lv_cont_set_style ( new_cont , LV_CONT_STYLE_MAIN , th -> style . cont ) ; } else { lv_cont_set_style ( new_cont , LV_CONT_STYLE_MAIN , & lv_style_pretty ) ; } } } else { lv_cont_ext_t * copy_ext = lv_obj_get_ext_attr ( copy ) ; ext -> fit_left = copy_ext -> fit_left ; ext -> fit_right = copy_ext -> fit_right ; ext -> fit_top = copy_ext -> fit_top ; ext -> fit_bottom = copy_ext -> fit_bottom ; ext -> layout = copy_ext -> layout ; lv_obj_refresh_style ( new_cont ) ; } LV_LOG_INFO ( " " ) ; return new_cont ; }
Create a container objects
 @param par pointer to an object, it will be the parent of the new container
 @param copy pointer to a container object, if not NULL then the new object will be copied from it
 @return pointer to the created container
Create a container objects @param par pointer to an object it will be the parent of the new container @param copy pointer to a container object if not NULL then the new object will be copied from it @return pointer to the created container
/*Create a basic object*/ /*Init the new container*/ /*Set the default styles if it's not screen*/ /*Copy an existing object*/ /*Refresh the style with new signal function*/