47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
#include "include.h"
|
|
|
|
#define TRACE_EN 1
|
|
|
|
#if TRACE_EN
|
|
#define TRACE(...) printf(__VA_ARGS__)
|
|
#else
|
|
#define TRACE(...)
|
|
#endif
|
|
|
|
//创建一个按钮
|
|
compo_button_t *compo_button_create(compo_form_t *frm)
|
|
{
|
|
compo_button_t *btn = compo_create(frm, COMPO_TYPE_BUTTON);
|
|
widget_page_t *page = widget_page_create(frm->page);
|
|
btn->widget = page;
|
|
return btn;
|
|
}
|
|
|
|
//根据图像创建一个按钮
|
|
compo_button_t *compo_button_create_by_image(compo_form_t *frm, u32 res_addr)
|
|
{
|
|
compo_button_t *btn = compo_create(frm, COMPO_TYPE_BUTTON);
|
|
widget_image_t *img = widget_image_create(frm->page, res_addr);
|
|
btn->widget = img;
|
|
return btn;
|
|
}
|
|
|
|
//设置坐标及大小
|
|
void compo_button_set_location(compo_button_t *btn, s16 x, s16 y, s16 width, s16 height)
|
|
{
|
|
widget_set_location(btn->widget, x, y, width, height);
|
|
}
|
|
|
|
//设置坐标
|
|
void compo_button_set_pos(compo_button_t *btn, s16 x, s16 y)
|
|
{
|
|
widget_set_pos(btn->widget, x, y);
|
|
}
|
|
|
|
//设置透明度
|
|
void compo_button_set_alpha(compo_button_t *btn, u8 alpha)
|
|
{
|
|
widget_set_alpha(btn->widget, alpha);
|
|
}
|
|
|