BigW Consortium Gitlab

Commit bf1903d1 by Gabor Kiss-Vamosi

API updates

parent 2ea1af59
......@@ -42,7 +42,7 @@ static lv_indev_t *indev_list = NULL;
* @param driver Input Device driver structure
* @return pointer to the new input device
*/
lv_indev_t * lv_indev_drv_register(lv_hal_indev_drv_t *driver)
lv_indev_t * lv_indev_register(lv_hal_indev_drv_t *driver)
{
lv_indev_t *node;
......@@ -88,7 +88,7 @@ lv_indev_t * lv_indev_next(lv_indev_t * indev)
* @param data input device will write its data here
* @return false: no more data; true: there more data to read (buffered)
*/
bool lv_indev_get(lv_indev_t * indev, lv_hal_indev_data_t *data)
bool lv_indev_read(lv_indev_t * indev, lv_hal_indev_data_t *data)
{
bool cont = false;
......
......@@ -17,8 +17,8 @@ extern "C" {
*********************/
#include <stdbool.h>
#include <stdint.h>
#include "lv_hal.h"
#include "misc/gfx/area.h"
#include <lvgl/lv_hal/lv_hal.h>
/*********************
* DEFINES
......@@ -99,15 +99,15 @@ typedef struct _lv_indev_t {
* @param driver Input Device driver structure
* @return 0 on success, -ve on error
*/
lv_indev_t * lv_indev_drv_register(lv_hal_indev_drv_t *driver);
lv_indev_t * lv_indev_register(lv_hal_indev_drv_t *driver);
/**
* Ask data fro man input device.
* Ask data from an input device.
* @param data input device data
* @return false: no more data; true: there more data to read (buffered)
*/
bool lv_indev_get(lv_indev_t * indev, lv_hal_indev_data_t *data);
bool lv_indev_read(lv_indev_t * indev, lv_hal_indev_data_t *data);
/**
* Get the next input device.
......
......@@ -201,7 +201,7 @@ static void indev_proc_task(void * param)
if(i->state.disable == 0) {
/*Read the data*/
lv_indev_get(i, &data);
lv_indev_read(i, &data);
i->state.pressed = data.state;
/*Move the cursor if set and moved*/
......@@ -283,12 +283,12 @@ static void indev_proc_press(lv_indev_state_t * state)
/*If there is no last object then search*/
if(state->act_obj == NULL) {
pr_obj = indev_search_obj(state, lv_layer_top());
if(pr_obj == NULL) pr_obj = indev_search_obj(state, lv_screen_act());
if(pr_obj == NULL) pr_obj = indev_search_obj(state, lv_scr_act());
}
/*If there is last object but it is not dragged also search*/
else if(state->drag_in_prog == 0) {/*Now act_obj != NULL*/
pr_obj = indev_search_obj(state, lv_layer_top());
if(pr_obj == NULL) pr_obj = indev_search_obj(state, lv_screen_act());
if(pr_obj == NULL) pr_obj = indev_search_obj(state, lv_scr_act());
}
/*If a dragable object was the last then keep it*/
else {
......@@ -520,7 +520,6 @@ static void indev_drag_throw(lv_indev_state_t * state)
lv_obj_t * drag_obj = state->last_obj;
/*If drag parent is active check recursively the drag_parent attribute*/
while(lv_obj_get_drag_parent(drag_obj) != false &&
drag_obj != NULL) {
drag_obj = lv_obj_get_parent(drag_obj);
......
......@@ -364,7 +364,7 @@ void lv_obj_invalidate(lv_obj_t * obj)
{
/*Invalidate the object only if it belongs to the 'act_scr'*/
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
if(obj_scr == lv_screen_act() ||
if(obj_scr == lv_scr_act() ||
obj_scr == lv_layer_top() ||
obj_scr == lv_layer_sys()) {
/*Truncate recursively to the parents*/
......@@ -404,7 +404,7 @@ void lv_obj_invalidate(lv_obj_t * obj)
* Load a new screen
* @param scr pointer to a screen
*/
void lv_screen_load(lv_obj_t * scr)
void lv_scr_load(lv_obj_t * scr)
{
act_scr = scr;
......@@ -496,10 +496,10 @@ void lv_obj_set_pos(lv_obj_t * obj, cord_t x, cord_t y)
/**
* Set relative the position of an object (relative to the parent).
* The coordinates will be upscaled with LV_DOWNSCALE.
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
* @param x new distance from the left side of the parent. (will be multiplied with LV_DOWNSCALE)
* @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE)
* @param x new distance from the left side of the parent.
* @param y new distance from the top of the parent.
*/
void lv_obj_set_pos_scale(lv_obj_t * obj, cord_t x, cord_t y)
{
......@@ -518,9 +518,9 @@ void lv_obj_set_x(lv_obj_t * obj, cord_t x)
/**
* Set the x coordinate of a object.
* The coordinate will be upscaled with LV_DOWNSCALE.
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
* @param x new distance from the left side from the parent. (will be multiplied with LV_DOWNSCALE)
* @param x new distance from the left side from the parent.
*/
void lv_obj_set_x_scale(lv_obj_t * obj, cord_t x)
{
......@@ -539,9 +539,9 @@ void lv_obj_set_y(lv_obj_t * obj, cord_t y)
/**
* Set the y coordinate of a object.
* The coordinate will be upscaled with LV_DOWNSCALE.
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
* @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE)
* @param y new distance from the top of the parent.
*/
void lv_obj_set_y_scale(lv_obj_t * obj, cord_t y)
{
......@@ -588,10 +588,11 @@ void lv_obj_set_size(lv_obj_t * obj, cord_t w, cord_t h)
}
/**
* Set the size of an object. The coordinates will be upscaled with LV_DOWNSCALE.
* Set the size of an object.
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
* @param w new width (will be multiplied with LV_DOWNSCALE)
* @param h new height (will be multiplied with LV_DOWNSCALE)
* @param w new width
* @param h new height
*/
void lv_obj_set_size_scale(lv_obj_t * obj, cord_t w, cord_t h)
{
......@@ -609,9 +610,10 @@ void lv_obj_set_width(lv_obj_t * obj, cord_t w)
}
/**
* Set the width of an object. The width will be upscaled with LV_DOWNSCALE
* Set the width of an object.
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
* @param w new width (will be multiplied with LV_DOWNSCALE)
* @param w new width
*/
void lv_obj_set_width_scale(lv_obj_t * obj, cord_t w)
{
......@@ -629,9 +631,10 @@ void lv_obj_set_height(lv_obj_t * obj, cord_t h)
}
/**
* Set the height of an object. The height will be upscaled with LV_DOWNSCALE
* Set the height of an object.
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
* @param h new height (will be multiplied with LV_DOWNSCALE)
* @param h new height
*/
void lv_obj_set_height_scale(lv_obj_t * obj, cord_t h)
{
......@@ -777,30 +780,19 @@ void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod
/**
* Align an object to an other object. The coordinates will be upscaled with LV_DOWNSCALE.
* Align an object to an other object.
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object to align
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
* @param align type of alignment (see 'lv_align_t' enum)
* @param x_mod x coordinate shift after alignment (will be multiplied with LV_DOWNSCALE)
* @param y_mod y coordinate shift after alignment (will be multiplied with LV_DOWNSCALE)
* @param x_mod x coordinate shift after alignment
* @param y_mod y coordinate shift after alignment
*/
void lv_obj_align_scale(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod, cord_t y_mod)
{
lv_obj_align(obj, base, align, x_mod << LV_ANTIALIAS, y_mod << LV_ANTIALIAS);
}
/**
* Set the extended size of an object
* @param obj pointer to an object
* @param ext_size the extended size
*/
void lv_obj_set_ext_size(lv_obj_t * obj, cord_t ext_size)
{
obj->ext_size = ext_size;
lv_obj_invalidate(obj);
}
/*---------------------
* Appearance set
*--------------------*/
......@@ -1108,7 +1100,7 @@ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint1
* Return with the actual screen
* @return pointer to the actual screen object
*/
lv_obj_t * lv_screen_act(void)
lv_obj_t * lv_scr_act(void)
{
return act_scr;
}
......
......@@ -223,7 +223,7 @@ void lv_obj_invalidate(lv_obj_t * obj);
* Load a new screen
* @param scr pointer to a screen
*/
void lv_screen_load(lv_obj_t * scr);
void lv_scr_load(lv_obj_t * scr);
/**
* Set a new parent for an object. Its relative position will be the same.
......@@ -457,7 +457,7 @@ void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);
*/
void lv_obj_refresh_ext_size(lv_obj_t * obj);
#if LV_OBJ_FREE_NUMBER != 0
#if LV_OBJ_FREE_NUM != 0
/**
* Set an application specific number for an object.
* It can help to identify objects in the application.
......@@ -467,7 +467,7 @@ void lv_obj_refresh_ext_size(lv_obj_t * obj);
void lv_obj_set_free_number(lv_obj_t * obj, uint8_t free_number);
#endif
#if LV_OBJ_FREE_POINTER != 0
#if LV_OBJ_FREE_PTR != 0
/**
* Set an application specific pointer for an object.
* It can help to identify objects in the application.
......@@ -491,7 +491,7 @@ void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint1
* Return with the actual screen
* @return pointer to to the actual screen object
*/
lv_obj_t * lv_screen_act(void);lv_obj_t * lv_layer_top(void);
lv_obj_t * lv_scr_act(void);lv_obj_t * lv_layer_top(void);
/**
* Return with the system layer. (Same on every screen and it is above the all other layers)
......@@ -667,7 +667,7 @@ void * lv_obj_get_ext_attr(lv_obj_t * obj);
uint8_t lv_obj_get_free_num(lv_obj_t * obj);
#endif
#if LV_OBJ_FREE_P != 0
#if LV_OBJ_FREE_PTR != 0
/**
* Get the free pointer
* @param obj pointer to an object
......@@ -684,9 +684,11 @@ void * lv_obj_get_free_p(lv_obj_t * obj);
*/
void * lv_obj_get_group(lv_obj_t * obj);
#endif
/**********************
* MACROS
**********************/
#define LV_SCALE(x) (x << LV_ANTIALIAS)
#ifdef __cplusplus
......
......@@ -98,7 +98,7 @@ void lv_inv_area(const area_t * area_p)
/*The area is truncated to the screen*/
if(suc != false)
{
#if LV_DOWNSCALE == 2
#if LV_ANTIALIAS == 1
/*Rounding*/
com_area.x1 = com_area.x1 & (~0x1);
com_area.y1 = com_area.y1 & (~0x1);
......@@ -242,7 +242,7 @@ static void lv_refr_area_no_vdb(const area_t * area_p)
lv_obj_t * top_p;
/*Get top object which is not covered by others*/
top_p = lv_refr_get_top_obj(area_p, lv_screen_act());
top_p = lv_refr_get_top_obj(area_p, lv_scr_act());
/*Do the refreshing*/
lv_refr_make(top_p, area_p);
......@@ -261,7 +261,7 @@ static void lv_refr_area_with_vdb(const area_t * area_p)
if(max_row > area_get_height(area_p)) max_row = area_get_height(area_p);
/*Round the row number with downscale*/
#if LV_DOWNSCALE == 2
#if LV_ANTIALIAS == 1
max_row &= (~0x1);
#endif
......@@ -310,7 +310,7 @@ static void lv_refr_area_part_vdb(const area_t * area_p)
area_union(&start_mask, area_p, &vdb_p->area);
/*Get the most top object which is not covered by others*/
top_p = lv_refr_get_top_obj(&start_mask, lv_screen_act());
top_p = lv_refr_get_top_obj(&start_mask, lv_scr_act());
/*Do the refreshing from the top object*/
lv_refr_make(top_p, &start_mask);
......@@ -372,7 +372,7 @@ static void lv_refr_make(lv_obj_t * top_p, const area_t * mask_p)
/* Normally always will be a top_obj (at least the screen)
* but in special cases (e.g. if the screen has alpha) it won't.
* In this case use the screen directly */
if(top_p == NULL) top_p = lv_screen_act();
if(top_p == NULL) top_p = lv_scr_act();
/*Refresh the top object and its children*/
lv_refr_obj(top_p, mask_p);
......
......@@ -64,7 +64,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
ext->min_value = 0;
ext->max_value = 100;
ext->act_value = 0;
ext->style_indic = lv_style_get(LV_STYLE_PRETTY_COLOR);
ext->indicator_style = lv_style_get(LV_STYLE_PRETTY_COLOR);
/* Save the ancient design function.
* It will be used in the bar design function*/
......@@ -84,7 +84,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
ext->min_value = ext_copy->min_value;
ext->max_value = ext_copy->max_value;
ext->act_value = ext_copy->act_value;
ext->style_indic = ext_copy->style_indic;
ext->indicator_style = ext_copy->indicator_style;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(new_bar);
......@@ -110,7 +110,7 @@ bool lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
* make the object specific signal handling */
if(valid != false) {
if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
lv_style_t * style_indic = lv_bar_get_style_indic(bar);
lv_style_t * style_indic = lv_bar_get_indicator_style(bar);
if(style_indic->body.shadow.width > bar->ext_size) bar->ext_size = style_indic->body.shadow.width;
}
......@@ -196,11 +196,11 @@ void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max)
* @param bar pointer to a bar object
* @param style pointer to a style
*/
void lv_bar_set_style_indic(lv_obj_t * bar, lv_style_t * style)
void lv_bar_set_indicator_style(lv_obj_t * bar, lv_style_t * style)
{
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
ext->style_indic = style;
ext->indicator_style = style;
bar->signal_func(bar, LV_SIGNAL_REFR_EXT_SIZE, NULL);
......@@ -249,13 +249,13 @@ int16_t lv_bar_get_max_value(lv_obj_t * bar)
* @param bar pointer to a bar object
* @return pointer to the bar indicator style
*/
lv_style_t * lv_bar_get_style_indic(lv_obj_t * bar)
lv_style_t * lv_bar_get_indicator_style(lv_obj_t * bar)
{
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
if(ext->style_indic == NULL) return lv_obj_get_style(bar);
if(ext->indicator_style == NULL) return lv_obj_get_style(bar);
return ext->style_indic;
return ext->indicator_style;
}
/**********************
......@@ -282,7 +282,7 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
lv_style_t * style_indic = lv_bar_get_style_indic(bar);
lv_style_t * style_indic = lv_bar_get_indicator_style(bar);
area_t indic_area;
area_cpy(&indic_area, &bar->coords);
indic_area.x1 += style_indic->body.padding.horizontal;
......
......@@ -32,12 +32,12 @@ extern "C" {
/*Data of bar*/
typedef struct
{
/*No inherited ext*/ /*Ext. of ancestor*/
/*No inherited ext*/ /*Ext. of ancestor*/
/*New data for this type */
int16_t act_value; /*Current value of the bar*/
int16_t min_value; /*Minimum value of the bar*/
int16_t max_value; /*Maximum value of the bar*/
lv_style_t * style_indic; /*Style of the indicator*/
int16_t act_value; /*Current value of the bar*/
int16_t min_value; /*Minimum value of the bar*/
int16_t max_value; /*Maximum value of the bar*/
lv_style_t *indicator_style; /*Style of the indicator*/
}lv_bar_ext_t;
/**********************
......@@ -88,7 +88,7 @@ void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max);
* @param bar pointer to a bar object
* @param style pointer to a style
*/
void lv_bar_set_style_indic(lv_obj_t * bar, lv_style_t * style);
void lv_bar_set_indicator_style(lv_obj_t * bar, lv_style_t * style);
/**
* Get the value of a bar
......@@ -116,7 +116,7 @@ int16_t lv_bar_get_max_value(lv_obj_t * bar);
* @param bar pointer to a bar object
* @return pointer to the bar indicator style
*/
lv_style_t * lv_bar_get_style_indic(lv_obj_t * bar);
lv_style_t * lv_bar_get_indicator_style(lv_obj_t * bar);
/**********************
* MACROS
......
......@@ -8,15 +8,14 @@
*********************/
#include "lv_conf.h"
#if USE_LV_BUTTON != 0
#if USE_LV_BTN != 0
#include <string.h>
#include "lv_btn.h"
#include "../lv_obj/lv_group.h"
#include "../lv_draw/lv_draw.h"
#include "misc/gfx/area.h"
#include "misc/gfx/color.h"
#include <stdbool.h>
#include <string.h>
/*********************
* DEFINES
......@@ -241,6 +240,22 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
}
/**
* Toggle the state of the button (ON->OFF, OFF->ON)
* @param btn pointer to a button object
*/
void lv_btn_toggle(lv_obj_t * btn)
{
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
switch(ext->state) {
case LV_BTN_STATE_OFF_RELEASED: lv_btn_set_state(btn, LV_BTN_STATE_ON_RELEASED); break;
case LV_BTN_STATE_OFF_PRESSED: lv_btn_set_state(btn, LV_BTN_STATE_ON_PRESSED); break;
case LV_BTN_STATE_ON_RELEASED: lv_btn_set_state(btn, LV_BTN_STATE_OFF_RELEASED); break;
case LV_BTN_STATE_ON_PRESSED: lv_btn_set_state(btn, LV_BTN_STATE_OFF_PRESSED); break;
default: break;
}
}
/**
* Set a function to call when the button is pressed
* @param btn pointer to a button object
* @param pr_action pointer to function
......
/**
* @file lv_button.h
* @file lv_btn.h
*
*/
#ifndef lv_btn_H
#define lv_btn_H
#ifndef LV_BTN_H
#define LV_BTN_H
#ifdef __cplusplus
extern "C" {
......@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "lv_conf.h"
#if USE_LV_BUTTON != 0
#if USE_LV_BTN != 0
/*Testing of dependencies*/
#if USE_LV_CONT == 0
......@@ -22,7 +22,7 @@ extern "C" {
#endif
#include "lv_cont.h"
#include <lvgl/lv_obj/lv_indev.h>
#include "../lv_obj/lv_indev.h"
/*********************
* DEFINES
......@@ -101,6 +101,12 @@ void lv_btn_set_toggle(lv_obj_t * btn, bool tgl);
void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state);
/**
* Toggle the state of the button (ON->OFF, OFF->ON)
* @param btn pointer to a button object
*/
void lv_btn_toggle(lv_obj_t * btn);
/**
* Set a function to call when the button is pressed
* @param btn pointer to a button object
* @param pr_action pointer to function
......@@ -108,7 +114,7 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state);
void lv_btn_set_action(lv_obj_t * btn, lv_btn_action_t type, lv_action_t action);
/**
* Set styles of a button is each state
* Set styles of a button is each state. Use NULL for any style which are not be changed.
* @param btn pointer to button object
* @param rel pointer to a style for releases state
* @param pr pointer to a style for pressed state
......@@ -118,7 +124,6 @@ void lv_btn_set_action(lv_obj_t * btn, lv_btn_action_t type, lv_action_t action)
*/
void lv_btn_set_style(lv_obj_t * btn, lv_btn_state_t state, lv_style_t * style);
void lv_btn_set_style_all(lv_obj_t * btn, lv_style_t ** style_array);
/**
* Get the current state of the button
* @param btn pointer to a button object
......@@ -141,12 +146,11 @@ bool lv_btn_get_toggle(lv_obj_t * btn);
lv_action_t lv_btn_get_action(lv_obj_t * btn, lv_btn_action_t type);
/**
* Get the press action of a button
* Get the style of a button in a given state
* @param btn pointer to a button object
* @return pointer to the press action function
* @param state a state from 'lv_btn_state_t' in which style should be get
* @return pointer to the style in the given state
*/
lv_action_t lv_btn_get_pr_action(lv_obj_t * btn);
lv_style_t * lv_btn_get_style(lv_obj_t * btn, lv_btn_state_t state);
/**********************
......
......@@ -29,42 +29,39 @@ extern "C" {
#define LV_BTNM_CTRL_CODE 0x80 /*The control byte has to begin (if present) with 0b10xxxxxx*/
#define LV_BTNM_CTRL_MASK 0xC0
#define LV_BTNM_WIDTH_MASK 0x07
#define LV_BTNM_HIDDEN_MASK 0x08
#define LV_BTNM_NO_LPR_MASK 0x10
#define LV_BTNM_HIDE_MASK 0x08
#define LV_BTNM_REPEAT_DISABLE_MASK 0x10
#define LV_BTNM_RESERVED_MASK 0x20
/**********************
* TYPEDEFS
**********************/
/* Type of callback function which is called when a button is released on the button matrix
* Parameters: button matrix, released button index in the map string
* return LV_ACTION_RES_INV: the button matrix is deleted else LV_ACTION_RES_OK*/
typedef lv_action_res_t (*lv_btnm_callback_t) (lv_obj_t *, uint16_t);
/* Type of callback function which is called when a button is released or long pressed on the button matrix
* Parameters: button matrix, text of the released button
* return LV_ACTION_RES_INV if the button matrix is deleted else LV_ACTION_RES_OK*/
typedef lv_action_res_t (*lv_btnm_action_t) (lv_obj_t *, const char *txt);
/*Data of button matrix*/
typedef struct
{
lv_cont_ext_t bg; /*Ext. of ancestor*/
/*New data for this type */
const char ** map_p; /*Pointer to the current map*/
area_t * btn_areas; /*Array of areas for the buttons (Handled by the library)*/
uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/
uint16_t btn_pr; /*Index of the currently pressed button or LV_BTNM_PR_NONE (Handled by the library)*/
uint16_t btn_tgl; /*Index of the currently toggled button or LV_BTNM_PR_NONE (Handled by the library)*/
lv_btnm_callback_t cb; /*A function to call when a button is releases*/
lv_style_t * style_btn_rel; /*Style of the released buttons*/
lv_style_t * style_btn_pr; /*Style of the pressed buttons*/
lv_style_t * style_btn_trel; /*Style of the toggled released buttons*/
lv_style_t * style_btn_tpr; /*Style of the toggled pressed buttons*/
lv_style_t * style_btn_ina; /*Style of the inactive buttons*/
uint8_t tgl :1; /*Enable toggling*/
const char ** map_p; /*Pointer to the current map*/
area_t * button_areas; /*Array of areas of buttons*/
lv_btnm_action_t action; /*A function to call when a button is releases*/
lv_style_t * button_styles[LV_BTN_STATE_NUM]; /*Styles of buttons in each state*/
uint16_t button_cnt; /*Number of button in 'map_p'(Handled by the library)*/
uint16_t button_id_pressed; /*Index of the currently pressed button or LV_BTNM_PR_NONE*/
uint16_t button_id_toggled; /*Index of the currently toggled button or LV_BTNM_PR_NONE */
uint8_t toggle :1; /*Enable toggling*/
}lv_btnm_ext_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a button matrix objects
* @param par pointer to an object, it will be the parent of the new button matrix
......@@ -87,10 +84,14 @@ bool lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param);
* @param btnm pointer to a button matrix object
* @param map pointer a string array. The last string has to be: "".
* Use "\n" to begin a new line.
* Use octal numbers (e.g. "\003") to set the relative
* width of a button. (max. 9 -> \011)
* (e.g. const char * str[] = {"a", "b", "\n", "\004c", "d", ""}).
* The button do not copy the array so it can not be a local variable.
* The first byte can be a control data:
* - bit 7: always 1
* - bit 6: always 0
* - bit 5: reserved
* - bit 4: no repeat (on long press)
* - bit 3: hidden
* - bit 2..0: button relative width
* Example (practically use octal numbers): "\224abc": "abc" text with 4 width and no long press
*/
void lv_btnm_set_map(lv_obj_t * btnm, const char ** map);
......@@ -99,7 +100,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map);
* @param btnm: pointer to button matrix object
* @param cb pointer to a callback function
*/
void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_callback_t cb);
void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_action_t cb);
/**
* Enable or disable button toggling
......@@ -107,20 +108,18 @@ void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_callback_t cb);
* @param en true: enable toggling; false: disable toggling
* @param id index of the currently toggled button (ignored if 'en' == false)
*/
void lv_btnm_set_tgl(lv_obj_t * btnm, bool en, uint16_t id);
void lv_btnm_set_toggle(lv_obj_t * btnm, bool en, uint16_t id);
/**
* Set the styles of the buttons of the button matrix
* @param btnm pointer to a button matrix object
* @param rel pointer to a style for releases state
* @param pr pointer to a style for pressed state
* @param trel pointer to a style for toggled releases state
* @param tpr pointer to a style for toggled pressed state
* @param ina pointer to a style for inactive state
* @param rel pointer to a style for releases state (NULL to leave it unchanged)
* @param pr pointer to a style for pressed state (NULL to leave it unchanged)
* @param trel pointer to a style for toggled releases state (NULL to leave it unchanged)
* @param tpr pointer to a style for toggled pressed state (NULL to leave it unchanged)
* @param ina pointer to a style for inactive state (NULL to leave it unchanged)
*/
void lv_btnm_set_styles_btn(lv_obj_t * btnm, lv_style_t * rel, lv_style_t * pr,
lv_style_t * trel, lv_style_t * tpr, lv_style_t * ina);
void lv_btnm_set_button_style(lv_obj_t *btnm, lv_btn_state_t state, lv_style_t *style);
/**
* Get the current map of a button matrix
......@@ -134,7 +133,7 @@ const char ** lv_btnm_get_map(lv_obj_t * btnm);
* @param btnm: pointer to button matrix object
* @return pointer to the callback function
*/
lv_btnm_callback_t lv_btnm_get_action(lv_obj_t * btnm);
lv_btnm_action_t lv_btnm_get_action(lv_obj_t * btnm);
/**
* Get the style of buttons in button matrix
......@@ -142,7 +141,7 @@ lv_btnm_callback_t lv_btnm_get_action(lv_obj_t * btnm);
* @param state style in this state (LV_BTN_STATE_PR or LV_BTN_STATE_REL)
* @return pointer the button style in the given state
*/
lv_style_t * lv_btnm_get_style_btn(lv_obj_t * btnm, lv_btn_state_t state);
lv_style_t * lv_btnm_get_button_style(lv_obj_t * btnm, lv_btn_state_t state);
/**********************
* MACROS
......
......@@ -17,7 +17,7 @@ extern "C" {
#if USE_LV_CB != 0
/*Testing of dependencies*/
#if USE_LV_BUTTON == 0
#if USE_LV_BTN == 0
#error "lv_cb: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
#endif
......
......@@ -238,7 +238,7 @@ void lv_img_set_auto_size(lv_obj_t * img, bool en)
/**
* Enable the upscaling with LV_DOWNSCALE.
* Enable the upscaling if LV_ANTIALIAS is enabled.
* If enabled the object size will be same as the picture size.
* @param img pointer to an image
* @param en true: upscale enable, false: upscale disable
......@@ -250,9 +250,9 @@ void lv_img_set_upscale(lv_obj_t * img, bool en)
/*Upscale works only if antialiassing is enabled*/
#if LV_ANTIALIAS == 0
en = false;
#endif
#else
ext->upscale = (en == false ? 0 : 1);
#endif
/*Refresh the image with the new size*/
lv_img_set_file(img, ext->fn);
}
......
......@@ -180,7 +180,7 @@ void lv_line_set_y_inv(lv_obj_t * line, bool yinv)
}
/**
* Enable (or disable) the point coordinate upscaling (compensate LV_DOWNSCALE).
* Enable (or disable) the points' coordinate upscaling (if LV_ANTIALIAS is enabled).
* @param line pointer to a line object
* @param unscale true: enable the point coordinate upscaling
*/
......
......@@ -21,7 +21,7 @@ extern "C" {
#error "lv_list: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) "
#endif
#if USE_LV_BUTTON == 0
#if USE_LV_BTN == 0
#error "lv_list: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
#endif
......
......@@ -21,7 +21,7 @@ extern "C" {
#error "lv_mbox: lv_cont is required. Enable it in lv_conf.h (USE_LV_CONT 1) "
#endif
#if USE_LV_BUTTON == 0
#if USE_LV_BTN == 0
#error "lv_mbox: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
#endif
......
......@@ -284,7 +284,7 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
lv_style_t * style_slider = lv_obj_get_style(slider);
lv_style_t * style_knob = lv_slider_get_style_knob(slider);
lv_style_t * style_indic = lv_bar_get_style_indic(slider);
lv_style_t * style_indic = lv_bar_get_indicator_style(slider);
/*Draw the bar*/
area_t area_bar;
......
......@@ -93,7 +93,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy)
lv_btnm_set_map(ext->tabs, tab_def);
lv_obj_set_height(ext->tabs, 3 * LV_DPI / 4);
lv_btnm_set_action(ext->tabs, tab_btnm_action);
lv_btnm_set_tgl(ext->tabs, true, 0);
lv_btnm_set_toggle(ext->tabs, true, 0);
ext->indic = lv_obj_create(ext->tabs, NULL);
lv_style_t * style_indic = lv_obj_get_style(ext->indic);
......@@ -279,7 +279,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
anim_create(&a);
}
lv_btnm_set_tgl(ext->tabs, true, ext->tab_act);
lv_btnm_set_toggle(ext->tabs, true, ext->tab_act);
}
/*=====================
......
......@@ -17,7 +17,7 @@ extern "C" {
#if USE_LV_WIN != 0
/*Testing of dependencies*/
#if USE_LV_BUTTON == 0
#if USE_LV_BTN == 0
#error "lv_win: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment