1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/lv_objx/lv_rect.h

99 lines
2.5 KiB
C
Raw Normal View History

2016-06-08 07:25:08 +02:00
/**
* @file lv_rect.h
*
*/
#ifndef LV_RECT_H
#define LV_RECT_H
/*********************
* INCLUDES
*********************/
#include "lv_conf.h"
2016-06-08 07:25:08 +02:00
#if USE_LV_RECT != 0
#include "../lv_obj/lv_obj.h"
#include "../lv_obj/lv_dispi.h"
/*********************
* DEFINES
*********************/
2016-08-09 12:24:03 +02:00
#define LV_RECT_CIRCLE 0xFFFF /*A very big radius to always draw as circle*/
2016-06-08 07:25:08 +02:00
/**********************
* TYPEDEFS
**********************/
2016-06-22 20:39:07 +02:00
typedef enum
{
2016-06-22 21:52:39 +02:00
LV_RECT_LAYOUT_OFF = 0,
LV_RECT_LAYOUT_CENTER,
LV_RECT_LAYOUT_COL_L, /*Column left align*/
LV_RECT_LAYOUT_COL_M, /*Column middle align*/
LV_RECT_LAYOUT_COL_R, /*Column right align*/
2016-12-15 10:31:30 +01:00
LV_RECT_LAYOUT_ROW_T, /*Row left align*/
LV_RECT_LAYOUT_ROW_M, /*Row middle align*/
LV_RECT_LAYOUT_ROW_B, /*Row right align*/
2016-12-17 10:50:28 +01:00
LV_RECT_LAYOUT_PRETTY, /*Put as many object as possible in row and begin a new row*/
LV_RECT_LAYOUT_GRID, /*Align same-sized object into a grid*/
2016-06-22 21:52:39 +02:00
}lv_rect_layout_t;
2016-06-22 20:39:07 +02:00
2016-12-15 10:31:30 +01:00
/*Style of rectangle*/
2016-06-08 07:25:08 +02:00
typedef struct
{
2016-10-07 11:15:46 +02:00
lv_objs_t objs; /*Style of ancestor*/
/*New style element for this type */
color_t gcolor; /*Gradient color*/
color_t bcolor; /*Border color*/
color_t lcolor; /*Light color*/
2016-12-15 10:31:30 +01:00
uint16_t bwidth;/*Border width*/
uint16_t round; /*Radius on the corners*/
cord_t hpad; /*Horizontal padding when horizontal fit is enabled*/
cord_t vpad; /*Vertical padding when vertical fit is enabled*/
cord_t opad; /*Object padding with fit*/
cord_t light; /*Light size*/
2016-12-15 10:31:30 +01:00
uint8_t bopa; /*Border opacity*/
uint8_t empty :1; /*1: Do not draw the body of the rectangle*/
2016-06-08 07:25:08 +02:00
}lv_rects_t;
2016-12-15 10:31:30 +01:00
/*Built-in styles of rectangle*/
2016-10-07 11:15:46 +02:00
typedef enum
{
LV_RECTS_DEF,
LV_RECTS_TRANSP,
LV_RECTS_BORDER,
}lv_rects_builtin_t;
2016-06-08 07:25:08 +02:00
typedef struct
{
2016-10-07 11:15:46 +02:00
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
/*New data for this type */
2016-06-22 21:52:39 +02:00
uint8_t layout :5;
uint8_t hfit_en :1;
uint8_t vfit_en :1;
2016-06-08 07:25:08 +02:00
}lv_rect_ext_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*Create function*/
2016-10-07 11:15:46 +02:00
lv_obj_t * lv_rect_create(lv_obj_t * par, lv_obj_t * copy);
bool lv_rect_signal(lv_obj_t * rect, lv_signal_t sign, void * param);
2016-06-15 09:38:20 +02:00
2016-10-07 11:15:46 +02:00
void lv_rect_set_fit(lv_obj_t * rect, bool hor_en, bool ver_en);
void lv_rect_set_layout(lv_obj_t * rect, lv_rect_layout_t layout);
2016-06-15 09:38:20 +02:00
2016-10-07 11:15:46 +02:00
lv_rect_layout_t lv_rect_get_layout(lv_obj_t * rect);
bool lv_rect_get_hfit(lv_obj_t * rect);
bool lv_rect_get_vfit(lv_obj_t * rect);
lv_rects_t * lv_rects_get(lv_rects_builtin_t style, lv_rects_t * copy);
2016-06-08 07:25:08 +02:00
/**********************
* MACROS
**********************/
#endif
#endif