Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
MS_BMP_BTN.C
Package: tb_i86_wr_1019_1102. [view]
Upload User: super_houu
Upload Date: 2008-09-21
Package Size: 4099k
Code Size: 5k
Category:
DVD
Development Platform:
Others
- /* **************************************************************************************
- * Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: MS_BMP_BTN.C $
- *
- * Description:
- * ============
- * bitmaps buttons
- *
- * Log:
- * ====
- * $Revision: 3 $
- * Last Modified by $Author: Leslie $ at $Modtime: 03-01-02 10:48 $
- ****************************************************************************************
- * Updates:
- ****************************************************************************************
- * $Log: /SourceCode/I64_Common/I64_Reference/UI/Menu_sys/MS_BMP_BTN.C $
- *
- * 3 03-01-09 4:43 Leslie
- * Unicode support
- *
- * 3 23/04/02 9:39 Nirm
- * - Added dependency in "Config.h".
- *
- * 2 4/22/02 18:22 Rinata
- * add USE_SMALL_BMP_BUTTONS buttons
- *
- * 1 4/22/02 14:46 Rinata
- *
- *
- *****************************************************************************************/
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef USE_BMP_BUTTON
- #ifdef _DEBUG
- #include "DebugDbgMain.h"
- #undef IFTRACE
- #define IFTRACE if (gTraceMenu)
- #endif //_DEBUG
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "Includesysdefs.h"
- #include "Decoderosdrendr.h"
- #include "PlaycoreScPadScMgr.h"
- #include "UIMenu_Sysms_lib.h"
- #include "UIMenu_Sysosd_drv.h"
- #include "UIMenu_Sysms_wdgt.h"
- #define MS_MAX_ASCII_BUTTON_TEXT_LENGTH MS_STATIC_MAX_LENGTH
- static void display (MS_WIDGET *widget, char focus)
- {
- wchar_t *text = ((MS_BMP_BUTTON *)widget)->present.text;
- // We need a NULL_CHAR at the end
- wchar_t str[MS_MAX_ASCII_BUTTON_TEXT_LENGTH + 2];
- unsigned char ucBgColor = BACK_COLOR( widget, focus );
- if (MS_IS_USE_SC(widget)) {
- if ( NULL_HANDLE != (WORD)text )
- sc_GetBytes((WORD)text, 0, MS_MAX_ASCII_BUTTON_TEXT_LENGTH, (BYTE*)str);
- }
- if ( MS_IS_ASCII(widget) )
- {
- if (MS_IS_USE_SC(widget)) {
- if (NULL_HANDLE != (WORD)text) {
- text= str;
- }
- else
- text= NULL;
- }
- else {
- if (NULL != text) {
- text= str;
- }
- }
- if (NULL == text)
- text= L"";
- }
- if( focus )
- {
- OSD_DrawBitmap( ((MS_BMP_BUTTON *)widget)->bitmap.bitmap_pos.x,
- ((MS_BMP_BUTTON *)widget)->bitmap.bitmap_pos.y,
- ((MS_BMP_BUTTON *)widget)->bitmap.bitmap_buff ,
- #if defined(USE_BMP_BUTTON) && defined(USE_ICON_BUTTONS)
- 7,
- #else
- 10,
- #endif
- //((MS_BMP_BUTTON *)widget)->bitmap.bgIndex,
- BACK_COLOR(widget, focus));
- }
- else
- {
- OSD_DrawBitmap( ((MS_BMP_BUTTON *)widget)->bitmap.bitmap_pos.x,
- ((MS_BMP_BUTTON *)widget)->bitmap.bitmap_pos.y,
- ((MS_BMP_BUTTON *)widget)->bitmap.bitmap_buff,
- 0,
- 0 );
- }
- }
- MS_UOP bmp_button_user_op(MS_WIDGET *widget,MS_UOP uop,char param)
- {
- MS_BMP_BUTTON *button = (MS_BMP_BUTTON *)widget;
- switch (uop)
- {
- case MS_UOP_DELETE:
- uop = MS_UOP_NOP;
- break;
- case MS_UOP_DISPLAY:
- display(widget,param);
- uop = MS_UOP_NOP;
- break;
- case MS_UOP_ENTER:
- button->action();
- uop = MS_UOP_NOP;
- break;
- }
- return uop;
- }
- void MS_init_bmp_button(MS_BMP_BUTTON *msb, MS_POS *pos,MS_COLOR color,
- MS_UOP (*user_op)(MS_WIDGET *,MS_UOP,char),
- void *text,void (* action)(void),
- unsigned char attr)
- {
- #ifdef _DEBUG
- if (NULL == msb) {
- tr_printf(("FATAL: MS_init_bmp_button() Failed: NULL control.n"));
- return;
- }
- #endif
- ((MS_WIDGET *)msb)->pos = *pos;
- ((MS_WIDGET *)msb)->parent = NO_PARENT;
- msb->present.text = text;
- msb->action = action;
- ((MS_WIDGET *)msb)->attr = attr;
- ((MS_WIDGET *)msb)->color = color;
- if (NULL != user_op)
- ((MS_WIDGET *)msb)->user_op = user_op;
- else
- ((MS_WIDGET *)msb)->user_op = bmp_button_user_op;
- ((MS_WIDGET *)msb)->attrh = ALIGN_CENTER;
- }
- MS_BMP_BUTTON *MS_create_bmp_button(MS_POS *pos, MS_COLOR color,
- MS_UOP (*user_op)(MS_WIDGET *,MS_UOP,char),
- void *text,
- void (* action)(void),
- unsigned char attr)
- {
- MS_BMP_BUTTON *msb;
- dbg_printf(("MS_create_bmp_buttonn"));
- msb = (MS_BMP_BUTTON *) malloc (sizeof(MS_BMP_BUTTON));
- #ifdef _DEBUG
- if (NULL == msb) {
- tr_printf(("FATAL: MS_create_bmp_button() Failed: Low system resources.n"));
- return NULL;
- }
- #endif //_DEBUG
- MS_init_bmp_button(msb, pos, color, user_op, text, action, attr);
- return msb;
- }
- #endif // USE_BMP_BUTTON