123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- /** @file
- * Header file for some utility functions.
- *
- * @author mandy.wu 2010/12/06 (Add duplicate controls' core struct)
- * @author tzungming.lin 2009/09/28 (Control/Child scaling)
- * @version 0.1
- */
- #ifndef _GUIENG_UTIL
- #define _GUIENG_UTIL
- #include "gl_types.h"
- #include "stddefs.h"
- #include "datatypes.h"
- #include "gui_engine.h"
- #define GENG_SET_ALIGN(oriAlign, hAlign) oriAlign = ((oriAlign & ~FONT_ALIGN_MASK) | hAlign)
- #define GENG_SET_V_ALIGN(oriAlign, vAlign) oriAlign = ((oriAlign & ~FONT_V_ALIGN_MASK) | vAlign)
- #define CHECK_DISLIST(list,total) \
- if( (list) == NULL && (total) > 0 ) \
- { \
- ERROR(PRINT("%s: Disabled list is NULL\n", __FUNCTION__)); \
- return; \
- } \
- else if( (total) == 0 ) \
- return;
- #define BAK_REGION_INFO(sdHandle, stOriArea) \
- { \
- stOriArea = gRegionDetails[sdHandle].rect; \
- }
- #define RESTORE_REGION_INFO(sdHandle, stOriArea) \
- { \
- gRegionDetails[sdHandle].rect = stOriArea; \
- }
- /** Transparent color. */
- extern const Color_t gTransColor;
- /** icon_info_t with ICON_ID_INVALID of each state. */
- extern const icon_info_t gInvalidIcon;
- /** color_info_t with transparent color of each state. */
- extern const color_info_t gTransColorInfo;
- /** text_color_info_t with transparent color of each state. */
- extern const text_color_info_t gTransTextColorInfo;
- /**************************************************************************/
- /* Accessors. */
- /**************************************************************************/
- /**
- * Get a 4-byte-aligned width from the input image data.
- *
- * @param pstImgData Pointer to the target image data.
- * @return A 4 bytes aligned width for a bitmap.
- */
- UINT16 GUIENG_GetBmpAlignedWidth(const PIMAGEHDR pstImgData);
- /**
- * Get parent with type of CLASS_WINDOW or CLASS_POPUP.
- *
- * @param handle Handle of a control.
- * @return Pointer to the handle of parent menu/popup.
- */
- HWND GUIENG_GetParentMenu(HWND handle);
- /**
- * Get font style enum value according to the state of widget
- *
- * @param pstCtrl Control of target widget.
- * @param dState Specific state.
- * @return Font style enumeration value.
- */
- FontStyle_e GUIENG_GetFontStyle(WinControl_t *pstCtrl, UINT32 dState);
- /**
- * Get font size according to the state of widget
- *
- * @param pstCtrl Control of target widget.
- * @param dState Specific state.
- * @return Font size in pt(or pixel).
- */
- FONTSize_t GUIENG_GetFontSize(WinControl_t *pstCtrl, UINT32 dState);
- #define GUIENG_GetEndStyle(control) ((GET_WIDGET_STYLE(control) & S_TXT_END_MASK) >> 4)
- /**
- * Get text style.
- * @param pstCtrl Control of target control.
- * @return Text style enum value.
- */
- GEL_TextStyle_e GUIENG_GetTextStyle(WinControl_t *pstCtrl);
- /**
- * Get text style of button group or listview.
- * @param pstCtrl Control of target control.
- * @param dState Desired state of the control.
- * @return Text style enum value.
- */
- GEL_TextStyle_e GUIENG_GetGroupTextStyle(WinControl_t *pstCtrl, UINT32 dState);
- /**
- * Get AA information from the style of parent control.
- *
- * @param handle Handle to a control.
- * @param pstTextInfo Text information structure.
- * @return GUI_SUCCESS if succeed, error code otherwise.
- */
- GUIResult_e GUIENG_GetAAInfo(HWND handle, GENG_TextInfo_t *pstTextInfo);
- /**
- * Get font alignment(horizontal and vertical) according to the style of a widget.
- *
- * @param dStyle Common style of a widget.
- * @return Result alignment flag.
- */
- UINT8 GUIENG_GetFontAlign(UINT32 dCommStyle);
- /**************************************************************************/
- /* Basic drawing functions. */
- /**************************************************************************/
- /**
- * Draw child controls to be background extension.
- *
- * @param hdc Handle of device context.
- * @param handle Handle of parent control.
- * @param dParentState State of the parent control.
- */
- void GUIENG_DrawChildBg(HDC hdc, HWND handle, UINT32 dParentState, UINT32 parentParam);
- /**
- * Draw child controls to be the border.
- *
- * @param hdc Handle of device context.
- * @param handle Handle of parent control.
- * @param dParentState State of the parent control.
- */
- void GUIENG_DrawChildBorder(HDC hdc, HWND handle, UINT32 dParentState, UINT32 parentParam);
- /**
- * Draw the background color of the parent, not the whole widget.
- *
- * @param hdc Handle to the device context.
- * @param stTargetRect Rectangle of the parent.
- * @param stColor Color of background.
- */
- void GUIENG_FillDesignateColor(HDC hdc, RECT stTargetRect, Color_t stColor, INT32 *pBlockId);
- /**
- * Draw background icon of a widget.
- *
- * @param hdc Handle to a device context.
- * @param pstTargetRect Target rectangle area.
- * @param swIconId Icon id of background icon.
- * @param wSideSize Side size of background icon.
- * @param pDynPal Dynamic set source palette.
- * @param dStyle Style of this widget.
- */
- void GUIENG_DrawBgIcon(HDC hdc, PRECT pstTargetRect , INT16 swIconId,
- UINT16 wSideSize, PALENTRY *pDynPal, UINT32 dStyle, INT32 *pBlockId);
- /**************************************************************************/
- /* Marquee Related APIs. */
- /**************************************************************************/
- /**
- * Create a temp buffer to draw the prepared foreground for marquee style.
- *
- * @param hdc Handle to a device context.
- * @param pstControl Pointer to a WinControl_t of the control.
- * @return GUI_SUCCESS if succeed, error codes otherwise.
- */
- GUIResult_e GUIENG_CreateMarqueeFgBuf(HDC hdc, WinControl_t *pstControl);
- /**
- * Create a buffer to backup the background of a marquee.
- *
- * @param hdc Handle to a device context.
- * @param pstControl Pointer to a WinControl_t of the control.
- * @param pstMarqInfo Pointer to a marquee information of target control.
- * @param pstBgRect The background rect to be backup.
- * @param dControlFlags To indecate if its a region buffer rendering.
- * @return GUI_SUCCESS if succeed, error codes otherwise.
- */
- GUIResult_e GUIENG_CreateMarqueeBgBuf(HDC hdc, WinControl_t *pstControl, marquee_info_t *pstMarqInfo,
- PRECT pstBgRect, UINT32 dControlFlags);
- /**
- * Destroy the foreground buffer of animation.
- *
- * @param hdc Handle to a device context.
- * @param pstMarqInfo Pointer to a marquee information of target control.
- */
- void GUIENG_DestroyMarqueeFgBuf(HDC hdc, marquee_info_t *pstMarqInfo);
- /**
- * Destroy the bakcground of an animation/marquee.
- *
- * @param hdc Handle to a device context.
- * @param pstControl Pointer to a WinControl_t of the control.
- * @param pstMarqInfo Pointer to a marquee information of target control.
- */
- void GUIENG_DestroyMarqueeBgBuf(HDC hdc, WinControl_t *pstControl, marquee_info_t *pstMarqInfo);
- /**
- * Draw foreground text to perform marquee effect.
- *
- * @param hdc Handle to the device context.
- * @param handle Handle to the control.
- * @param marquee Pointer to a marquee information.
- * @param wTextWidth Width of area of foreground text.
- * @param pstBgColor Background color of the specific text position.
- */
- void GUIENG_DrawMarquee(HDC hdc, HWND handle, marquee_info_t *marquee, UINT16 wTextWidth, color_info_t *pstBgColor, INT32 *pBlockId);
- /**************************************************************************/
- /* Boolean functions. */
- /**************************************************************************/
- /**
- * Check if there exists transparent color in all states of the input color info
- *
- * @param eRgnFormat Region format.
- * @param pstColor Colors of each state.
- * @return TRUE if it contains transparent color, FALSE otherwise.
- */
- BOOLEAN GUIENG_ContainTransparentBg(PixelFormat_e eRgnFormat, color_info_t *pstColor);
- /**
- * Check if there exists transparent color in a prog_color_t.
- *
- * @param eRgnFormat Region format.
- * @param pstProgColor Colors of each state of progress bar/scroll bar.
- * @return TRUE if it contains transparent color, FALSE otherwise.
- */
- BOOLEAN GUIENG_ContainTransparentBarBg(PixelFormat_e eRgnFormat, prog_color_t *pstProgColor);
- /**
- * Check if input parent control has child icon or not.
- *
- * @param parent Handle of parent control
- * @return TRUE if it has at least one child icon, FALSE otherwise.
- */
- BOOLEAN GUIENG_HasChildIcon(HWND parent);
- /**
- * Perform height scaling only.
- *
- * @param stArea Given area that needs to be scaling.
- * @param control Control of a widget.
- * @return GUI_SUCCESS if succeed, error codes otherwise.
- */
- GUIResult_e GUIENG_HeightScaling(PRECT stArea, WinControl_t *control);
- /**
- * Perform width scaling only.
- *
- * @param stArea Given area that needs to be scaling.
- * @param control Control of a widget.
- * @return GUI_SUCCESS if succeed, error codes otherwise.
- */
- GUIResult_e GUIENG_WidthScaling(PRECT stArea, WinControl_t *control);
- /**
- * Perform area scaling.
- *
- * @param stArea Given area that needs to be scaling.
- * @param control Control of a widget.
- * @return GUI_SUCCESS if succeed, error codes otherwise.
- */
- GUIResult_e GUIENG_AreaScaling(PRECT stArea, WinControl_t *control);
- void gel_WaitForMsgDone(void);
- void gel_WaitForSelfDone(HWND pHandle);
- /**************************************************************************/
- /* Move control related functions. */
- /**************************************************************************/
- INT32 GUIENG_4Bpp_FillBmp(RECT stSrcRect, RECT stDstRect, PIMAGEHDR pstImgData, UINT8* u8OutBuffer, UINT32 u32OutBufferLen);
- INT32 GUIENG_4Bpp_HasSideSize_Hrepeate(RECT stSrcRect, RECT stDstRect, PIMAGEHDR pstImgData, UINT32 side, UINT8* u8OutBuffer, UINT32 u32OutBufferLen);
- void GUIENG_ChildScaling(HWND parent, RECT stChildPos[3]);
- void GUIENG_ChildRestorePos(HWND handle, RECT stChildPos[3]);
- INT32 text_GetHdc(HWND handle, HDC *hdc);
- void GUIENG_DrawFocusedStrBorder(HWND handle, TextInfo_t *pstTextInfo);
- void GUIENG_DrawFocusedBorder(HWND handle, RECT rect);
- INT32 GUIENG_SateToIndex(INT32 state);
- IMAGEHDR GUIENG_GetRepeatImageByID(HDC hdc, INT16 swIconId, UINT16 wSideSize, UINT32 dStyle, RECT destRect, PIMAGEHDR pTargetImage);
- IMAGEHDR GUIENG_GetRepeatImage(PIMAGEHDR pSrcImage, UINT16 sideSize, UINT32 dStyle, RECT destRect, PIMAGEHDR pTargetImage);
- #endif //#ifndef _GUIENG_UTIL
|