/** @file * Header file for gel internal used functions. * * @author mandy.wu 2010/12/06 (Add duplicate controls' core struct) * @version 0.1 */ #ifndef __GEL_PRIVATE__ #define __GEL_PRIVATE__ #include "gel_text.h" #include "device_font.h" #include "gl_types.h" #define GUIENG_MAX_BLIT_ID (0x7FFFFFFF) #define GUIENG_INVALID_BLIT_ID (-1) #define GUI_RENDER_STACK_SIZE (8192) #define GUI_RENDER_POLLING_STACK_SIZE (2048) #define KEEP_WIDGET_STYLE (0xFFE00000) #define KEEP_COMMON_STYLE (0x001FFFFF) #define GET_COMMON_STYLE(control) ((control)->c_style) #define GET_WIDGET_STYLE(control) ((control)->p_style) #define COMMON_STYLE(control) ((control)->c_style) #define WIDGET_STYLE(control) ((control)->p_style) /* 32 bits control flags for control rendering */ #define GENG_CF_PARENT_STATE (0x000000FF) // parent's state #define GENG_CF_CLEAR_BG (0x100 << 2) //0x400 #define GENG_CF_RGNBUF_PAINT (0x100 << 3) //0x800 #define GENG_CF_BORDER_PAINT (0x100 << 4) //0x1000 #define GENG_CF_FLIP_HORIZ (0x100 << 5) //0x2000 /* Marquee internal control */ #define GENG_MARQUEE_ALTERNATE_FORWARD (0x1000000) #define GENG_MARQUEE_ALTERNATE_BACKWARD (0x1000000 << 1) #define GENG_MARQUEE_ALTERNATE_IN_BITS (0x3000000) // internal control bits /* Animation controls */ #define MARQUEE_BUF_BPP (8) #define MARQUEE_BUF_FORMAT (PF_LUT8) #define MAX_TIMER_ACCUMULATOR (0xFFFF) #define GENG_TIMER_PERIOD (50) //50 ms //#define WM_MARQUEE (WM_MSG_MAX - 1) /* Value checking */ #define GENG_MAX_UINT8_VALUE (0xFF)// The max INT8 value limitation #define GENG_MAX_INT16_VALUE (0x7FFF)// The max INT16 value limitation /* The max supported bar size for SCROLL bar */ #define GENG_MAX_BAR_RESIZE_H (1920) // The max bar resized total size in horizontal #define GENG_MAX_BAR_RESIZE_V (1080) // The max bar resized total size in vertical /* Render sleep control */ #define GENG_RENDER_SLEEP (2) #define STR_LINE_LIMIT (64) // Line limitation for direct rendering. /* Multiline textbox buffer size definition */ #define TXT_BUF_SIZE_BOUND (1024) // 1K, size limit of a string buffer. #define FOCUSED_STR_BORDER_OFFSET_LEFT (8) #define FOCUSED_STR_BORDER_OFFSET_RIGHT (16) typedef struct _GENG_Vector_Font_Info_t { GEL_TextStyle_e eTextStyle; FONT_AA_Info_t stAAInfo; FONTSize_t bFontSize; } GENG_VFInfo_t; /* Text attributes description */ typedef struct _GENG_TextInfo_t { UINT8 bTextAlign; // The text alignment style UINT8 bFixCharWidth; // Fix char width, disabled if equals to 0. FontStyle_e eFontStyle; // Font style, an enumeration value. BOOLEAN bDrawBorder; // Draw border or not. BOOLEAN bEpg; // This is an EPG string or not. BOOLEAN bStatic; // If it is a static string. GEL_TextBordType_e eBordType; // The type of the text border. GENG_VFInfo_t *pVFInfo; // Informations about vector font. } GENG_TextInfo_t; typedef struct _GENG_TxtColor_t{ UINT8 bFgColor; // The index value of text filling color. UINT8 bBgColor; // The index value of text bg color. UINT8 bBordColor; // The index value of text border color. } GENG_TxtColor_t; typedef struct _GENG_PgrhInfo_t { LANGName_t stEpgCodepage; // To indicate epg string codepage. UINT8 bRowSpace; // The row spacing to be applied when rendering. UINT8 bFixLineHeight; // The fix line height to be applied when rendering. UINT16 wMaxLineNum; // The limitation of the max line number of the paragraph. INT16 swCurrLine; // Indicate the line index of the current page. } GENG_PgrhInfo_t; typedef struct _GENG_StrBuf_t { UINT8 *pAddr; UINT16 wWidth; UINT16 wHeight; UINT16 wXOffset; // Real char start offset x UINT16 wYOffset; // Real char start offset y } GENG_StrBuf_t; /* Control of GUI render task/ queue/ timer */ typedef struct gui_engine_core_t_ { //Queue Handle GL_Queue_t queueHandle; //Semaphores GL_Semaphore_t timerSemaphore; GL_Semaphore_t dataAccessSemaphore; GL_Semaphore_t textPreparseSemaphore; // TODO: 12/01 //Mutex GL_Mutex_t sendMsgMutex; //Task Handle GL_Task_t taskHandle; GL_Task_t timerTaskHandle; // Timer GL_Timer_t timer; // Others UINT8 bGuiengBreakCondition; UINT8 bGuiTimerProcessBreakCondition; UINT8 bGuiengInitFlg; UINT8 bGuiTimerInitFlg; } GuiEngCore_t; /* Control of animation registr */ typedef struct _animation_register_t { LIST link; HWND handle; BOOLEAN bActive; } AnimReg_t; /* Global variable */ extern GuiEngCore_t *gpGuiEngCore; extern LISTHEAD gClassList; extern LISTHEAD gAnimList; extern HWND gRootWindow; extern HWND gActiveWindow; // blit id control extern INT32 gBlitId; extern INT32 gCurrFinishBlitId; // rendering delay control extern BOOLEAN gbRenderSleep; // string buffer extern DRAWDRIVER ddriver; /* Subtitle related variables */ extern BOOLEAN gbSubDraw; extern UINT8 gbSubLineSpacing; extern UINT8 gbSubCharSpacing; /* Register a specific class of widgets. */ GUIResult_e register_class_background(void); GUIResult_e register_class_icon(void); GUIResult_e register_class_text(void); GUIResult_e register_class_animation(void); GUIResult_e register_class_border(void); GUIResult_e register_class_button(void); GUIResult_e register_class_button_group(void); GUIResult_e register_class_listview(void); GUIResult_e register_class_progress(void); GUIResult_e register_class_scroll(void); GUIResult_e register_class_combo(void); GUIResult_e register_class_edit(void); /* Set params to a menu or popup menu. */ GUIResult_e set_params_class_menu(HWND handle, ParamType_e eParamType, void *pParam); /* Set params to a specified class of widgets. */ GUIResult_e set_params_class_background(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_icon(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_text(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_animation(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_border(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_button(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_button_group(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_listview(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_progress(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_scroll(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_combo(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e set_params_class_edit(HWND handle, ParamType_e eParamType, void *pParam); /* Get params from a specified class of widgets. */ GUIResult_e get_params_class_background(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_icon(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_text(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_animation(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_border(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_button(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_button_group(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_listview(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_progress(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_scroll(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_combo(HWND handle, ParamType_e eParamType, void *pParam); GUIResult_e get_params_class_edit(HWND handle, ParamType_e eParamType, void *pParam); /* Add menu offset to a specified class of widgets. */ void add_menu_offset_class_background(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_icon(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_text(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_animation(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_border(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_button(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_button_group(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_listview(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_progress(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_scroll(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_combo(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); void add_menu_offset_class_edit(HWND pHandle, INT16 wMenuOffsetX, INT16 wMenuOffsetY); /* Create duplicate core struct to a specified class of widgets. */ GUIResult_e create_core_struct_class_background(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_icon(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_text(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_animation(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_border(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_button(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_button_group(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_listview(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_progress(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_scroll(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_combo(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e create_core_struct_class_edit(WinControl_t *pDefaultWinCtl, HWND handle); /* Destroy duplicate core struct to a specified class of widgets. */ GUIResult_e destroy_core_struct_class_background(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_icon(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_text(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_animation(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_border(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_button(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_button_group(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_listview(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_progress(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_scroll(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_combo(WinControl_t *pDefaultWinCtl, HWND handle); GUIResult_e destroy_core_struct_class_edit(WinControl_t *pDefaultWinCtl, HWND handle); /** * Find if a class is a registed type of widget control. * * @param eClassType The class of the widget control * @return Structure of WNDCLASS */ PWNDCLASS gel_find_class(ClassType_e eClassType); /** * Register a class of widget control. * * @param pWinClass Pointer to the structure WNDCLASS * @return SUCCESS if succeed, error codes of FAILURE otherwise. */ GUIResult_e gel_register_class(const WNDCLASS *pWinClass); /** * Unregister a class of widget control. * * @param eClassType The class of the widget control * @return SUCCESS if succeed, error codes of FAILURE otherwise. */ GUIResult_e gel_unregister_class(ClassType_e eClassType); /** * Check a class whether is in registered class list. * * @param pWinClass Pointer to the structure WNDCLASS * @return SUCCESS if succeed, error codes of FAILURE otherwise. */ GUIResult_e gel_check_class_validity(const WNDCLASS *pWinClass); /** * Check gAnimList to ensure if the given handle is already in the anim list. * * @param pHandle The handle of an animation control to be checked. * @return The pointer of the registration node if the handle is already registered. */ AnimReg_t* gel_find_animation(HWND pHandle); /** * Register an animation to gAnimList. * * @param pAnimReg The pointer to the registration information. */ void gel_register_animation(AnimReg_t *pAnimReg); /** * Unregister an animation to gAnimList. * * @param pAnimHandle The handle of an animation to be unregistered. */ void gel_unregister_animation(HWND pAnimHandle); /** * Enable/disable the animation in the gAnimList. * * @param pAnimHandle The handle of an animation. * @param bEnable Whether to enable the animation. */ void gel_set_anim_enable(HWND pAnimHandle, BOOLEAN bEnable); /** * Check the animation is active or not. * * @param pAnimHandle The handle of an animation. * @return TRUE if the animation is active, FALSE otherwise. */ BOOLEAN gel_check_anim_active(HWND pAnimHandle); /** * Fill the x, y, width and height to the specified RECT structure. * * @param pRect Pointer to a RECT structure. * @param swX X position. * @param swY Y position. * @param wWidth Width of the rectangle. * @param wHeight Height of the rectangle. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_set_rect(LPRECT pRect, INT16 swX, INT16 swY, UINT16 wWidth, UINT16 wHeight); /** * Show all controls in a WINDOW/POPUP. * * @param pWinCtrl A WinControl_t pointer to a WINDOW/POPUP. * @param dControlFlags Control flags for the rendering. * @param bDirect Direct rendering or send msg. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_show_window(WinControl_t *pWinCtrl, UINT32 dControlFlags, BOOLEAN bDirect); /** * Create a control handle. * * @param pstControl The pointer of WinControl_t to a control. * @param pParentHandle The HWND pointer to the control's parent menu. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_create_handle(WinControl_t *pstControl, HWND pParentHandle); /** * Destroy a control handle. * * @param pHandle The handle of a control to be destroyed. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_destroy_handle(HWND pHandle); /** * Private message sending function used by GUI Engine internal. * * @param pHandle The handle of a region. * @param dMsg Pointer to the structure WNDCLASS (to get message) * @param dParam1 Parameters for the extra infomation * @param dParam2 Parameters for the extra infomation * @param bUrgent Boolean value that indicates it is an urgent message or not. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_send_update_message(RegionHandle_t sdRegionHandle, UINT32 dMsg, UINT32 dParam1, UINT32 dParam2, BOOLEAN bUrgent); /** * Private message sending function used by GUI Engine internal. * * @param pHandle The handle of a control. * @param dMsg Pointer to the structure WNDCLASS (to get message) * @param dControlFlags Parameters for the extra infomation * @param dInputKey Parameters for the extra infomation * @param bUrgent Boolean value that indicates it is an urgent message or not. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_send_message(HWND pHandle, UINT32 dMsg, UINT32 dControlFlags, UINT32 dInputKey, BOOLEAN bUrgent); /** * Create a duplicate control data structure. * * @param pDefaultWinCtl Pointer to the default win control struct. * @param pHandle Pointer to the control's handle. */ GUIResult_e gel_CreateDuplControl(WinControl_t *pDefaultWinCtl, HWND pHandle); /** * Destroy the duplicate control data structure. * * @param pDuplWinCtl Pointer to the duplicate win control struct. * @param pHandle Pointer to the control's handle. */ GUIResult_e gel_DestroyDuplControl(WinControl_t *pDuplWinCtl, HWND pHandle); /** * Draw a string to an OSD region. * * @param pstHdc The pointer to the target dc handle. * @param pStr The string data. * @param eStrType The encoded type of the string. * @param pstTextInfo The text rendering info of the string. * @param pstVFInfo The vector font related settings. * @param pStrRect The area of the OSD region to be rendered the string to. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_DrawString(HDC pstHdc, UINT8 *pStr, GEL_DynStrType_e eStrType, GEL_TextInfo_t *pstTextInfo, GEL_VFInfo_t *pstVFInfo, PRECT pStrRect, INT32 *pBlockId); /** * Draw a bitmap to an OSD region. * * @param pstHdc The pointer to the target dc handle. * @param pstBitmapHandle The string data. * @param dFlags The flag to indicate the bmp rendering style. * @param pstSrcRect The pointer to a rect area of the source bitmap to be blited. * @param pstDstRect The pointer to a rect area of the OSD region to be blited to. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_DrawBitmap(HDC pstHdc, GEL_BitmapHandle_t *pstBitmapHandle, UINT32 dFlags, PRECT pstSrcRect, PRECT pstDstRect, INT32 *pBlockId); /** * Fill a color to the rect area of an OSD region. * * @param pstHdc The pointer to the target dc handle. * @param stColor The color to be filled with. * @param pstDstRect The pointer to a rect area of the OSD region to be rendered to. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_FillRect(HDC pstHdc, GEL_Color_t stColor, PRECT pstDstRect, INT32 *pBlockId); /** * draw hole rect area of an OSD region. * * @param pstHdc The pointer to the target dc handle. * @param nLineWidth The line width to be drawed with. * @param pstDstRect The pointer to a rect area of the OSD region to be rendered to. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_DrawHoleRectangle(HDC pstHdc, PRECT pstDstRect, UINT16 nLineWidth, INT32 *pBlockId, INT32 isEvenAlign); /** * Draw a line between two points of an OSD region. * * @param pstHdc The pointer to the target dc handle. * @param stColor The color to be filled with. * @param swX1 The x coordinate of the start point. * @param swY1 The y coordinate of the start point. * @param swX2 The x coordinate of the end point. * @param swY2 The y coordinate of the end point. * @param wThickness The thickness of a line. * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_DrawLine(HDC pstHdc, GEL_Color_t stColor, INT16 swX1, INT16 swY1, INT16 swX2, INT16 swY2, UINT16 wThickness, INT32 *pBlockId); /** * Enable or Disable OSD. * * @param ShowOS * @return GUI_SUCCESS if succeed, error codes otherwise. */ GUIResult_e gel_SetDispaly(HDC pstHdc, BOOL ShowOSD); #endif /* __GEL_PRIVATE__ */