⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wgui_fixed_menus.c

📁 详细介绍MTK平台图层运用的好东西
💻 C
📖 第 1 页 / 共 5 页
字号:


/*****************************************************************************
 * FUNCTION
 *  initialize_balls
 * DESCRIPTION
 *  Initialize the balls position and buffer.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void initialize_balls(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ball[0].position = &ball1pos[0][0];
    ball[1].position = &ball2pos[0][0];

    memset(&ball[0].image, 0, sizeof(bitmap));
    memset(&ball[1].image, 0, sizeof(bitmap));
    memset(&ballimgdata[0], 0, BALL_BUFFER);
    memset(&ballimgdata[1], 0, BALL_BUFFER);

    ball[0].image.data = ballimgdata[0];
    ball[1].image.data = ballimgdata[1];
}

#endif /* defined(__MMI_UI_DALMATIAN_MAINMENU__) */


/*****************************************************************************
 * FUNCTION
 *  create_fixed_list
 * DESCRIPTION
 *  Creates the fixed list menu.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void create_fixed_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gui_create_fixed_list_menu(
        &MMI_fixed_list_menu,
        MMI_content_x,
        MMI_content_y,
        MMI_content_width,
        MMI_content_height);
#if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_LIST_MENU_FRAME_SKIPPING))
    wgui_fixed_list_menu_frame_counter = 0;
#endif 

#ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
    reset_fixed_icontext_menuitem_type();
#endif 
    normal_fixed_list();
}


/*****************************************************************************
 * FUNCTION
 *  plain_fixed_list
 * DESCRIPTION
 *  Set the list menu to plain display mode. (without background and scroll bar)
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void plain_fixed_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_fixed_list_menu.flags |= (UI_LIST_MENU_DISABLE_BACKGROUND | UI_LIST_MENU_DISABLE_SCROLLBAR);
}


/*****************************************************************************
 * FUNCTION
 *  normal_fixed_list
 * DESCRIPTION
 *  Set the list menu to normal display mode.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void normal_fixed_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_fixed_list_menu.flags &=
        ~(UI_LIST_MENU_ALIGN_TO_TOP | UI_LIST_MENU_DISABLE_BACKGROUND | UI_LIST_MENU_DISABLE_SCROLLBAR |
          UI_LIST_MENU_ENABLE_TRANSITION | UI_LIST_MENU_DISABLE_CACHE_DYNAMIC_DATA |
          UI_LIST_MENU_DISABLE_BKGRND_IN_LAYER | UI_LIST_MENU_DISABLE_PEN | UI_LIST_MENU_DISABLE_MENUITEM_GAP);

    /* force align to top as default */
    MMI_fixed_list_menu.flags |= UI_LIST_MENU_ALIGN_TO_TOP;

    _MMI_hide_fixed_list_menu = UI_dummy_function;
}


/*****************************************************************************
 * FUNCTION
 *  register_hide_fixed_list
 * DESCRIPTION
 *  Register the hide callback of the fixed list menu.
 * PARAMETERS
 *  f       [IN]        hide callback function
 * RETURNS
 *  void
 *****************************************************************************/
void register_hide_fixed_list(void (*f)(void))
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    _MMI_hide_fixed_list_menu = f;
}


/*****************************************************************************
 * FUNCTION
 *  move_fixed_list
 * DESCRIPTION
 *  Move the fixed list menu.
 * PARAMETERS
 *  x       [IN]        x
 *  y       [IN]        y
 * RETURNS
 *  void
 *****************************************************************************/
void move_fixed_list(S32 x, S32 y)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if defined(__MMI_PLUTO_LISTBOX__)
    gui_move_fixed_list_menu(&MMI_fixed_list_menu, x + 1, y + 1);
#else /* defined(__MMI_PLUTO_LISTBOX__) */ 
    gui_move_fixed_list_menu(&MMI_fixed_list_menu, x, y);
#endif /* defined(__MMI_PLUTO_LISTBOX__) */ 
}


/*****************************************************************************
 * FUNCTION
 *  register_fixed_list_highlight_handler
 * DESCRIPTION
 *  Register the highlight handler for the fixed list.
 * PARAMETERS
 *  f       [IN]        highlight handler of the fixed list
 * RETURNS
 *  void
 *****************************************************************************/
void register_fixed_list_highlight_handler(void (*f)(S32 item_index))
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_fixed_list_menu.item_highlighted = f;
}


/*****************************************************************************
 * FUNCTION
 *  register_fixed_list_unhighlight_handler
 * DESCRIPTION
 *  Register the unhighlight handler for the fixed list.
 * PARAMETERS
 *  f       [IN]        unhighlight handler of the fixed list
 * RETURNS
 *  void
 *****************************************************************************/
void register_fixed_list_unhighlight_handler(void (*f)(S32 item_index))
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_fixed_list_menu.item_unhighlighted = f;
}

#ifdef __MMI_UI_LIST_TRANSITION__

#define MMI_UI_LIST_TRANSITION_COUNT   10

wgui_transition_styles MMI_list_transition_style = WGUI_TRANSITION_NONE;
S32 MMI_check_list_for_transition = 1;


/*****************************************************************************
 * FUNCTION
 *  set_list_transition
 * DESCRIPTION
 *  Set the list transition style.
 * PARAMETERS
 *  style       [IN]        list transition style
 * RETURNS
 *  void
 *****************************************************************************/
void set_list_transition(wgui_transition_styles style)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_list_transition_style = style;
}


/*****************************************************************************
 * FUNCTION
 *  get_list_transition
 * DESCRIPTION
 *  Return the list transition style.
 * PARAMETERS
 *  void
 * RETURNS
 *  List transition style
 *****************************************************************************/
wgui_transition_styles get_list_transition(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return MMI_list_transition_style;
}


/*****************************************************************************
 * FUNCTION
 *  reset_list_transition
 * DESCRIPTION
 *  Reset the list transition style to none.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void reset_list_transition(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_list_transition_style = WGUI_TRANSITION_NONE;
}


/*****************************************************************************
 * FUNCTION
 *  draw_transition_list
 * DESCRIPTION
 *  Draw the transition list.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void draw_transition_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (MMI_list_transition_style)
    {
        case WGUI_TRANSITION_D2T:
        {
            S32 prev_y = MMI_fixed_list_menu.y;
            S32 prev_height = MMI_fixed_list_menu.height;
            S32 i, transition_count;
            S32 transition_resolution;

            i = transition_count = MMI_UI_LIST_TRANSITION_COUNT;
            transition_resolution = MMI_fixed_list_menu.height / transition_count;
            MMI_fixed_list_menu.y = MMI_fixed_list_menu.y + MMI_fixed_list_menu.height - 1;
            MMI_fixed_list_menu.height = 0;

            MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_BACKGROUND | UI_LIST_MENU_ENABLE_TRANSITION;

            while (i - 1)
            {
                MMI_fixed_list_menu.y -= transition_resolution;
                MMI_fixed_list_menu.height += transition_resolution;
                move_fixed_list(MMI_fixed_list_menu.x, MMI_fixed_list_menu.y);
                resize_fixed_list(MMI_fixed_list_menu.width, MMI_fixed_list_menu.height);
                MMI_fixed_list_menu.top = 0;
                show_fixed_list();
                i--;
            }

            MMI_fixed_list_menu.height = prev_height;
            MMI_fixed_list_menu.y = prev_y;

            move_fixed_list(MMI_fixed_list_menu.x, MMI_fixed_list_menu.y);
            resize_fixed_list(MMI_fixed_list_menu.width, MMI_fixed_list_menu.height);
            show_fixed_list();

            break;
        }
            
        case WGUI_TRANSITION_T2D:
        {
            S32 prev_y = MMI_fixed_list_menu.y;
            S32 prev_height = MMI_fixed_list_menu.height;
            S32 i, transition_count;
            S32 transition_resolution;

            i = transition_count = MMI_UI_LIST_TRANSITION_COUNT;
            transition_resolution = MMI_fixed_list_menu.height / transition_count;
            MMI_fixed_list_menu.y -= (MMI_fixed_list_menu.height - 1);
            MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_BACKGROUND | UI_LIST_MENU_ENABLE_TRANSITION;

            while (i - 1)
            {
                MMI_fixed_list_menu.y += transition_resolution;
                move_fixed_list(MMI_fixed_list_menu.x, MMI_fixed_list_menu.y);
                resize_fixed_list(MMI_fixed_list_menu.width, MMI_fixed_list_menu.height);
                MMI_fixed_list_menu.top = 0;
                show_fixed_list();
                gui_BLT_double_buffer(
                    MMI_fixed_list_menu.x,
                    prev_y,
                    MMI_fixed_list_menu.x + MMI_fixed_list_menu.width,
                    prev_y + prev_height - 1);
                i--;
            }

            MMI_fixed_list_menu.height = prev_height;
            MMI_fixed_list_menu.y = prev_y;

            move_fixed_list(MMI_fixed_list_menu.x, MMI_fixed_list_menu.y);
            resize_fixed_list(MMI_fixed_list_menu.width, MMI_fixed_list_menu.height);
            show_fixed_list();
            gui_BLT_double_buffer(
                MMI_fixed_list_menu.x,
                prev_y,
                MMI_fixed_list_menu.x + MMI_fixed_list_menu.width,
                prev_y + prev_height - 1);
            leave_full_screen();

            break;
        }       
    }
}

#if (LIST_TRANSITION_STYLE_NON_BLOCKING)
static S32 g_in_list_transition = 0;
static S32 g_prev_list_y;
static S32 g_prev_list_height;


/*****************************************************************************
 * FUNCTION
 *  wgui_list_tranisition_abort_cleanup_function
 * DESCRIPTION
 *  Cleanup function for the list transition.
 * PARAMETERS
 *  void
 * RETURNS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -