1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00
lvgl/lv_objx/lv_btnm.h

80 lines
1.8 KiB
C
Raw Normal View History

2016-09-30 13:35:54 +02:00
/**
* @file lv_btnm.h
*
*/
#ifndef LV_BTNM_H
#define LV_BTNM_H
/*********************
* INCLUDES
*********************/
#include "lv_conf.h"
#if USE_LV_BTNM != 0
#include "../lv_obj/lv_obj.h"
#include "lv_rect.h"
#include "lv_label.h"
#include "lv_btn.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Style of button matrix*/
typedef struct
{
2016-12-15 10:31:30 +01:00
lv_rects_t rects; /*Style of ancestor*/
2016-09-30 13:35:54 +02:00
/*New style element for this type */
2016-12-15 10:31:30 +01:00
lv_btns_t btns; /*Style of the buttons*/
lv_labels_t labels; /*Style of the labels on the buttons*/
2016-09-30 13:35:54 +02:00
}lv_btnms_t;
/*Built-in styles of button matrix*/
typedef enum
{
LV_BTNMS_DEF,
}lv_btnms_builtin_t;
/* Type of callback function which is called when a button is released
* Parameters: button matrix, released button index in the map string
2016-12-15 10:31:30 +01:00
* return false: the released button or the button matrix is deleted else true*/
typedef lv_action_res_t (*lv_btnm_callback_t) (lv_obj_t *, uint16_t);
2016-09-30 13:35:54 +02:00
/*Data of button matrix*/
typedef struct
{
2016-12-15 10:31:30 +01:00
lv_rect_ext_t rect; /*Ext. of ancestor*/
2016-09-30 13:35:54 +02:00
/*New data for this type */
const char ** map_p; /*Pointer to the current map*/
area_t * btn_areas;
uint16_t btn_cnt;
uint16_t btn_pr;
2016-09-30 13:35:54 +02:00
lv_btnm_callback_t cb;
}lv_btnm_ext_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
2016-10-07 11:15:46 +02:00
lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy);
bool lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param);
lv_btnms_t * lv_btnms_get(lv_btnms_builtin_t style, lv_btnms_t * copy);
2016-09-30 13:35:54 +02:00
2016-10-07 11:15:46 +02:00
void lv_btnm_set_map(lv_obj_t * btnm, const char ** map);
void lv_btnm_set_cb(lv_obj_t * btnm, lv_btnm_callback_t cb);
2016-09-30 13:35:54 +02:00
2016-10-07 11:15:46 +02:00
const char ** lv_btnm_get_map(lv_obj_t * btnm);
lv_btnm_callback_t lv_btnm_get_cb(lv_obj_t * btnm);
2016-09-30 13:35:54 +02:00
/**********************
* MACROS
**********************/
#endif /*USE_LV_BTNM*/
2016-09-30 13:35:54 +02:00
#endif /*LV_BTNM_H*/