蜂窝菜单

蜂窝菜单组件以蜂窝形状显示一组图标。

用法

创建蜂窝菜单组件

要创建蜂窝菜单组件,使用 gui_menu_cellular_create(void *parent, int icon_size, uint32_t *icon_array[],int array_size) 函数。用户需要提供代表图标集的图像文件数组。

配置偏移

使用 void gui_menu_cellular_offset(gui_obj_t *menu_cellular, int offset_x, int offset_y) 函数可以调整水平和垂直偏移以获得更好的显示效果。

示例



#include "gui_menu_cellular.h"
static void app_menu(gui_app_t *app)
{
    /**
     * @link https://docs.realmcu.com/Honeygui/latest/widgets/gui_menu_cellular.html#example
    */
    uint32_t *array[] =
    {
        I4500009_BIN, 
        I4500011_BIN, 
        I4500015_BIN, 
        I4500020_BIN, 
        I4500028_BIN, 
        I4500034_BIN, 
        I4500035_BIN, 
        I4500037_BIN, 
        I4500040_BIN, 
        I4500042_BIN, 
        I4500047_BIN, 
        I4500049_BIN, 
        I4500052_BIN, 
        I4500064_BIN, 
        I4500009_BIN, 
        I4500011_BIN, 
        I4500015_BIN, 
        I4500020_BIN, 
        I4500028_BIN, 
        I4500034_BIN, 
        I4500035_BIN, 
        I4500037_BIN, 
        I4500040_BIN, 
        I4500042_BIN, 
        I4500047_BIN, 
        I4500049_BIN, 
        I4500052_BIN, 
        I4500064_BIN, 
        I4500009_BIN, 
        I4500011_BIN, 
        I4500015_BIN, 
        I4500020_BIN, 
        I4500028_BIN, 
        I4500034_BIN, 
        I4500035_BIN, 
        I4500037_BIN, 
        I4500040_BIN, 
        I4500042_BIN, 
        I4500047_BIN, 
        I4500049_BIN, 
        I4500052_BIN, 
        I4500064_BIN, 
        I4500009_BIN, 
        I4500011_BIN, 
        I4500015_BIN, 
        I4500020_BIN, 

    };
    gui_menu_cellular_t *cell = gui_menu_cellular_create(GUI_APP_ROOT_SCREEN, 100, array,
                                                         sizeof(array) / sizeof(uint32_t *));
    gui_menu_cellular_offset((void *)cell, -36, -216);
}

API

Functions

gui_menu_cellular_t *gui_menu_cellular_create(void *parent, int icon_size, uint32_t *icon_array[], int array_size)

Create a honeycomb effect widget,.

参数:
  • parent – the father widget nested in

  • icon_size – icon’s width(px)

  • icon_array – icons set’s file address array

  • array_size – the array’s size

返回:

gui_menu_cellular_t*

void gui_menu_cellular_offset(gui_obj_t *menu_cellular, int offset_x, int offset_y)

config offset

参数:
  • menu_cellular – the menu_cellular pointer

  • offset_x – offset_x

  • offset_y – offset_y

void gui_menu_cellular_on_click(gui_menu_cellular_t *menu_cellular, struct gui_menu_cellular_gesture_parameter *para_array, int array_length)
struct gui_menu_cellular_t
#include <gui_menu_cellular.h>

menu_cellular structure

Public Members

gui_win_t base

base structure

void *overwrite
int x
int y
int16_t speed[2]
int16_t left
int16_t right
int16_t top
int16_t bottom
int16_t left_offset
int16_t right_offset
int16_t top_offset
int16_t bottom_offset
int16_t touch_y
bool render
struct gui_menu_cellular_gesture_parameter
#include <gui_menu_cellular.h>

Public Members

gui_event_cb_t callback_function
void *parameter