MS_Icon.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:3k
- /* **************************************************************************************
- * Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: MS_Icon.c $
- *
- * Description:
- * ============
- * menu system icon menus handling
- *
- * Log:
- * ====
- ****************************************************************************************
- * Updates:
- ****************************************************************************************
- **************************************************************************************** */
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef _DEBUG
- #include "DebugDbgMain.h"
- #undef IFTRACE
- #define IFTRACE if (gTraceMenu)
- #endif //_DEBUG
- #include <stdio.h>
- #include <stdlib.h>
- #include "PlaycoreScPadscmgr.h"
- #include "Decoderosdrendr.h"
- #include "UIMenu_Sysosd_drv.h"
- #include "UIMenu_Sysms_wdgt.h"
- #include "UIMenu_Sysms_lib.h"
- static BYTE icon_bmp_bg_idx = 0;
- MS_UOP icon_user_op(MS_WIDGET *widget,MS_UOP uop,char param)
- {
- MS_ICON *icon = (MS_ICON *)widget;
- switch (uop)
- {
- case MS_UOP_DELETE:
- uop = MS_UOP_NOP;
- break;
- case MS_UOP_DISPLAY:
- if( NULL !=icon->icon_buff)
- if(! param )
- {
- OSD_DrawBitmap( widget->pos.x, widget->pos.y,
- icon->icon_buff ,
- #if defined(USE_BMP_BUTTON) && defined(USE_ICON_BUTTONS)
- 7,
- #else
- 0,
- #endif
- 0);
- }
- else
- {
- OSD_DrawBitmap(widget->pos.x, widget->pos.y,
- icon->icon_buff ,
- icon_bmp_bg_idx,
- FOCUS_COLOR ( widget->color) );
- }
- uop = MS_UOP_NOP;
- break;
- }
- return uop;
- }
- void MS_init_icon(MS_ICON *msi, MS_POS *pos, MS_COLOR color,
- void (* user_op)(MS_WIDGET *, MS_UOP, char),
- void *icon_buff, unsigned char attr)
- {
- #ifdef _DEBUG
- if (NULL == msi) {
- tr_printf(("FATAL: MS_init_icon() Failed: NULL control.n"));
- return;
- }
- #endif //_DEBUG
-
- ((MS_WIDGET *)msi)->pos = *pos;
- ((MS_WIDGET *)msi)->color = color;
- if (NULL != user_op)
- ((MS_WIDGET *)msi)->user_op = (MS_UOP(*)(MS_WIDGET *,MS_UOP,char ))user_op;
- else
- ((MS_WIDGET *)msi)->user_op = (MS_UOP(*)(MS_WIDGET *,MS_UOP,char ))icon_user_op;
- ((MS_WIDGET *)msi)->attr = attr;
- msi->icon_buff = icon_buff;
- ((MS_WIDGET *)msi)->parent = NO_PARENT;
- ((MS_WIDGET *)msi)->attrh = ALIGN_LEFT;
- }
- MS_ICON *MS_create_icon(MS_POS *pos,
- MS_COLOR color,
- void *icon_buff,
- unsigned char attr,
- BYTE bg_idx)
- {
- MS_ICON *msi;
-
- dbg_printf(("MS_create_iconn"));
-
- msi = (MS_ICON *)malloc(sizeof(MS_ICON));
- #ifdef _DEBUG
- if (NULL == msi) {
- tr_printf(("FATAL: MS_create_icon() Failed: Low system resources.n"));
- return NULL;
- }
- #endif //_DEBUG
- icon_bmp_bg_idx = bg_idx;
- MS_init_icon(msi, pos, color, (void (*)(MS_WIDGET *, MS_UOP, char) ) icon_user_op, icon_buff, attr );
- return msi;
- }
- void MS_icon_override_color_select(BYTE bg_idx)
- {
- icon_bmp_bg_idx = bg_idx;
- }