/* 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_bdr_timg.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_BDR_TIMG   Bord Template Image Widget  
 *
 *  @ingroup groupMW_WGL
 *  @brief Provides definitions and exported function of the widget bord template image 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_BDR_TIMG_H_
#define _U_WGL_BDR_TIMG_H_
 
/*-----------------------------------------------------------------------------
                    include files
 ----------------------------------------------------------------------------*/
#include "u_wgl_common.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-----------------------------------------------------------------------------
                    macros, defines, typedefs, enums
 ----------------------------------------------------------------------------*/
/* specific border commands for template image border */

/**This command is to set template image border style. 

Input arguments

pv_param1      -Contains the styles of the border(UINT32).

Returns: 

WGLR_OK         -Routine successful.

WGLR_INV_ARG   -The styles combination is invalid
*/

#define WGL_CMD_BDR_TIMG_SET_STYLE              WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 0)   

/** This command is to get template image border style.

Output arguments:

pv_param1      -Contains the styles of the border(UINT32)

 Returns: 

WGLR_OK         -Routine successful.

WGLR_INV_ARG   -The styles combination is invalid
*/
#define WGL_CMD_BDR_TIMG_GET_STYLE              WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 1)   

/** This command is to set template image background image of special border. 

Input arguments

pv_param1       -Contains the background image set(WGL_IMG_INFO_T *).

Returns: 

WGLR_OK            -Routine successful.

WGLR_INV_ARG   -The image set information is invalid
*/
#define WGL_CMD_BDR_TIMG_SET_BK_IMG             WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 2)   

/** This command is to get template image background image of special border.

Output arguments

pv_param1       -Contains the background image set(WGL_IMG_INFO_T *).

Returns:

WGLR_OK            -Routine successful.

WGLR_INV_ARG   -The image set information is invalid
*/
#define WGL_CMD_BDR_TIMG_GET_BK_IMG             WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 3)   

/**  This command is to set template image title information of special border. 

Input arguments

pv_param1   - Contains the title infomation(WGL_BDR_TIMG_TITLE_INFO_T *).

Returns:

WGLR_OK            -Routine successful.

WGLR_INV_ARG   -The image titile set information is invalid
*/
#define WGL_CMD_BDR_TIMG_SET_TITLE_INFO         WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 4)   

/**This command is to get template image title information of special border.

Output arguments

pv_param1   - Contains the title infomation(WGL_BDR_TIMG_TITLE_INFO_T *).

Returns: 

WGLR_OK            -Routine successful.

WGLR_INV_ARG   -The image titile set information is invalid
*/
#define WGL_CMD_BDR_TIMG_GET_TITLE_INFO         WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 5)   

/**This command is to set template image title text information of special border. 

Input arguments

pv_param1   -(UTF16_T *) Contains the UTF16_T string of the title text,.If NULL, the title text will be cleared.

pv_param2   (UINT16) Contains the string length. If 0, the title text will be cleared.

Returns: 

WGLR_OK       -Routine successful.

WGLR_INV_ARG   -pv_param1 is NULL but pv_param2 is not 0 or <0; Other errors
*/
#define WGL_CMD_BDR_TIMG_SET_TITLE_TEXT         WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 6)   

/**This command is to get template image title text information of special border.

Output arguments

pv_param1   -(UTF16_T *) Contains the UTF16_T string of the title text,.If NULL, the title text will be cleared.

pv_param2   (UINT16) Contains the string length. If 0, the title text will be cleared.

Returns: 

WGLR_OK                 -Routine successful.

WGLR_INV_ARG         -The pv_param1 is NULL

WGLR_BUFFER_NOT_ENOUGH     -The buffer is not big enough
*/
#define WGL_CMD_BDR_TIMG_GET_TITLE_TEXT         WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 7)   

/**This command is to set template image icon information of special border. 

Input arguments

pv_param1   -(WGL_BDR_TIMG_ICON_INFO_T *) Contains the icon info

Returns: 

WGLR_OK       -Routine successful.

WGLR_INV_ARG    -(1)pv_param1 is NULL, (2) the icon info is invalid
*/
#define WGL_CMD_BDR_TIMG_SET_ICON_INFO          WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 8)   

/**This command is to get template image icon information of special border. 

Output arguments

pv_param1   -(WGL_BDR_TIMG_ICON_INFO_T *) Contains the icon info

Returns:

WGLR_OK         Routine successful.

WGLR_INV_ARG    The pv_param1 is NULL
*/
#define WGL_CMD_BDR_TIMG_GET_ICON_INFO          WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 9)   

/**
This command is to set template image icon.

Input arguments

pv_param1   -(WGL_IMG_INFO_T *) Contains the image info of the icon
                       if NULL, the image info of the icon will be cleared
 
Output arguments

 Returns:

 WGLR_OK         Routine successful.

 WGLR_INV_ARG    The image info is invalid
 */
#define WGL_CMD_BDR_TIMG_SET_ICON               WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 10)  

/**This command is to get template image icon.

Input arguments

pv_param1      -(WGL_IMG_INFO_T *) Contains the image info of the icon.
                              if NULL, the image info of the icon will be cleared
Returns: 

WGLR_OK         Routine successful.

WGLR_INV_ARG    The image info is invalid
*/
#define WGL_CMD_BDR_TIMG_GET_ICON               WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 11)  


/**  This command is to set external template image title information of special border,it will used
when this bord titile is focused.

Input arguments

pv_param1   - Contains the title infomation(WGL_BDR_TIMG_TITLE_INFO_T *).

Returns:

WGLR_OK            -Routine successful.

WGLR_INV_ARG   -The image titile set information is invalid
*/
#define WGL_CMD_BDR_TIMG_SET_TITLE_INFO_EX         WGL_MAKE_BORDER_CMD(WGL_BORDER_TIMG, 12)   


/**It specific text color targets for template image border .

Input arguments:
        None.
        
Output arguments:
        None.
        
Returns:WGLR_OK             -
*/
#define WGL_CLR_BDR_TIMG_TITLE_TEXT             (WGL_CLR_WGT_SPF_START+21)   

/**It specific text background color targets for template image border .

Input arguments
        None.

Output arguments
        None.

Returns:WGLR_OK             -
*/
#define WGL_CLR_BDR_TIMG_TITLE_TEXT_BK          (WGL_CLR_WGT_SPF_START+22)   

/*-----------------------------------------------------------------------------
                    structures
 ----------------------------------------------------------------------------*/
/* styles */
#define WGL_STL_BDR_TIMG_NO_IMG_UI              MAKE_BIT_MASK_32(0)    /**< The style indicate that border has no image.*/
#define WGL_STL_BDR_TIMG_NO_BK                  MAKE_BIT_MASK_32(1)    /**<The style indicate that border has no background.*/
#define WGL_STL_BDR_TIMG_NO_SMART_CUT           MAKE_BIT_MASK_32(3)    /**<The style indicate that title need no smart cut when too long.*/

#define WGL_STL_BDR_TIMG_LAST_STYLE             WGL_STL_BDR_TIMG_NO_BK    /**<The last style.*/

/* title information */
#define WGL_BDR_TIMG_TITLE_STL_TRANSP_BK        MAKE_BIT_MASK_16(0)    /**<It iddicate thate title of template image border uses transparent background style.*/
#define WGL_BDR_TIMG_TITLE_STL_LAST_STYLE       WGL_BDR_TIMG_TITLE_STL_TRANSP_BK    /**<It indcate the last style.*/
/*------------------------------------------------------------------*/
/*! @struct  WGL_BDR_TIMG_TITLE_INFO_T
 *  @brief This struct contain title information of template image border.
 *  @code
 *  typedef struct _WGL_BDR_TIMG_TITLE_INFO_T
 *  {
 *      UINT16                  ui2_style;
 *      WGL_FONT_INFO_T         t_font;
 *      GL_RECT_T               t_rc_ref;
 *      UINT8                   ui1_align;
 *  } WGL_BDR_TIMG_TITLE_INFO_T;
 *  @endcode
 *  @li@c  ui2_style                       -Contain the style of template image border
 *  @li@c  t_font                           -Contain the font information.
 *  @li@c  t_rc_ref                         -The resource reference region.
 *  @li@c  ui1_align                       -Contain align information.
 */
/*------------------------------------------------------------------*/
typedef struct _WGL_BDR_TIMG_TITLE_INFO_T
{
    UINT16                  ui2_style;
    WGL_FONT_INFO_T         t_font;
    GL_RECT_T               t_rc_ref;
    UINT8                   ui1_align;
    
} WGL_BDR_TIMG_TITLE_INFO_T;

/* icon information */
/*------------------------------------------------------------------*/
/*! @struct WGL_BDR_TIMG_ICON_INFO_T
 *  @brief This strcut contains icon information of template image border.
 *  @code
 *  typedef struct _WGL_BDR_TIMG_ICON_INFO_T
 *  {
 *      GL_RECT_T               t_rc_ref;
 *      UINT8                   ui1_align;
 *  } WGL_BDR_TIMG_ICON_INFO_T;    
 *  @endcode
 *  @li@c  t_rc_ref                   -Contain the resource reference reggion information.
 *  @li@c  ui1_align                 -Contains align information.
 */
/*------------------------------------------------------------------*/
typedef struct _WGL_BDR_TIMG_ICON_INFO_T
{
    GL_RECT_T               t_rc_ref;
    UINT8                   ui1_align;
} WGL_BDR_TIMG_ICON_INFO_T;    

#ifdef __cplusplus
}
#endif
                         
#endif
/*----------------------------------------------------------------------------*/
/*! @} */   /* end of groupMW_WGL_BDR_TIMG*/
/*----------------------------------------------------------------------------*/


