/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*----------------------------------------------------------------------------*/
/*! @file u_wgl_icon.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *  
 *  @par Description:
 *         This header file contains public interfaces, constant and type 
 *         definitions of the Widget Library.
 */
/*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*/
/*! @defgroup groupMW_WGL_ICON   Icon Widget  
 *
 *  @ingroup groupMW_WGL
 *  @brief Provides definitions and exported function of the widget icon library.
 *
 *  %MW Application API would be used by TV Application, lot of these APIs would
 *   be wrapped from Exported API
 *
 *  @see groupMW_WGL
 *  @{ 
 */
/*----------------------------------------------------------------------------*/

 
#ifndef _U_WGL_ICON_H_
#define _U_WGL_ICON_H_

/*-----------------------------------------------------------------------------
                    include files
 ----------------------------------------------------------------------------*/
#include "u_wgl.h"
#include "u_wgl_common.h"
#include "u_wgl_tools.h"


#ifdef __cplusplus
extern "C" {
#endif

/*-----------------------------------------------------------------------------
                    macros, defines, typedefs, enums
 ----------------------------------------------------------------------------*/
/* Specific ICON style */
#define WGL_STL_ICON_MULTI_IMG                  ((UINT32) WGL_STL_WGT_SPF_START)    /**< If this style is assigned, it means the Icon Static will have multiple foreground images.*/

/* Specific Command */
/**
This command is used to get minimum widget size, which includes minimum sizes of content and 
border. Note: this command isn't supported in this version.

Input arguments

pv_param1	Pointer of a GL_SIZE_T to receive the size. It cannot be NULL.

pv_param2	Reserved. It must be NULL.

Returns

WGLR_OK	The function call is successful.

WGLR_INV_ARG	The argument pv_param1 is NULL.
*/
#define WGL_CMD_ICON_GET_MIN_SIZE               WGL_MAKE_WIDGET_CMD(HT_WGL_WIDGET_ICON, 0)    


/* Specific Command Supported by ICON-Content */
/**
This command is used to set Icon Static's foreground alignment.

Input arguments

pv_param1	Specifies the alignment style. It can be from WGL_AS_LEFT_TOP to WGL_AS_RIGHT_BOTTOM. 
About the explanation of these alignment styles.

pv_param2	Reserved. It must be NULL.

Returns

WGLR_OK	The function call is successful.

WGLR_INV_ARG	The style specified by pv_param1 is invalid.
*/
#define WGL_CMD_ICON_SET_ALIGN                  WGL_MAKE_CONTENT_CMD(HT_WGL_WIDGET_ICON, 0)   

/**
This command returns the foreground's alignment of an Icon Static.

Input arguments

pv_param1	Pointer to a UINT8 to receive its alignment style. It cannot be NULL.

pv_param2	Reserved. It must be NULL.

Returns

WGLR_OK	The function call is successful.

WGLR_INV_ARG	The argument pv_param1 is NULL.
*/
#define WGL_CMD_ICON_GET_ALIGN                  WGL_MAKE_CONTENT_CMD(HT_WGL_WIDGET_ICON, 1)   

/**
This command is used to set the display margin of an Icon Static's foreground. The i4_left is for 
the left margin, the i4_right is for the right margin, the i4_top is for the top margin, and the 
i4_bottom is for the bottom margin. All of them cannot be less than 0.

Input arguments

pv_param1	Pointer to a WGL_INSET_T value to specify the display margin. It cannot be NULL.

pv_param2	Reserved. It must be NULL.

Returns

WGLR_OK	The function call is successful.

WGLR_INV_ARG	pv_param1 is NULL, or the sum of i4_left and i4_right isn't less than Icon Static's 
width, or the sum of i4_top and i4_bottom isn't less than Icon Static's height.
*/
#define WGL_CMD_ICON_SET_CNT_INSET              WGL_MAKE_CONTENT_CMD(HT_WGL_WIDGET_ICON, 2)   

/**
This command returns the display margin of an Icon Static's foreground. The i4_left is the left 
margin, the i4_right is the right margin, the i4_top is the top margin, and the i4_bottom is the 
bottom margin. 

Input arguments

pv_param1	Pointer to a WGL_INSET_T value to receive the display margin. It cannot be NULL.

pv_param2	Reserved. It must be NULL.

Returns

WGLR_OK	The function call is successful.

WGLR_INV_ARG	The argument pv_param1 is NULL.
*/
#define WGL_CMD_ICON_GET_CNT_INSET              WGL_MAKE_CONTENT_CMD(HT_WGL_WIDGET_ICON, 3)   

/**
This command is used to set the max foreground image number, which means such number of images 
can be contained in this icon instance at most.

Input arguments

pv_param1	The maximum images number. Its type must be UINT32.

pv_param2	Reserved. It must be NULL.

Returns

WGLR_OK	The function call is successful.

WGLR_ICON_NOT_SUPPORT_IN_DEFAULT_STL
	The command is done under NONE WGL_STL_ICON_MULTI_IMG style.

WGLR_OUT_OF_MEMORY  Fail to reallocate memory for multiple image nodes.
*/
#define WGL_CMD_ICON_SET_MAX_FG_IMG_NUM         WGL_MAKE_CONTENT_CMD(HT_WGL_WIDGET_ICON, 4)   

/**
This command is used to get the max foreground image number, which means such number of images 
can be contained in this icon instance at most.

Input arguments

pv_param1	Pointer of a UINT32 to receive the number. It cannot be NULL.

pv_param2	Reserved. It must be NULL.

Returns

WGLR_OK	The function call is successful.

WGLR_INV_ARG	The argument pv_param1 is NULL.

WGLR_ICON_NOT_SUPPORT_IN_DEFAULT_STL
	The command is done under NONE WGL_STL_ICON_MULTI_IMG style.
*/
#define WGL_CMD_ICON_GET_MAX_FG_IMG_NUM         WGL_MAKE_CONTENT_CMD(HT_WGL_WIDGET_ICON, 5)   


/**(WGL_CMD_ICON_GET_MAX_FG_IMG_NUM - WGL_CMD_ICON_SET_ALIGN + 1)*/
#define ICON_CNT_PRIVATE_START                  6       

/* Specific ICON image target*/
#define WGL_IMG_ICON_MULTIPLE                   ((UINT8) WGL_IMG_WGT_SPF_START + 1)    /**<This target is used for Icon widget with WGL_STL_ICON_MULTI_IMG to set multi images.*/


/* Specific ICON widget return value*/
/**This value shall be returned when the image target WGL_IMG_ICON_MULTIPLE is used to set or get multi images or the command WGL_CMD_ICON_SET_MAX_FG_IMG_NUM, 
WGL_CMD_ICON_GET_MAX_FG_IMG_NUM is done to set or get max images number under NONE WGL_STL_ICON_MULTI_IMG style.*/
#define WGLR_ICON_NOT_SUPPORT_IN_DEFAULT_STL    ((INT32) WGLR_WIDGET_SPF_START - 1)    

/**This value shall be returned when the image target WGL_IMG_FG is used to set or get the single image under WGL_STL_ICON_MULTI_IMG style.*/
#define WGLR_ICON_NOT_SUPPORT_IN_MULTI_IMG_STL  ((INT32) WGLR_WIDGET_SPF_START - 2)    

/*-----------------------------------------------------------------------------
                    structures
 ----------------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/*! @struct WGL_ICON_FG_IMG_NODE_T
 *  @brief This structure holds the foreground image node information.
 *  @code
 *  typedef struct _WGL_ICON_FG_IMG_NODE_T
 *  {
 *      WGL_IMG_INFO_T            t_img_info;       
 *      INT32                     i4_ahead_gap;     
 *  } WGL_ICON_FG_IMG_NODE_T;
 *  @endcode
 *  @li@c  t_img_info                                        -image information of this image
 *  @li@c  i4_ahead_gap                                      - gap between this image and previous image
 */
/*------------------------------------------------------------------*/
typedef struct _WGL_ICON_FG_IMG_NODE_T
{
    WGL_IMG_INFO_T            t_img_info;       /* image information of this icon */
    INT32                     i4_ahead_gap;     /* gap between this icon and previous icon */
} WGL_ICON_FG_IMG_NODE_T;

/*------------------------------------------------------------------*/
/*! @struct WGL_ICON_MULTIPLE_INFO_T
 *  @brief This structure holds the multiple nodes information.
 *  @code
 *  typedef struct _WGL_ICON_MULTIPLE_INFO_T
 *  {
 *      UINT32                    ui4_node_num;     
 *      WGL_ICON_FG_IMG_NODE_T*   at_nodes;         
 *  } WGL_ICON_MULTIPLE_INFO_T;
 *  @endcode
 *  @li@c  ui4_node_num                                      - icon nodes number
 *  @li@c  at_nodes                                          - contains icon nodes information
 */
/*------------------------------------------------------------------*/
typedef struct _WGL_ICON_MULTIPLE_INFO_T
{
    UINT32                    ui4_node_num;     /* icon node number*/
    WGL_ICON_FG_IMG_NODE_T*   at_nodes;         /* contains icon nodes information */
} WGL_ICON_MULTIPLE_INFO_T;


/*-----------------------------------------------------------------------------
                    functions
 ----------------------------------------------------------------------------*/



#ifdef __cplusplus
}
#endif

#endif

/*----------------------------------------------------------------------------*/
/*! @} */   /* end of groupMW_WGL_ICON*/
/*----------------------------------------------------------------------------*/


