Curtain

The curtain widget enables you to create curtains in five directions: up, down, left, right, and middle (refer to Orientation). Before creating the curtain widget, you must first create a curtainview widget to accommodate the curtain.

Usage

Create Curtain Widget

If you want to create a curtain widget with a defined direction, you may opt to utilize the gui_curtain_create() function. orientation represents direction and can create curtain widgets in five different directions: up, down, left, right, and center. Scope refers to the curtain range that can be extended, which falls between 0 and 1.

Orientation

There are five orientations in curtain widget.

typedef enum
{
    CURTAIN_UNDEFINED,
    CURTAIN_UP,
    CURTAIN_DOWN,
    CURTAIN_LEFT,
    CURTAIN_RIGHT,
    CURTAIN_MIDDLE,
} T_GUI_CURTAIN_ENUM;

Example

#include "root_image_hongkong/ui_resource.h"
#include <gui_img.h>
#include "gui_curtainview.h"
#include "gui_curtain.h"

void page_tb_clock(void *parent)
{
    gui_curtainview_t *ct = gui_curtainview_create(parent, "ct", 0, 0, 368, 448);
    gui_curtain_t *ct_clock = gui_curtain_create(ct, "1", 0, 0, 368, 448, CURTAIN_MIDDLE, 1);
    gui_curtain_t *ct_control0 = gui_curtain_create(ct, "2", 0, 0, 368, 448, CURTAIN_UP, 1);
    gui_curtain_t *ct_left = gui_curtain_create(ct, "3", 0, 0, 368, 448, CURTAIN_LEFT, 0.65f);

    gui_curtain_t *ct_card = gui_curtain_create(ct, "card", 0, 0, 368, 448, CURTAIN_DOWN, 1);

    extern void page_ct_clock(void *parent);
    extern void page_ct_sidebar(void *parent);
    extern void tabview_up_design(void *parent_widget);
    extern void curtain_down_design(void *parent_widget);
    page_ct_clock(ct_clock);
    page_ct_sidebar(ct_left);
    tabview_up_design(ct_control0);
    curtain_down_design(ct_card);
}


API

Functions

gui_curtain_t *gui_curtain_create(void *parent, const char *filename, int16_t x, int16_t y, int16_t w, int16_t h, T_GUI_CURTAIN_ENUM orientation, float scope)

Create a curtain effect widget, which should be nested in a curtainview.

Parameters:
  • parent – The father widget nested in (should be a curtainview).

  • filename – This curtain widget’s name.

  • x – The X-axis coordinate relative to parent widget.

  • y – The Y-axis coordinate relative to parent widget.

  • w – Width.

  • h – Height.

  • orientation – The orientation of the curtain, refer to gui_curtain_t_ORIENTATION.

  • scope – The range in which curtains can be expanded.

Returns:

Return the curtain widget pointer.

struct gui_curtain_t

Curtain structure.

Public Members

gui_obj_t base

Base structure.

T_GUI_CURTAIN_ENUM orientation
float scope