/** @file * GEL text related control API. * * @author mandy.wu 2010/08/31 (Add new marquee style GEL_MARQUEE_CIRCLE) * @author tzungming.lin * @version 0.1 */ #ifndef __GEL_TEXT__ #define __GEL_TEXT__ #include "device_font.h" /** Dynamic string types. */ typedef enum { GEL_DYN_STR_NATIVE, /**< Follow the code page for static string */ GEL_DYN_STR_EPG, /**< Dynamic strings will be regarded as epg strings */ GEL_DYN_STR_UTF8, /**< Dynamic strings will be regarded as utf8 strings */ GEL_DYN_STR_UTF16_LE, /**< Dynamic strings will be regarded as utf16 little endian strings */ GEL_DYN_STR_UTF16_BE, /**< Dynamic strings will be regarded as utf16 big endian strings */ GEL_DYN_STR_LAST } GEL_DynStrType_e; /** Marquee style. */ typedef enum GEL_Marquee_Style_e_ { GEL_MARQUEE_SCROLL_ONEWAY = 0, /**< */ GEL_MARQUEE_SCROLL = 0x10000000, /**< */ GEL_MARQUEE_ALTERNATE_ONEWAY =0x20000000, /**< */ GEL_MARQUEE_ALTERNATE = 0x30000000, /**< */ GEL_MARQUEE_CIRCLE = 0x40000000, /**< */ GEL_MARQUEE_MAX = 0x40000000 } GEL_Marquee_Style_e; /** Text alignment in horizontal. */ typedef enum { GEL_TEXT_ALIGN_LEFT = 0, /**< Left aligned */ GEL_TEXT_ALIGN_CENTER, /**< Center aligned */ GEL_TEXT_ALIGN_RIGHT, /**< Right aligned */ GEL_TEXT_ALIGN_CP_DIR, /**< Codepage display direction aligned */ GEL_TEXT_ALIGN_LAST } GEL_TextAlign_e; /** Border text style. */ typedef enum { GEL_TEXT_BORD_THIN = 0, /**< Thin text border */ GEL_TEXT_BORD_MIDDLE, /**< Middle text border */ GEL_TEXT_BORD_THICK, /**< Thick text border */ GEL_TEXT_BORD_LAST } GEL_TextBordType_e; typedef enum { GEL_TEXT_STYLE_NORMAL = 0, GEL_TEXT_STYLE_BOLD, GEL_TEXT_STYLE_ITALIC, GEL_TEXT_STYLE_BOLD_ITALIC, GEL_TEXT_STYLE_BORDERING, GEL_TEXT_STYLE_LAST } GEL_TextStyle_e; typedef enum { GEL_TEXT_END_NO_POINT = 1, // Sync. value with DrawPoint_e GEL_TEXT_END_THREE_POINT, GEL_TEXT_END_NOT_ENOUGH, GEL_TEXT_END_STYLE_LAST } GEL_TextEndStyle_e; typedef enum { GEL_AALEVEL_NONE = 0, GEL_AALEVEL_4, GEL_AALEVEL_8, GEL_AALEVEL_FULL, GEL_AALEVEL_LAST } GEL_AALevel_e; /** GEL text info struct */ typedef struct { BOOLEAN bDrawBorder; /**< Draw border or not. */ UINT8 bBordColor; /**< The color index value for text border. */ UINT8 bTextFgColor; /**< The color index value for text foreground filling. */ UINT8 bTextBgColor; /**< The color index value for text background filling. */ #if 0 UINT32 dFontSize; /**< The font size to be used. */ #else FontStyle_e eFontStyle; /**< The font style to be used. */ #endif GEL_TextAlign_e eTextAlign; /**< The text alignment style. */ GEL_TextBordType_e eBordType; /**< The type of text border. */ } GEL_TextInfo_t; /** Vector font infor struct */ typedef struct { FONTSize_t bFontSize; /**< The font size in 'pt' (only support for vector font config). */ GEL_TextStyle_e eTextStyle; /**< The text style to be applied */ GEL_AALevel_e eAALevel; /**< Grayscale color levels for AA. */ GEL_AAEntry_t* pStartIndices; /**< List of start indices of each group. */ UINT8 bAAGroupNum : 4;/**< Number of groups of grayscale colors for AA. */ UINT8 bAAGroupIdx : 4;/**< Index of desired group. */ UINT8 bAADisable : 4;/**< Force disable AA effect. If true, AA is disabled. */ UINT8 bGenPal : 4;/**< Generate palette from vfont or not. */ } GEL_VFInfo_t; #ifdef CONFIG_ENABLE_UMF_LANGUAGE_MODULES typedef INT32 (*LoadLangfun)(INT8 eLangName); void GEL_RegLoadGlobalLangCB (LoadLangfun fun); #endif /** * Set font information to GUI engine. * * @param pFontInfo Pointer of the font information array generated by tool. * @param dFontBlockNum The font block number generated by tool. * @param dFontSizeNum The font size number generated by tool. * @param bLangNum The language number generated by tool. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_SetFontInfo(FONTInfo_t *pFontInfo, UINT32 dFontStyleNum, OSDStringInfo_t *pStr, UINT16 usStrIDNum, UINT8 ucBasicBmpSize, UINT8 ucLangNum, UINT8 ucCharSpacing)__attribute__ ((warn_unused_result)); /** * Set global language information to the whole project. * * @param sdLangName The language name to be set for global settings. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_SetGlobalLang (UiLANGName_t sdLangName)__attribute__ ((warn_unused_result)); /** * Get global language information to the whole project. * * @param sdLangName Returned language name. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_GetGlobalLang (UiLANGName_t *sdLangName)__attribute__ ((warn_unused_result)); /** * Set current language information of specific menu/popup. */ GUIResult_e GEL_SetLang(WinControl_t *pWinCtrl, UiLANGName_t eLangName); /** * Get current language information of specific menu/popup. * * @param pWinCtrl A WinControl_t pointer to a WINDOW/POPUP. * @param pLangInfo Returned language information. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_GetLang(WinControl_t *pWinCtrl, UiLANGName_t *pLangInfo)__attribute__ ((warn_unused_result)); /** * Set string type of dynamic strings. * GUI engine will display dynamic strings according to the set type. * * @param pHandle Handle to a control object. * @param eStringType The string type to be set (DYNStringType_t). * @return GUI_SUCCESS if succeed, error codes otherwise. * @see GEL_GetStrType() */ GUIResult_e GEL_SetStrType (HWND pHandle, GEL_DynStrType_e eStringType)__attribute__ ((warn_unused_result)); /** * Get string type of dynamic strings. * GUI engine will display dynamic strings according to the set type. * * @param pHandle Handle to a control object. * @param pStringType Return the current dynamic string type to be regarded as. * @return GUI_SUCCESS if succeed, error codes otherwise. * @see GEL_SetStrType() */ GUIResult_e GEL_GetStrType (HWND pHandle, GEL_DynStrType_e *pStringType)__attribute__ ((warn_unused_result)); /** * Get string data from a static string id. * * @param sdstrId A valid string id in the string list. * @param ppStr Pointer to a pointer of a string. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_GetStr(String_id_t sdstrId, UINT8 **ppStr)__attribute__ ((warn_unused_result)); /** * Get string width and height according to the font configuration. * * @param pStr Pointer to a string. * @param pstTextInfo Text info of the string. * @param pWidth Return the string width. * @param pHeight Return the string height. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_GetStrSize(UINT8 *pStr, GEL_TextInfo_t *pstTextInfo, UINT16 *pWidth, UINT16 *pHeight)__attribute__ ((warn_unused_result)); #if 0 /** * Set marquee fps(frame per second). * * @param bFps Fps for marquee to be set. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_SetMarqueeFps(UINT8 bFps)__attribute__ ((warn_unused_result)); #endif /** * Set marquee fps(frame per second) and move step. * * @param bFps Fps for marquee to be set. * @param step move step. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_SetMarqueeFpsAndStep(UINT8 bFps, INT16 step)__attribute__ ((warn_unused_result)); /** * Set marquee style to a specific control. * * @param pHandle Handle to a control object. * @param eStyle The marquee style to be set. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_SetMarqueeStyle(HWND pHandle, GEL_Marquee_Style_e eStyle)__attribute__ ((warn_unused_result)); /** * Release ebook related buffer. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_EBK_Finalize(void)__attribute__ ((warn_unused_result)); /** * Accumulate the total lines according to the input string. This function would run on * caller's task. * * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style. * @param pString Desired string buffer. * @return GUI_SUCCESS if success, error codes otherwise. */ GUIResult_e GEL_EBK_AccumPages(HWND handle, UINT8* pString,UINT32 bufferindex)__attribute__ ((warn_unused_result)); /** * Reset the related attributes. Note that this function would ignore ebk_info->bSync flag. * * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style. * @return GUI_SUCCESS if success, error codes otherwise. */ GUIResult_e GEL_EBK_Reset(HWND pHandle)__attribute__ ((warn_unused_result)); /** * Perform ebook goto-page functionality. This function would run on * caller's task. * * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style. * @param dPage Desired page number. * @param sdBufIndex Returned buffer index related to text file. * @param bDataExist Returned flag that indicate whether the content of dPage exists in current loaded string buffer or not. * @return GUI_SUCCESS if success, error codes otherwise. */ GUIResult_e GEL_EBK_Goto(HWND pHandle, UINT32 dPage, INT32 *sdBufIndex, BOOLEAN *bDataExist)__attribute__ ((warn_unused_result)); GUIResult_e GEL_EBK_GetPageOffset(HWND handle, UINT32 dPage, UINT32 *pdFcpOffset,UINT32 *pdBufferIndex); GUIResult_e GEL_EBK_GetPagebyOffset(HWND handle, UINT32 dFcpOffset, UINT32 dBufferIndex, UINT32 *pdPage); /** * Check if given handle(textbox) is at synchronized condition. If not, * AP should reload the desired string buffer. * * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style. * @return TRUE or FALSE. */ BOOLEAN GEL_EBK_IsSync(HWND pHandle)__attribute__ ((warn_unused_result)); /** * AP notifies GUI engine that the data of buffer is synchronized now, and * engine would unlock the designate textbox. * * @param pHandle Handle to a CLASS_TEXT control widget with S_TXT_EBK style. * @return GUI_SUCCESS if success, error codes otherwise. */ UINT32 GEL_EBK_Notify(HWND handle, UINT8 *pString, UINT32 *Stroffset,UINT32 *sdBufIndex); // /** * Set how to show unknown character * * @param UnknownChar unknown character by user configuration * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e GEL_SetUnknownChar(UINT16 chUnknownChar)__attribute__ ((warn_unused_result)); // GUIResult_e GEL_EBK_Preview(HWND handle); typedef BOOL (*EBookGetPartialCode_t)(UINT8 *pSrcStr,UINT32 uiSrcBufLen, UINT32 *pOffset); void GEL_RegPartialCodeCheckCallBackFunc(EBookGetPartialCode_t pGEL_EbookPartialCodeCheckCallBackFunc); typedef UINT8* (*EBookConvert_t)(UINT8* pSrcStr, INT32* puiLen); void GEL_RegConvertCodeCallBackFunc(EBookConvert_t pGEl_EBook_ConvertCodeCallBackFunc); void GEL_UnRegConvertCodeCallBackFunc(void); void GEL_UnRegPartialCodeCheckCallBackFunc(void); #endif /* __GEL_TEXT__ */