lv_fragment.h
Public header for Fragment
Typedefs
-
typedef struct lv_fragment_manager_t lv_fragment_manager_t
Functions
-
lv_fragment_manager_t *lv_fragment_manager_create(lv_fragment_t *parent)
Create fragment manager instance
- 参数:
parent -- Parent fragment if this manager is placed inside another fragment, can be null.
- 返回:
Fragment manager instance
-
void lv_fragment_manager_delete(lv_fragment_manager_t *manager)
Destroy fragment manager instance
- 参数:
manager -- Fragment manager instance
-
void lv_fragment_manager_create_obj(lv_fragment_manager_t *manager)
Create object of all fragments managed by this manager.
- 参数:
manager -- Fragment manager instance
-
void lv_fragment_manager_delete_obj(lv_fragment_manager_t *manager)
Delete object created by all fragments managed by this manager. Instance of fragments will not be deleted.
- 参数:
manager -- Fragment manager instance
-
void lv_fragment_manager_add(lv_fragment_manager_t *manager, lv_fragment_t *fragment, lv_obj_t *const *container)
Attach fragment to manager, and add to container.
- 参数:
manager -- Fragment manager instance
fragment -- Fragment instance
container -- Pointer to container object for manager to add objects to
-
void lv_fragment_manager_remove(lv_fragment_manager_t *manager, lv_fragment_t *fragment)
Detach and destroy fragment. If fragment is in navigation stack, remove from it.
- 参数:
manager -- Fragment manager instance
fragment -- Fragment instance
-
void lv_fragment_manager_push(lv_fragment_manager_t *manager, lv_fragment_t *fragment, lv_obj_t *const *container)
Attach fragment to manager and add to navigation stack.
- 参数:
manager -- Fragment manager instance
fragment -- Fragment instance
container -- Pointer to container object for manager to add objects to
-
bool lv_fragment_manager_pop(lv_fragment_manager_t *manager)
Remove the top-most fragment for stack
- 参数:
manager -- Fragment manager instance
- 返回:
true if there is fragment to pop
-
void lv_fragment_manager_replace(lv_fragment_manager_t *manager, lv_fragment_t *fragment, lv_obj_t *const *container)
Replace fragment. Old item in the stack will be removed.
- 参数:
manager -- Fragment manager instance
fragment -- Fragment instance
container -- Pointer to container object for manager to add objects to
-
bool lv_fragment_manager_send_event(lv_fragment_manager_t *manager, int code, void *userdata)
Send event to top-most fragment
- 参数:
manager -- Fragment manager instance
code -- User-defined ID of event
userdata -- User-defined data
- 返回:
true if fragment returned true
-
size_t lv_fragment_manager_get_stack_size(lv_fragment_manager_t *manager)
Get stack size of this fragment manager
- 参数:
manager -- Fragment manager instance
- 返回:
Stack size of this fragment manager
-
lv_fragment_t *lv_fragment_manager_get_top(lv_fragment_manager_t *manager)
Get top most fragment instance
- 参数:
manager -- Fragment manager instance
- 返回:
Top most fragment instance
-
lv_fragment_t *lv_fragment_manager_find_by_container(lv_fragment_manager_t *manager, const lv_obj_t *container)
Find first fragment instance in the container
- 参数:
manager -- Fragment manager instance
container -- Container which target fragment added to
- 返回:
First fragment instance in the container
-
lv_fragment_t *lv_fragment_manager_get_parent_fragment(lv_fragment_manager_t *manager)
Get parent fragment
- 参数:
manager -- Fragment manager instance
- 返回:
Parent fragment instance
-
lv_fragment_t *lv_fragment_create(const lv_fragment_class_t *cls, void *args)
Create a fragment instance.
- 参数:
cls -- Fragment class. This fragment must return non null object.
args -- Arguments assigned by fragment manager
- 返回:
Fragment instance
-
void lv_fragment_delete(lv_fragment_t *fragment)
Destroy a fragment.
- 参数:
fragment -- Fragment instance.
-
lv_fragment_manager_t *lv_fragment_get_manager(lv_fragment_t *fragment)
Get associated manager of this fragment
- 参数:
fragment -- Fragment instance
- 返回:
Fragment manager instance
-
lv_obj_t *const *lv_fragment_get_container(lv_fragment_t *fragment)
Get container object of this fragment
- 参数:
fragment -- Fragment instance
- 返回:
Reference to container object
-
lv_fragment_t *lv_fragment_get_parent(lv_fragment_t *fragment)
Get parent fragment of this fragment
- 参数:
fragment -- Fragment instance
- 返回:
Parent fragment
-
lv_obj_t *lv_fragment_create_obj(lv_fragment_t *fragment, lv_obj_t *container)
Create object by fragment.
- 参数:
fragment -- Fragment instance.
container -- Container of the objects should be created upon.
- 返回:
Created object
-
void lv_fragment_delete_obj(lv_fragment_t *fragment)
Delete created object of a fragment
- 参数:
fragment -- Fragment instance.
-
void lv_fragment_recreate_obj(lv_fragment_t *fragment)
Destroy obj in fragment, and recreate them.
- 参数:
fragment -- Fragment instance
-
struct lv_fragment_t
Public Members
-
const lv_fragment_class_t *cls
Class of this fragment
-
lv_fragment_managed_states_t *managed
Managed fragment states. If not null, then this fragment is managed.
警告
Don't modify values inside this struct!
-
lv_fragment_manager_t *child_manager
Child fragment manager
-
const lv_fragment_class_t *cls
-
struct lv_fragment_class_t
Public Members
-
void (*constructor_cb)(lv_fragment_t *self, void *args)
Constructor function for fragment class
- Param self:
Fragment instance
- Param args:
Arguments assigned by fragment manager
-
void (*destructor_cb)(lv_fragment_t *self)
Destructor function for fragment class
- Param self:
Fragment instance, will be freed after this call
-
void (*attached_cb)(lv_fragment_t *self)
Fragment attached to manager
- Param self:
Fragment instance
-
void (*detached_cb)(lv_fragment_t *self)
Fragment detached from manager
- Param self:
Fragment instance
-
lv_obj_t *(*create_obj_cb)(lv_fragment_t *self, lv_obj_t *container)
Create objects
- Param self:
Fragment instance
- Param container:
Container of the objects should be created upon
- Return:
Created object, NULL if multiple objects has been created
-
void (*obj_created_cb)(lv_fragment_t *self, lv_obj_t *obj)
- Param self:
Fragment instance
- Param obj:
lv_obj returned by create_obj_cb
-
void (*obj_will_delete_cb)(lv_fragment_t *self, lv_obj_t *obj)
Called before objects in the fragment will be deleted.
- Param self:
Fragment instance
- Param obj:
object with this fragment
-
void (*obj_deleted_cb)(lv_fragment_t *self, lv_obj_t *obj)
Called when the object created by fragment received
LV_EVENT_DELETE
event- Param self:
Fragment instance
- Param obj:
object with this fragment
-
bool (*event_cb)(lv_fragment_t *self, int code, void *userdata)
Handle event
- Param self:
Fragment instance
- Param which:
User-defined ID of event
- Param data1:
User-defined data
- Param data2:
User-defined data
-
size_t instance_size
REQUIRED: Allocation size of fragment
-
void (*constructor_cb)(lv_fragment_t *self, void *args)