MS_Frame.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:4k
- /* **************************************************************************************
- * Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: MS_Frame.c $
- *
- * Description:
- * ============
- * menu system frame menus handling
- *
- * Log:
- * ====
- * $Revision: 3 $
- * Last Modified by $Author: Rond $ at $Modtime: 10/28/02 16:51 $
- ****************************************************************************************
- * Updates:
- ****************************************************************************************
- * $Log: /SourceCode/I64/UI/Menu_sys/MS_Frame.c $
- *
- * 3 10/30/02 17:49 Rond
- *
- * 3 23/04/02 9:39 Nirm
- * - Added dependency in "Config.h".
- *
- * 2 19/03/02 20:55 Nirm
- * Added support for the MS_UOP_ENTER event.
- *
- * 1 15/03/02 19:12 Nirm
- *
- **************************************************************************************** */
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef _DEBUG
- #undef IFTRACE
- #define IFTRACE if (gTraceMenu)
- #include "DebugDbgMain.h"
- #endif //_DEBUG
- #include "Decoderosdrendr.h"
- #include "UIMenu_Sysosd_drv.h"
- #include "UIMenu_Sysms_wdgt.h"
- MS_UOP frame_user_op(MS_WIDGET *widget, MS_UOP uop, char param)
- {
- unsigned char ucColor= BACK_COLOR(widget, param);
- MS_FRAME *msf= (MS_FRAME*)widget;
- switch (uop)
- {
- case MS_UOP_ENTER:
- ucColor= FG_COLOR(widget->color);
- // Fall-Through!
- case MS_UOP_DISPLAY:
- switch (msf->frame_type)
- {
- case MS_FRAME_TYPE_CORNERED:
- OSD_CorneredFrame((widget->pos).x, (widget->pos).y, (widget->pos).w, (widget->pos).h,
- msf->horiz_len, msf->vert_len, ucColor, msf->thickness);
- break;
- case MS_FRAME_TYPE_CROSSHAIR:
- OSD_AimedFrame((widget->pos).x, (widget->pos).y, (widget->pos).w, (widget->pos).h,
- msf->horiz_len, msf->vert_len, ucColor, msf->thickness);
- break;
- }
- uop= MS_UOP_NOP;
- break;
- }
- return uop;
- }
- void MS_init_frame(MS_FRAME *msf, MS_POS *pos, MS_COLOR color,
- void (* user_op)(MS_WIDGET *, MS_UOP, char),
- MS_FRAME_TYPE frame_type,
- unsigned char thickness,
- unsigned char vertical_side_len,
- unsigned char horizontal_side_len,
- unsigned char attr)
- {
- #ifdef _DEBUG
- if (NULL == msf) {
- tr_printf(("FATAL: MS_init_frame() Failed: NULL control.n"));
- return;
- }
- #endif //_DEBUG
-
- ((MS_WIDGET *)msf)->pos= *pos;
- ((MS_WIDGET *)msf)->color= color;
- if (NULL != user_op)
- ((MS_WIDGET *)msf)->user_op= (MS_UOP(*)(MS_WIDGET *,MS_UOP,char ))user_op;
- else
- ((MS_WIDGET *)msf)->user_op= (MS_UOP(*)(MS_WIDGET *,MS_UOP,char ))frame_user_op;
- ((MS_WIDGET *)msf)->attr= attr;
- msf->frame_type= frame_type;
- msf->thickness= thickness;
- msf->vert_len= vertical_side_len;
- msf->horiz_len= horizontal_side_len;
- ((MS_WIDGET *)msf)->parent = NO_PARENT;
- ((MS_WIDGET *)msf)->attrh = ALIGN_LEFT;
- }
- MS_FRAME *MS_create_frame(MS_POS *pos,
- MS_COLOR color,
- MS_FRAME_TYPE frame_type,
- unsigned char thickness,
- unsigned char vertical_side_len,
- unsigned char horizontal_side_len,
- unsigned char attr)
- {
- MS_FRAME *msf;
-
- dbg_printf(("MS_create_framen"));
-
- msf = (MS_FRAME *)malloc(sizeof(MS_FRAME));
- #ifdef _DEBUG
- if (NULL == msf) {
- tr_printf(("FATAL: MS_create_frame() Failed: Low system resources.n"));
- return NULL;
- }
- #endif //_DEBUG
- MS_init_frame(msf, pos, color, (void (*)(MS_WIDGET *, MS_UOP, char) ) frame_user_op,
- frame_type, thickness, vertical_side_len, horizontal_side_len, attr);
- return msf;
- }