MS_WDGT.H
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:32k
- /* **************************************************************************************
- * Copyright (c) 2000 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: MS_WDGT.H $
- *
- * Description:
- * ============
- *
- *
- * Log:
- * ====
- * $Revision: 26 $
- * Last Modified by $Author: Chaol $ at $Modtime: 1/18/04 5:36a $
- ****************************************************************************************
- * Updates:
- ****************************************************************************************
- * $Log: /I76/I76_Common/I76_Reference/UI/Menu_sys/MS_WDGT.H $
- *
- * 26 1/18/04 5:36a Chaol
- * extend MS_JUST_MASK to 8 for new justifications
- *
- * 25 03-07-24 10:37 Frankm
- * Modify MS_remove_item_rapidly().
- *
- * 24 03-07-11 15:42 Leonm
- *
- * 23 03-06-19 16:34 Leonh
- * add the function to assign the override color
- *
- * 22 03-06-14 23:34 Leslie
- * Change MS_JUST_MASK to be 4 bits with comile switch
- * USE_4BITS_FOR_ALIGN_ATTR
- *
- * 21 03-05-27 15:25 Leonh
- * add the icon bmp backgroup value
- *
- * 20 03-05-16 19:07 Rogerl
- * Add defines and prototypes to SUPPORT_TIME_EDIT_LEFT_TO_RIGHT
- *
- * 19 03-05-15 20:46 Rogerl
- * add MS_UOP_REPEAT
- *
- * 18 03-05-09 14:42 Jerryc
- * support explorer style clips menu.
- *
- * 17 4/13/03 4:53p Rinata
- * fix password ibehave on parental control n case it is 0000
- *
- * 16 03-03-27 15:06 Jerryc
- * add new event for vestel.
- *
- * 15 03-03-26 15:47 Rogerl
- * Add support to scrollable choice
- *
- * 14 2/28/03 4:41p Jasonh
- * added new uop items: MS_UOP_PROGRAM, MS_UOP_SEARCH, MS_UOP_TIME
- *
- * 13 03-02-19 15:07 Rogerl
- * Add MS_DIALOG_CYCLIC_SELECTION support
- *
- * 12 03-02-14 16:03 Rogerl
- * Add MS_EXT_HELP_CHOICE typedef and prototypes
- *
- * 11 03-02-13 10:30 Rogerl
- * Add MS_ICON support
- *
- * 10 03-02-11 16:38 Rogerl
- * Add typedefs and function prototypes for MS_EXT_ICON_BUTTON and
- * MS_COMBO_ICON_BUTTON .
- *
- * 9 03-02-08 18:17 Royz
- *
- * 8 03-01-17 11:55 Rogerl
- * New definitons and prototypes for new widgets
- *
- * 7 03-01-15 15:55 Royz
- *
- * 6 03-01-10 20:07 Mikelv
- *
- * 5 03-01-09 4:43 Leslie
- * Unicode support
- *
- * 4 10/30/02 18:03 Rond
- *
- * 13 15/05/02 9:30 Ettim
- * Added UI support for L/R (Transition) and Angle buttons (no OSD yet).
- *
- * 12 23/04/02 9:39 Nirm
- * - Added dependency in "Config.h".
- *
- * 11 4/22/02 14:50 Rinata
- * under USE_BMP_BUTTON setup menu with bitmap buttons
- *
- * 10 19/03/02 20:54 Nirm
- * Added new control: MS_FRAME.
- *
- * 9 18/02/02 20:41 Nirm
- * Exported essential methods.
- *
- * 8 14/02/02 18:10 Nirm
- * Fixed prototype of MS_create_button().
- *
- * 7 13/01/02 16:40 Atai
- * Remove old Defines
- *
- * 6 8/01/02 16:25 Nirm
- * Corrected Include-Paths.
- *
- * 5 23/12/01 17:33 Atai
- * Code cleaning
- *
- * 4 23/12/01 17:09 Atai
- *
- * 3 23/12/01 17:06 Atai
- *
- *
- **************************************************************************************** */
- /***********************************************************************/
- #include "Config.h" // Global Configuration - do not remove!
- #ifndef _MS_WDGT_H_
- #define _MS_WDGT_H_
- #include "IncludeSysDefs.h"
- // for Milleno menu system extensions
- #ifdef D_MS_EXTENSIONS
- //
- // Base attributes for all widgets
- //
- // -- These should not shared to specify any other attributes
- //
- #define MS_SELECTABLE 0x01 // This widget is selectable
- #define MS_DIALOG_BOX 0x02 // This widget is dialog box
- //
- // Attributes for widgets with text
- //
- // -- These should not be shared to specify any other attributes
- #define MS_STRING_ON_SC 0x04 // The strings on this widget locate in the scretch pad
- #define MS_ASCII 0x08 // The string contain ASCII characters
- //
- // Attributes specific to MS_DIALOG's
- //
- // -- These can be shared to specify attributes for non-MS_DIALOG's
- #define MS_NO_BACKGROUND 0x10 // Screen without BG
- #define MS_DLG_CLOSE_ON_UP_FAIL 0x20 // Close dialog box if up opration is fail
- #define MS_DIALOG_IS_GROUP 0x40 // Dialog is a group ( all items displayed the same way )
- #define MS_DIALOG_IS_HIGHLIGHT_AS_GROUP 0x80 // Dialog is a group ( all items displayed the same way )
- //
- // Attributes specific to MS_CHOICE's
- //
- // -- These can be shared to specify attributes for non-MS_CHOICE's
- #define MS_CHOICE_ACTION_ON_ENTER 0x10 // Perform action on ENTER
- #define MS_CHOICE_WRAP 0x20 // Wrap current_choice when limits reached
- #define MS_CHOICE_OPEN 0x40 // Choice window is open
- #define MS_CHOICE_KEEP_OPEN 0x80 // Choice should initially be open and stay open
- //
- // Attributes specific to MS_EDIT's
- //
- #define MS_EDIT_HEX 0x40 // Number is hex
- #ifdef D_MS_EXTENSIONS
- #define MS_EDIT_ACTION_ON_INC_DEC 0x80
- #else
- #define MS_EDIT_ATTR_UNUSED 0x80 // Available for extensions (rename when used)
- #endif // D_MS_EXTENSIONS
- // Attributes specific to MS_SLIDER's
- //
- // -- These can be shared to specify attributes for non-MS_SLIDER's
- #define MS_SLIDER_POINT 0x40 // Slider is Point or Relative
- #define MS_SLIDER_ATTR_UNUSED 0x80 // Available for extensions (renamed when used)
- //
- // Test macros for the above attributes:
- //
- #define MS_IS_SELECTABLE(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_SELECTABLE)
- #define MS_HOT_SPOT (MS_SELECTABLE)
- #define MS_IS_HOT_SPOT(_widget_) ((((MS_WIDGET *)(_widget_))->attr & MS_HOT_SPOT) == MS_HOT_SPOT)
- #define MS_IS_DIALOG_BOX(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_DIALOG_BOX)
- #define MS_IS_GROUP(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_DIALOG_IS_GROUP)
- #define MS_IS_HIGHLIGHT_AS_GROUP(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_DIALOG_IS_HIGHLIGHT_AS_GROUP)
- #define MS_IS_USE_SC(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_STRING_ON_SC)
- #define MS_IS_ASCII(_widget_) ( (((MS_WIDGET *)(_widget_))->attr & MS_ASCII) ? C_ASCII : !C_ASCII )
- #define MS_HAS_NO_BACKGROUND(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_NO_BACKGROUND)
- #define MS_IS_CLOSE_ON_UP(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_DLG_CLOSE_ON_UP_FAIL)
- #define MS_IS_CHOICE_ACTION_ON_ENTER(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_CHOICE_ACTION_ON_ENTER)
- #define MS_IS_CHOICE_WRAP(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_CHOICE_WRAP)
- #define MS_IS_CHOICE_OPEN(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_CHOICE_OPEN)
- #define MS_IS_CHOICE_KEEP_OPEN(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_CHOICE_KEEP_OPEN)
- #define MS_IS_EDIT_HEX(_widget_) ( ((MS_WIDGET *)(_widget_))->attr & MS_EDIT_HEX )
- #ifdef D_MS_EXTENSIONS
- #define MS_IS_EDIT_ACTION_ON_INC_DEC(_widget_) ( ((MS_WIDGET *)(_widget_))->attr & MS_EDIT_ACTION_ON_INC_DEC )
- #endif
- #define MS_IS_SLIDER_POINT(_widget_) (((MS_WIDGET *)(_widget_))->attr & MS_SLIDER_POINT)
- //
- // Extended attributes for all widgets:
- //
- #define MS_JUST_MASK 0x03 // Justification mask for MS_CHOICE, MS_STAT
- // Currently only used for MS_CHOICE_EXT
- //#define MS_ATTR_MASK_UNUSED_3 0x10 // Available for extensions (rename when used)
- #define MS_ATTR_MASK_UNUSED_4 0x20 // Available for extensions (rename when used)
- #define MS_ATTR_MASK_UNUSED_5 0x40 // Available for extensions (rename when used)
- #define MS_ATTR_MASK_UNUSED_6 0x80 // Available for extensions (rename when used)
- // Extended attributes specific to MS_CHOICE's
- #define MS_ATTR_MASK_CHOICE_LR 0x04 // Toggle choice on left/right keys
- #define MS_ATTR_MASK_CHOICE_UD 0x08 // Toggle choice on up/down keys
- // Support MS_CHOICE_EXT
- #define MS_ATTR_MASK_CHOICE_EXT_OPENABLE 0x10 // Choice is openable
- // Extended attributes specific to MS_EDIT's
- #define MS_ATTR_MASK_EDIT_LR 0x04 // Increment/decrement edit on left/right keys
- #define MS_ATTR_MASK_EDIT_UD 0x08 // Increment/decrement edit on up/down keys
- #define MS_ATTR_MASK_EDIT_ACTION_PENDING 0x10
- #define MS_ATTR_MASK_DIALOG_WRAP_LR 0x04 // Wrap at leftmost and rightmost items
- #define MS_SET_CHOICE_LR(_choice_) ((MS_WIDGET *)(_choice_))->attrh |= MS_ATTR_MASK_CHOICE_LR
- #define MS_SET_CHOICE_UD(_choice_) ((MS_WIDGET *)(_choice_))->attrh |= MS_ATTR_MASK_CHOICE_UD
- #define MS_SET_CHOICE_ENTER(_choice_) ((MS_WIDGET *)(_choice_))->attrh &= ~(MS_ATTR_MASK_CHOICE_LR | MS_ATTR_MASK_CHOICE_UD)
- #define MS_SET_CHOICE_EXT_OPENABLE(_choice_) ((MS_WIDGET *)(_choice_))->attrh |= MS_ATTR_MASK_CHOICE_EXT_OPENABLE
- // Support increment/decrement on arrows
- #define MS_SET_EDIT_LR(_edit_) ((MS_WIDGET *)(_edit_))->attrh |= MS_ATTR_MASK_EDIT_LR
- #define MS_SET_EDIT_UD(_edit_) ((MS_WIDGET *)(_edit_))->attrh |= MS_ATTR_MASK_EDIT_UD
- #define MS_SET_ACTION_PENDING(_edit_) ((MS_WIDGET *)(_edit_))->attrh |= MS_ATTR_MASK_EDIT_ACTION_PENDING
- #define MS_RESET_ACTION_PENDING(_edit_) ((MS_WIDGET *)(_edit_))->attrh &= ~MS_ATTR_MASK_EDIT_ACTION_PENDING
- #define MS_SET_DIALOG_WRAP_LR(_dialog_) ((MS_WIDGET *)(_dialog_))->attrh |= MS_ATTR_MASK_DIALOG_WRAP_LR
- // Extraction and test macros for the above extended attributes
- #define MS_JUST(widget) (((MS_WIDGET *)(widget))->attrh & MS_JUST_MASK)
- #define MS_IS_CHOICE_LR(_choice_) (((MS_WIDGET *)(_choice_))->attrh & MS_ATTR_MASK_CHOICE_LR)
- #define MS_IS_CHOICE_UD(_choice_) (((MS_WIDGET *)(_choice_))->attrh & MS_ATTR_MASK_CHOICE_UD)
- #define MS_IS_CHOICE_ENTER(_choice_) ( !(MS_IS_CHOICE_LR(_choice_) || MS_IS_CHOICE_UD(_choice_)) )
- // Support increment/decrement on arrows
- #define MS_IS_EDIT_LR(_edit_) (((MS_WIDGET *)(_edit_))->attrh & MS_ATTR_MASK_EDIT_LR)
- #define MS_IS_EDIT_UD(_edit_) (((MS_WIDGET *)(_edit_))->attrh & MS_ATTR_MASK_EDIT_UD)
- // Support action_pending
- #define MS_IS_EDIT_ACTION_PENDING(_edit_) (((MS_WIDGET *)(_edit_))->attrh & MS_ATTR_MASK_EDIT_ACTION_PENDING)
- #define MS_IS_DIALOG_WRAP_LR(_dialog_) (((MS_WIDGET *)(_dialog_))->attrh & MS_ATTR_MASK_DIALOG_WRAP_LR)
- #else // D_MS_EXTENSIONS
- #define MS_SELECTABLE 0x01 // This widget is selectable
- #define MS_SLIDER_POINT 0x02 // Slider is Point or Relative
- #define MS_DIALOG_BOX 0x04 // This widget is dialog box
- #define MS_STRING_ON_SC 0x08 // The strings on this widget locate in the scretch pad
- #define MS_NO_BACKGROUND 0x10 // Screen without BG
- #define MS_ASCII 0x20 // The string contain ASCII characters
- #define MS_CHOICE_OPEN 0x40 // Choice window is open
- #define MS_CHOICE_SCROLLABLE 0x80 // Choice window is scrollable
- #define MS_DIALOG_CYCLIC_SELECTION 0x40 // Dialog is cyclic selectable
- #define MS_DLG_CLOSE_ON_UP_FAIL 0x80 // Close dialog box if up opration is fail
- #define MS_TIME_EDIT_LEFT_TO_RIGHT 0x40 // Fill time edit from left to right
- #define MS_JUST_MASK 0x07 // Justification mask for MS_CHOICE, MS_STAT, use 3bits means the max justification is 8
- #define MS_ATTR_LIST_ITEM 0x08 // This widget is a list item
- #define MS_CHOICE_SCROLL_RANGE_MASK 0xF0 // choice scroll range: visible items
- #define MS_HOT_SPOT (MS_SELECTABLE)
- #define MS_IS_HOT_SPOT(widget) ((((MS_WIDGET *)(widget))->attr & MS_HOT_SPOT) == MS_HOT_SPOT)
- #define MS_IS_DIALOG_BOX(widget) (((MS_WIDGET *)(widget))->attr & MS_DIALOG_BOX)
- // Needed for MS_dlg.c
- #define MS_IS_GROUP(_widget_) (FALSE)
- // Needed for MS_dlg.c
- #define MS_IS_HIGHLIGHT_AS_GROUP(_widget_) (FALSE)
- #define MS_IS_SELECTABLE(widget) (((MS_WIDGET *)(widget))->attr & MS_SELECTABLE)
- #define MS_SET_SELECTABLE(widget) ((MS_WIDGET *)(widget))->attr |= MS_SELECTABLE
- #define MS_RESET_SELECTABLE(widget) ((MS_WIDGET *)(widget))->attr &= ~MS_SELECTABLE
- #define MS_IS_USE_SC(widget) (((MS_WIDGET *)(widget))->attr & MS_STRING_ON_SC)
- #define MS_IS_CHOICE_OPEN(widget) (((MS_WIDGET *)(widget))->attr & MS_CHOICE_OPEN)
- #define MS_IS_CHOICE_SCROLLABLE(widget) (((MS_WIDGET *)(widget))->attr & MS_CHOICE_SCROLLABLE)
- #define MS_IS_TIME_EDIT_LEFT_TO_RIGHT(widget) (((MS_WIDGET *)(widget))->attr & MS_TIME_EDIT_LEFT_TO_RIGHT)
- #define MS_IS_CLOSE_ON_UP(widget) (((MS_WIDGET *)(widget))->attr & MS_DLG_CLOSE_ON_UP_FAIL)
- #define MS_IS_DIALOG_CYCLIC_SELECTION(widget) (((MS_WIDGET *)(widget))->attr & MS_DIALOG_CYCLIC_SELECTION)
- #define MS_IS_ASCII(widget) ( (((MS_WIDGET *)(widget))->attr & MS_ASCII) ? C_ASCII : !C_ASCII )
- #define MS_IS_SLIDER_POINT(widget) (((MS_WIDGET *)(widget))->attr & MS_SLIDER_POINT)
- #define MS_HAS_NO_BACKGROUND(widget) (((MS_WIDGET *)(widget))->attr & MS_NO_BACKGROUND)
- #define MS_JUST(widget) (((MS_WIDGET *)(widget))->attrh & MS_JUST_MASK)
- #define MS_IS_LIST_ITEM(widget) (((MS_WIDGET *)(widget))->attrh & MS_ATTR_LIST_ITEM)
- #define MS_GET_CHOICE_SCROLL_RANGE(widget) ((((MS_WIDGET *)(widget))->attrh & MS_CHOICE_SCROLL_RANGE_MASK)>>4 )
- #define MS_SET_CHOICE_SCROLL_RANGE(_widget_, _value_) ((MS_WIDGET *)(_widget_))->attrh &= ~MS_CHOICE_SCROLL_RANGE_MASK;
- ((MS_WIDGET *)(_widget_))->attrh |= ((_value_ << 4) &MS_CHOICE_SCROLL_RANGE_MASK)
- #endif // D_MS_EXTENSIONS
- // Set macros for the above extended attributes
- #define MS_SET_JUST(_widget_, _value_) ((MS_WIDGET *)(_widget_))->attrh &= ~MS_JUST_MASK;
- ((MS_WIDGET *)(_widget_))->attrh |= _value_
- #define NO_PARENT ((MS_DIALOG *)-1)
- #define PARENT_SCREEN NO_PARENT
- #define PARENT_DIALOG ((MS_DIALOG *) 0)
- #define C_FOCUSED 1
- #define C_ASCII 1
- #define MS_ATTR_HELP_TEXT 0x10 // widght has help text
- #define IS_OPENABLE_LIST(_pChoice_) ((_pChoice_)->choice_pos.w)
- #define IS_TOGGLE(_pChoice_) (!IS_OPENABLE_LIST(_pChoice_))
- #define NO_CHOICE 0xffff
- #define IS_CHOICE_EXT_OPENABLE(_pChoice_) ( ((MS_WIDGET *)(_pChoice_))->attrh & MS_ATTR_MASK_CHOICE_EXT_OPENABLE)
- #define IS_CHOICE_EXT_TOGGLE(_pChoice_) (!IS_CHOICE_EXT_OPENABLE(_pChoice_))
- #define IS_HELP_TEXT(_pwidget_) (((MS_WIDGET*)(_pwidget_))->attrh & MS_ATTR_HELP_TEXT)
- typedef enum {
- MS_UOP_NOP = 0,
- // Arrow functionality
- MS_UOP_UP = 1,
- MS_UOP_DOWN = 2,
- MS_UOP_LEFT = 3,
- MS_UOP_RIGHT = 4,
- // Play button - this is usually a shortcut for some formal menu behavior
- MS_UOP_PLAY = 5,
- // Skip right button (obsolete)
- MS_UOP_SKIP_RIGHT = 6,
- // Select/Enter button
- MS_UOP_ENTER = 7,
- // Clear button
- MS_UOP_CLEAR = 8,
- // Number for Edit box
- MS_UOP_0 = 10,
- MS_UOP_1 = 11,
- MS_UOP_2 = 12,
- MS_UOP_3 = 13,
- MS_UOP_4 = 14,
- MS_UOP_5 = 15,
- MS_UOP_6 = 16,
- MS_UOP_7 = 17,
- MS_UOP_8 = 18,
- MS_UOP_9 = 19,
- // Enable RETURN in menus
- MS_UOP_RETURN = 20,
- // Support MS_EDIT_HEX
- #ifdef D_MS_EXTENSIONS
- // UOP's for hex digits
- // This block can be moved to another range in the enum,
- // but must retain its ordering
- MS_UOP_A = 21,
- MS_UOP_B = 22,
- MS_UOP_C = 23,
- MS_UOP_D = 24,
- MS_UOP_E = 25,
- MS_UOP_F = 26,
- #endif // D_MS_EXTENSIONS
- MS_UOP_STOP = 27,
- MS_UOP_POWER = 28,
- MS_UOP_EJECT = 29,
- MS_UOP_SKIPF = 30,
- MS_UOP_SKIPB = 31,
- MS_UOP_PAUSE = 32,
- MS_UOP_STATUS = 33,
- MS_UOP_ANGLE = 34,
- MS_UOP_MODE = 35,
- MS_UOP_MENU = 36,
- MS_UOP_TRANSITION = 37,
- MS_UOP_PROGRAM = 38,
- MS_UOP_SEARCH = 39,
- MS_UOP_TIME = 40,
- MS_UOP_REPEAT = 41,
-
- // Internal MS use !
- MS_UOP_DISPLAY = 100,
- MS_UOP_DELETE = 102,
- #ifdef D_MS_EXTENSIONS
- MS_UOP_EXT_VALIDATE = 103,
- MS_UOP_EXT_CHOICE_DISPLAY_CLOSED_VALUE = 104,
- MS_UOP_EXT_CHOICE_DISPLAY_OPEN_VALUE = 105,
- MS_UOP_EXT_ACTION = 106,
- MS_UOP_EXT_CHOICE_CLOSE = 107,
- MS_UOP_EXT_CHOICE_NEXT = 108,
- MS_UOP_EXT_HELP = 109,
- #endif // D_MS_EXTENSIONS
- MS_UOP_GET_HELP_TEXT = 110,
-
- MS_UOP_10P = 111,
- #ifdef MANUAL_DIRECTORY_EXPLORER
- MS_UOP_MOVE_CURSOR_TO_FILEWINDOW = 112,
- #endif
-
- } MS_UOP;
- #ifdef D_COLOR_STRUCT
- typedef struct {
- unsigned int foreground : 4;
- unsigned int background : 4;
- unsigned int activate : 4;
- unsigned int focused : 4;
- } MS_COLOR;
- #else
- typedef WORD MS_COLOR;
- #endif
- #define FG_COLOR_MASK 0xf000
- #define FG_COLOR_SHIFT 12
- #define BG_COLOR_MASK 0x0f00
- #define BG_COLOR_SHIFT 8
- #define ACT_COLOR_MASK 0x00f0
- #define ACT_COLOR_SHIFT 4
- #define FOCUS_COLOR_MASK 0x000f
- #define FOCUS_COLOR_SHIFT 0
- #define EXTRACT_COLOR(_msColor_, _mask_, _shift_) (((_msColor_) & (_mask_)) >> (_shift_))
- #define FG_COLOR(_msColor_) EXTRACT_COLOR((_msColor_), FG_COLOR_MASK, FG_COLOR_SHIFT)
- #define BG_COLOR(_msColor_) EXTRACT_COLOR((_msColor_), BG_COLOR_MASK, BG_COLOR_SHIFT)
- #define ACT_COLOR(_msColor_) EXTRACT_COLOR((_msColor_), ACT_COLOR_MASK, ACT_COLOR_SHIFT)
- #define FOCUS_COLOR(_msColor_) ((_msColor_) & FOCUS_COLOR_MASK)
- #define BACKGROUND_COLOR(_color_, _focus_) (unsigned char) ( (_focus_) == C_FOCUSED ? FOCUS_COLOR(_color_) : BG_COLOR(_color_) )
- #define BACK_COLOR(_widget_, _focus_) BACKGROUND_COLOR(((MS_WIDGET *)(_widget_))->color, (_focus_) )
- #define FOREGROUND_COLOR(_color_, _focus_) (unsigned char) ( (_focus_) == C_FOCUSED ? ACT_COLOR(_color_) : FG_COLOR(_color_) )
- #define FORE_COLOR(_widget_, _focus_) FOREGROUND_COLOR(((MS_WIDGET *)(_widget_))->color, (_focus_) )
- #define MAKE_MS_COLOR(_ifg_, _ibg_, _if_) ( (WORD)(((_ifg_)<<FG_COLOR_SHIFT) + ((_ibg_)<<BG_COLOR_SHIFT) + (_if_)))
- typedef struct {
- unsigned short x;
- unsigned short y;
- unsigned short w;
- unsigned short h;
- } MS_POS;
- typedef struct ms_text_list {
- unsigned short size;
- int *head; // SC or array of strings
- } MS_TEXT_LIST;
- typedef struct ms_widget {
- unsigned char attr;
- unsigned char attrh;
- MS_COLOR color;
- MS_POS pos;
- struct ms_dialog *parent;
- MS_UOP (*user_op) (struct ms_widget *widget,MS_UOP uop,char param);
- } MS_WIDGET;
- typedef struct widget_list_item {
- struct widget_list_item *next;
- struct widget_list_item *prev;
- MS_WIDGET *widget;
- } WIDGET_LIST_ITEM;
- typedef struct ms_dialog{
- MS_WIDGET widget;
- WIDGET_LIST_ITEM *pwli_widget_list;
- WIDGET_LIST_ITEM *pwli_focus;
- #ifdef D_MS_EXTENSIONS
- #else
- WIDGET_LIST_ITEM *pwli_prev_focused;
- #endif // D_MS_EXTENSIONS
- void (*on_close)(void);
- } MS_DIALOG;
- typedef struct ms_screen{
- MS_DIALOG dialog;
- void (*layout)(void);
- } MS_SCREEN;
- #ifdef D_MS_EXTENSIONS
- typedef MS_UOP (*USER_OP)(MS_WIDGET *, MS_UOP, char);
- typedef struct ms_group_button{
- MS_DIALOG dialog;
- void (*action)(void);
- } MS_GROUP_BUTTON;
- #endif // D_MS_EXTENSIONS
- typedef struct ms_static {
- MS_WIDGET widget;
- void *text;
- } MS_STATIC;
- typedef struct ms_frame {
- MS_WIDGET widget;
- unsigned char frame_type;
- unsigned char thickness;
- unsigned char vert_len;
- unsigned char horiz_len;
- } MS_FRAME;
- typedef struct ms_slider {
- MS_WIDGET widget;
- unsigned char max_value; // Value represent by the slider [0..value]
- unsigned char cur_ratio; // Current ratio [0..value]
- unsigned char step;
- void (*action)(unsigned char cur_ratio);
- int tick_ratio;
- } MS_SLIDER;
- typedef struct ms_button {
- MS_STATIC present;
- void (*action)(void);
- } MS_BUTTON;
- typedef struct ms_icon {
- MS_WIDGET widget;
- CONST BYTE *icon_buff;
- }MS_ICON;
- typedef struct ms_bitmap {
- MS_POS bitmap_pos;
- CONST BYTE *bitmap_buff;
- }MS_BITMAP;
- typedef struct ms_bmp_button {
- MS_STATIC present;
- MS_BITMAP bitmap;
- void (*action)(void);
- } MS_BMP_BUTTON;
- typedef struct ms_ext_button {
- MS_STATIC present;
- MS_STATIC helptext;
- void (*action)(void);
- } MS_EXT_BUTTON;
- typedef struct ms_ext_icon_button {
- MS_EXT_BUTTON button;
- MS_WIDGET *icon;
- } MS_EXT_ICON_BUTTON;
- typedef struct ms_combo_button {
- MS_STATIC present;
- MS_STATIC *helptext;
- void (*action)(void);
- MS_WIDGET *companion;
- BYTE is_in_companion;
- } MS_COMBO_BUTTON;
- typedef struct ms_combo_icon_button {
- MS_COMBO_BUTTON button;
- MS_WIDGET *icon;
- } MS_COMBO_ICON_BUTTON;
- typedef struct ms_list_item {
- unsigned char attr;
- unsigned char attrh;
- unsigned short x;
- unsigned short y;
- struct MS_WIDGET *mswProto;
- } MS_LIST_ITEM;
- typedef struct ms_choice {
- MS_WIDGET widget;
- const MS_TEXT_LIST *text_list;
- void (*action)(int selected_text_no);
- //Exchanged choice_pos and current_choice
- MS_POS choice_pos;
- unsigned short current_choice;
- } MS_CHOICE;
- typedef struct ms_ext_help_choice {
- MS_CHOICE choice;
- MS_STATIC *helptext;
- const MS_TEXT_LIST *on_help_list;
- const MS_TEXT_LIST *done_help_list;
- } MS_EXT_HELP_CHOICE;
- #define MS_UOP_EXT MS_UOP
- typedef MS_UOP_EXT (*USER_OP_EXT)(MS_WIDGET *, MS_UOP, char, void *);
- typedef struct ms_choice_ext {
- MS_WIDGET widget;
- USER_OP_EXT m_user_op_ext;
- WORD m_wNumItems;
- WORD current_choice;
- } MS_CHOICE_EXT;
- typedef struct ms_choice_std {
- MS_CHOICE_EXT choice_ext;
- MS_TEXT_LIST *text_list;
- void (*action)(int selected_text_no);
- MS_POS choice_pos;
- } MS_CHOICE_STD;
- //<<<ml 0109
- #ifdef D_ENABLE_LANGUAGE_POP_OUT
- typedef struct ms_open_choice {
- MS_WIDGET widget;
- const MS_TEXT_LIST *text_list;
- void (*action)(int selected_text_no);
- unsigned short current_choice;
- MS_POS choice_pos;
- void * text;
- } MS_OPEN_CHOICE;
- #endif //D_ENABLE_LANGUAGE_POP_OUT
- //>>>ml 0109
- typedef struct ms_edit {
- MS_STATIC present;
- void (*action)(void *text);
- unsigned char max_width;
- unsigned char current_num;
- } MS_EDIT;
- typedef struct ms_valid_edit {
- MS_STATIC present;
- void (*action)(void *text);
- unsigned char max_width;
- unsigned char current_num;
- BOOL (*validate)( struct ms_valid_edit *pmsve, DWORD *pdw, MS_UOP uop);
- void (*format)( struct ms_valid_edit *pmsve, DWORD dw);
- } MS_VALID_EDIT;
- typedef struct ms_static_bitmap {
- MS_WIDGET widget;
- void *bmp;
- } MS_STATIC_BITMAP;
- typedef struct ms_password {
- MS_EDIT msEdit;
- } MS_PASSWORD;
- typedef struct ms_time {
- MS_EDIT msEdit;
- } MS_TIME;
- MS_STATIC *MS_create_static(MS_POS *pos,
- MS_COLOR color,
- void *text,
- unsigned char attr);
- void MS_init_static(MS_STATIC *mss, MS_POS *pos, MS_COLOR color,
- void (* user_op)(MS_WIDGET *, MS_UOP, char),
- void *text, unsigned char attr);
- typedef enum {
- MS_FRAME_TYPE_CORNERED,
- MS_FRAME_TYPE_CROSSHAIR
- } MS_FRAME_TYPE;
- 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);
- 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 USE_BMP_BUTTON
- MS_STATIC_BITMAP *MS_create_bitmap(MS_POS *pos,
- MS_COLOR color,
- void *pvImg,
- unsigned char attr);
- #endif
- MS_ICON *MS_create_icon(MS_POS *pos,
- MS_COLOR color,
- void *icon_buff,
- unsigned char attr,
- BYTE bg_idx);
- 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);
- MS_BUTTON *MS_create_button(MS_POS *pos,
- MS_COLOR color,
- MS_UOP (*userop)(MS_WIDGET *,MS_UOP,char),
- void *text,
- void (* action)(void),
- unsigned char attr);
- void MS_init_button(MS_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);
- MS_EXT_BUTTON *MS_create_ext_button(MS_POS *pos, MS_COLOR color,
- MS_UOP (*user_op)(MS_WIDGET *,MS_UOP,char),
- void *text,
- void (* action)(void),
- unsigned char attr);
- void MS_init_ext_button(MS_EXT_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);
- MS_EXT_ICON_BUTTON *MS_create_ext_icon_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_WIDGET * widget);
- void MS_init_ext_icon_button(MS_EXT_ICON_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,
- MS_WIDGET *widget);
- MS_COMBO_BUTTON *MS_create_combo_button(MS_POS *pos, MS_COLOR color,
- MS_UOP (*user_op)(MS_WIDGET *,MS_UOP,char),
- void *text,
- void (* action)(void),
- unsigned char attr,
- unsigned char attrh,
- MS_STATIC *helptext,
- MS_WIDGET *companion);
- void MS_init_combo_button(MS_COMBO_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,
- unsigned char attrh,
- MS_STATIC *helptext,
- MS_WIDGET *companion);
- MS_COMBO_ICON_BUTTON *MS_create_combo_icon_button(MS_POS *pos, MS_COLOR color,
- MS_UOP (*user_op)(MS_WIDGET *,MS_UOP,char),
- void *text,
- void (* action)(void),
- unsigned char attr,
- unsigned char attrh,
- MS_STATIC * helptext,
- MS_WIDGET *companion,
- MS_WIDGET *icon);
- void MS_init_combo_icon_button(MS_COMBO_ICON_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,
- unsigned char attrh,
- MS_STATIC * helptext,
- MS_WIDGET *companion,
- MS_WIDGET *icon);
- MS_EDIT *MS_create_edit(MS_POS *pos,
- MS_COLOR color,
- void *text,
- void (* action)(void *),
- unsigned char max_width,
- unsigned char attr);
- #ifdef D_MS_EXTENSIONS
- MS_VALID_EDIT *MS_create_valid_edit(MS_POS *pos,
- MS_COLOR color,
- void *text,
- void (* action)(void *),
- unsigned char max_width,
- // Added formatting capability
- BOOL (*validate)(struct ms_valid_edit *, DWORD *, MS_UOP),
- void (*format)(struct ms_valid_edit *, DWORD),
- unsigned char attr);
- #endif // D_MS_EXTENSIONS
- MS_TIME *MS_create_time(MS_POS *pos,
- MS_COLOR color,
- void *text,
- void (* action)(void *),
- unsigned char max_width,
- unsigned char attr);
- MS_PASSWORD *MS_create_password(MS_POS *pos,
- MS_COLOR color,
- void *text,
- void (* action)(void *),
- unsigned char max_width,
- unsigned char attr);
- MS_DIALOG *MS_create_dialog(MS_POS *pos,
- MS_COLOR color,
- MS_DIALOG *parent,
- void (*on_close)(void),
- unsigned short attr);
- MS_SCREEN *MS_create_screen(MS_POS *pos,
- MS_COLOR color,
- unsigned short attr,
- void (*on_close)(void),
- void(*layout)(void));
- MS_SLIDER *MS_create_slider(MS_POS *pos,
- MS_COLOR color,
- unsigned char max_value,
- unsigned char cur_ratio,
- unsigned char step,
- void (* action)(unsigned char cur_ratio),
- int tick_ratio,
- unsigned char attr);
- #ifdef D_MS_EXTENSIONS
- MS_GROUP_BUTTON *MS_create_group_button(MS_POS *pos, MS_COLOR color, void (*on_close)(void), void (* action)(void), unsigned char attr);
- #endif // D_MS_EXTENSIONS
- void MS_hide(MS_WIDGET *widget,MS_DIALOG *parent);
- void MS_add_item(MS_DIALOG *dialog,MS_WIDGET *widget, char focus);
- void MS_remove_item_rapidly(MS_DIALOG *dialog,MS_WIDGET *widget);
- #define MS_ADD_TO_CONTAINER(_pmsd_, _pmsw_, _cFocused_)
- MS_add_item( (MS_DIALOG *) (_pmsd_), (MS_WIDGET *) (_pmsw_), (_cFocused_) )
- // Implement YesNo items for password dialog
- #ifdef ZS5XX_PASSWORD
- int MS_detach_item(MS_WIDGET *widget);
- #endif // ZS5XX_PASSWORD
- int MS_remove_item(MS_WIDGET *widget);
- int MS_refresh(MS_DIALOG *dialog);
- void MS_dialog_display(MS_DIALOG *dialog);
- MS_UOP MS_user_operation(MS_SCREEN *screen,MS_UOP uop,char param);
- void MS_delete(MS_WIDGET *widget);
- MS_CHOICE *MS_create_choice(const MS_POS *pos, MS_COLOR color, const MS_TEXT_LIST *text_list, const MS_POS *choice_pos, void (* action)(int), unsigned char attr);
- #ifdef D_ENABLE_LANGUAGE_POP_OUT
- MS_OPEN_CHOICE *MS_create_open_choice(const MS_POS *pos, MS_COLOR color, const MS_TEXT_LIST *text_list, const MS_POS *choice_pos, void (* action)(int), unsigned char attr,void * text);
- //ml 0110
- #endif //D_ENABLE_LANGUAGE_POP_OUT
- #ifdef D_PUSHABLE_MENU
- MS_CHOICE *MS_create_choice_ex(CONST MS_POS *pos, MS_COLOR color, CONST MS_TEXT_LIST *text_list, CONST MS_POS *choice_pos, void (* action)(int), unsigned char attr);
- MS_CHOICE *MS_create_choice_ex_scroll(CONST MS_POS *pos, MS_COLOR color, CONST MS_TEXT_LIST *text_list, CONST MS_POS *choice_pos, void (* action)(int), unsigned char attr,BYTE visible_items);
- #else
- MS_CHOICE *MS_create_choice_ex(CONST MS_POS *pos, MS_COLOR color, CONST MS_TEXT_LIST *text_list, void (* action)(int), unsigned char attr);
- MS_CHOICE *MS_create_choice_ex_scroll(CONST MS_POS *pos, MS_COLOR color, CONST MS_TEXT_LIST *text_list, void (* action)(int), unsigned char attr,BYTE visible_items);
- #endif
- MS_EXT_HELP_CHOICE *MS_create_ext_help_choice(CONST MS_POS *pos, MS_COLOR color,
- CONST MS_TEXT_LIST *text_list,
- void (* action)(int),unsigned char attr,
- MS_STATIC *helptext,
- CONST MS_TEXT_LIST *on_help_list,
- CONST MS_TEXT_LIST *done_help_list);
-
- MS_EXT_HELP_CHOICE *MS_create_ext_help_choice_scroll(CONST MS_POS *pos, MS_COLOR color,
- CONST MS_TEXT_LIST *text_list,
- void (* action)(int),unsigned char attr,
- MS_STATIC *helptext,
- CONST MS_TEXT_LIST *on_help_list,
- CONST MS_TEXT_LIST *done_help_list,
- BYTE visible_items);
- void MS_change_focus(MS_DIALOG *pDialog, MS_WIDGET *pWidget);
- // Support external display of open choices
- void choice_display_open_value(MS_CHOICE *pmsc, WORD wItemNum, char focus );
- void MS_create_list_item(unsigned short x, unsigned short y, MS_WIDGET *pProto, unsigned short usSize);
- // Standard user-ops for some menu system types
- MS_UOP static_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- MS_UOP frame_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- MS_UOP button_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- MS_UOP ext_button_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- MS_UOP ext_icon_button_user_op(MS_WIDGET *widget,MS_UOP uop,char param) ;
- MS_UOP combo_button_user_op(MS_WIDGET *widget,MS_UOP uop,char param) ;
- MS_UOP combo_icon_button_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- MS_UOP choice_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- MS_UOP choice_ex_user_op(MS_WIDGET *widget, MS_UOP uop, char param);
- MS_UOP ext_help_choice_user_op(MS_WIDGET *widget, MS_UOP uop, char param);
- MS_UOP dialog_user_op (MS_WIDGET *widget,MS_UOP uop, char param);
- MS_UOP edit_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- // Expose user_op for MS_PASSWORD
- MS_UOP password_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- #ifdef USE_BMP_BUTTON
- MS_UOP bmp_button_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- #endif
- unsigned char edit_number_select(MS_EDIT *edit, unsigned char num);
- void edit_display (MS_WIDGET *widget, char focus);
- void init_edit(MS_EDIT *pmse,
- MS_POS *pos,
- MS_COLOR color,
- void *text,
- void (*action)(void *),
- unsigned char max_width,
- unsigned char attr);
- // Optimize MS_create_dialog, MS_create_screen, MS_create_group_button
- #ifdef USE_BMP_BUTTON
- MS_UOP bitmap_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- #endif
- MS_UOP icon_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- MS_UOP time_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- #ifdef D_MS_EXTENSIONS
- MS_UOP group_button_user_op(MS_WIDGET *widget,MS_UOP uop,char param);
- #endif // MS_EXTENSIONS
- void MS_init_dialog(MS_DIALOG *dialog,
- MS_POS *pos,
- MS_COLOR color,
- MS_DIALOG *parent,
- void (*on_close)(void),
- unsigned short attr);
- // Shorthand for displaying an unfocused widget
- void MS_display(MS_WIDGET *widget);
- // Utility functions
- BOOL text_to_num(wchar_t *text, long *pdw);
- void text_to_seconds(wchar_t *text, long *pSeconds);
- void text_to_seconds2(wchar_t *text, long *pSeconds,int max_digits);
- int get_num_digits(ULONG number);
- int get_time_digits(ULONG number);
- void MS_icon_override_color_select(BYTE bg_idx);
- // convenience in override user_ops
- #ifdef D_MS_EXTENSIONS
- #define MS_CHOICE_OPEN_VALUE_POS_Y(_pmsc_, _wItemNum_) ( (_pmsc_)->choice_pos.y + ((_pmsc_)->choice_pos.h * (_wItemNum_)) )
- #endif
- // Code readability
- #define NO_ACTION NULL
- #endif // _MS_WDGT_H_