C Application
Users can develop in view widgets to create interactive and visually appealing user interfaces. Each view can be switched arbitrarily and can incorporate dynamic transition effects during switching.
What is displayed in the C application is organized nested Widget tree structure, which uses the view widget as the parent node. This structure includes container widgets such as windows and scrollable lists, as well as content display widgets like text, images, and canvases.
In addition to the default functions and effects, widgets within C application offer a high degree of customization. Users can set up custom timers for widgets and bind events to execute their defined operations. This flexibility enables the creation of highly dynamic and interactive user interfaces tailored to specific needs and requirements.
Create C Application Widget Tree
The root node of the number of widgets can be obtained through the
gui_obj_get_root()function, and a new widget tree is created based on this. The root node of the widget tree is an object of typegui_obj_t, representing the top-level container of the entire application.Through functions for creating widgets, such as
gui_img_create_from_mem(), various widgets can be created under the root node. Each widget is based on an object of typegui_obj_t, representing a specific user interface element.The
gui_obj_add_event_cb()function can add listening events and callback functions to each widget, such as clicks, scroll events, etc.The
gui_obj_create_timer()function can add a timer to each widget to perform certain operations within a specific time interval.Use the
GUI_INIT_APP_EXPORTmacro to add the application’s design function to the initialization function table. This function is called when the application starts to initialize and configure the widget tree.
void test_event_cb(void *obj, gui_event_t e, void *param)
{
GUI_UNUSED(e);
GUI_UNUSED(param);
gui_obj_t *this = (gui_obj_t *)obj;
gui_log("Event test obj name = %s, e = 0x%x !\n", this->name, e);
}
void test_timer_cb(void *param)
{
GUI_UNUSED(param);
gui_log("timer cb test!\n");
}
#include "gifdec.h"
static int app_init(void)
{
void *addr = (void *)_actiger_blue_compressed;
// void *addr = (void *)_acgreen;
// void *addr = (void *)_acgif_demo;
gui_img_t *img = gui_img_create_from_mem(gui_obj_get_root(), "img_1_test", addr, 0, 0, 0, 0);
gui_img_set_focus(img, 50, 50);
gui_img_rotation(img, 45.0f);
gui_img_translate(img, 50, 50);
// gui_obj_add_event_cb(img, (gui_event_cb_t)test_event_cb, GUI_EVENT_TOUCH_CLICKED, NULL);
// gui_obj_create_timer(&(img->base), 1000, true, test_timer_cb);
// gui_obj_start_timer(&(img->base));
return 0;
}
GUI_INIT_APP_EXPORT(app_init);
C Application Transition Effect
HoneyGUI Provides various transition effects, including hand sliding transition and non-hand animation transitions. This function requires to use view widgets. Please refer to View for details.