?? mso_choice.c
字號:
*
* Desc : Defaul display function of MSO_LISTITEM objects.
****************************************************************************************/
BOOL ListItemFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
FORMATED_UNICODE_STRING oFormUniStr;
UINT16 wColor = (MS_IsFocusable(pThis) && (!MS_IS_LISTITEM_DISABLED(pThis))) ? CIDX_CHOICE_LIST_ITEM_FOCUSABLE : CIDX_CHOICE_LIST_ITEM_NOT_FOCUSABLE;
MSO_LISTITEM __NEAR* pItem = (MSO_LISTITEM __NEAR*)pThis;
// Display selection icon.
if(MS_IsSelected(pItem))
{
OSDR_FillOsdSegBitmap(BMP_FG_MARK_CHECK,
pAbsArea,
LISTITEM_SELECTION_STARTX,
(pAbsArea->mwH >> 1),
ALIGN_H_LEFT, ALIGN_V_CENTER,
NULL_EXPANSION, NULL_EXPANSION);
}
oFormUniStr.mtFontIndex = FONT_0;
OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, pItem->moParam.mwOsdMsgIndex);
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
pAbsArea,
LISTITEM_TEXT_STARTX,
(pAbsArea->mwH >> 1),
ALIGN_H_LEFT,
ALIGN_V_CENTER,
wColor);
if(MS_IsFocusable(pThis) && MS_IsFocused(pThis))
OSDR_FillOsdSegBitmapFitArea(BMP_FG_FOCUS, pAbsArea);
return FALSE;
}
/***************************************************************************************
* Function : ChoiceOperation
*
* In : pThis = Pointer to the Choice (MSO_CHOICE) object.
*
* MsOp = Operation ID.
*
* lParam = Parameter associated with an MS_OP if any.
*
* Out : None.
*
* Return : ID of the operation that is to be propagated once processing is done,
* otherwise MS_OP_NONE.
*
* Desc : This function default operation function of MSO_CHOICE objects.
****************************************************************************************/
BOOL ChoiceFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
FORMATED_UNICODE_STRING oFormUniStr;
MSO_CHOICE __NEAR* pChoice = (MSO_CHOICE __NEAR*)pThis;
MS_DESCRIPTOR_CHOICE* pDescriptorChoice = (MS_DESCRIPTOR_CHOICE*)pThis->mpDescriptor;
UINT16 wColor = ((MS_IsFocused(pThis) || MS_IS_FOCUS_ON_LASTITEM(pThis)) ? CIDX_4 : pDescriptorChoice->mwNameTextColor);
UINT16 wValueColor = (MS_IsFocused(pThis) ? CIDX_4 : pDescriptorChoice->mwValueTextColor);
INT16 sStartX = MS_IS_CHOICE_DISPLAY_AS_BUTTON(pThis) ? (pAbsArea->mwW >> 1) : NAME_START_XPOS;
UINT8 cHAlign = MS_IS_CHOICE_DISPLAY_AS_BUTTON(pThis) ? ALIGN_H_CENTER : ALIGN_H_LEFT;
oFormUniStr.mtFontIndex = FONT_0;
if(MS_IS_CHOICE_DISABLED(pThis))
wColor = wValueColor = CIDX_4;
if(MS_IsFocused(pThis) || MS_CHOICE_IS_DISPLAY_AS_TAB(pThis) || MS_IS_CHOICE_DISPLAY_BG_BMP(pThis))
OSDR_FillOsdSegBitmapFitArea(pDescriptorChoice->mpBgBmp, pAbsArea);
// Display the name of the choice, if required:
if(!MS_IS_CHOICE_NO_NAME_REQUIRED(pThis))
{
OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, pDescriptorChoice->mName);
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
pAbsArea,
sStartX,
(pAbsArea->mwH >> 1),
cHAlign,
ALIGN_V_CENTER,
wColor);
}
if((!MS_CHOICE_IS_DISPLAY_AS_TAB(pThis)) && (!MS_IS_CHOICE_DISPLAY_AS_BUTTON(pThis)))
{
if(!MS_IS_CHOICE_NO_NAME_REQUIRED(pThis))
{
// Colon
OSDR_GetFormUniStr_Flash((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)COLON);
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
pAbsArea,
(pAbsArea->mwW >> 1),
(pAbsArea->mwH >> 1),
ALIGN_H_LEFT,
ALIGN_V_CENTER,
wColor);
}
// Parameter value.
OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
pDescriptorChoice->mpData[pChoice->moParam.mwCurrValIndex].mwOsdMsgIndex);
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr,
pAbsArea,
MS_IS_CHOICE_NO_NAME_REQUIRED(pThis) ? sStartX : (pAbsArea->mwW >> 1) + 12,
(pAbsArea->mwH >> 1),
ALIGN_H_LEFT,
ALIGN_V_CENTER,
wValueColor);
}
if(!MS_IsFocusable(pThis))
return FALSE;
if(MS_IsFocused(pThis))
OSDR_FillOsdSegBitmapFitArea(BMP_FG_FOCUS, pAbsArea);
if(MS_CHOICE_IS_DISPLAY_AS_TAB(pThis))
{
OSDR_FillOsdSegRectangle(pThis->moArea.mwW - CHOICE_OVERLAP_VALUELIST_W,
0,
CHOICE_OVERLAP_VALUELIST_W,
pThis->moArea.mwH,
pAbsArea,
pDescriptorChoice->mwBgColor);
}
return FALSE;
}
/***************************************************************************************
* Choice Public utility function declarations.
****************************************************************************************/
/***************************************************************************************
* Function : OCHOICE_AddItemsToVList
*
* In : pChoice = Pointer to List to the MSO_CHOICE object.
*
* pList = Pointer to List to which items would to be added.
*
* Out : None.
*
* Return : TRUE if all the items could be added, FALSE otherwise
*
* Desc : This is a convienience function - This function is generic code (to add a list
* of items to a vertical list) that will work in most cases. The number of items that would
* be added depends on the number of values an MSO_CHOICE object can have
* (i.e. MS_DESCRIPTOR_CHOICE::mcTotalValues).
****************************************************************************************/
BOOL OCHOICE_AddItemsToVList(MSO_CHOICE __NEAR* pChoice, MSO_VLIST __NEAR* pList)
{
UINT8 cIndex;
UINT8 cNumItems;
MSO_LISTITEM __NEAR* pListItem;
MS_DESCRIPTOR_CHOICE* pDescriptorChoice;
CONST MS_DESCRIPTOR_LISTITEM* pDescriptorListItem;
pDescriptorChoice = (MS_DESCRIPTOR_CHOICE*)((MSO_OBJECT __NEAR*)pChoice)->mpDescriptor;
pDescriptorListItem = (CONST MS_DESCRIPTOR_LISTITEM*)(pDescriptorChoice->mpDescriptorValue);
if((NULL != pChoice) && (NULL != pList))
{
UINT16 wItemIndex = 0;
pList->moParam.mwTotalItems = pDescriptorChoice->mcTotalValues;
cNumItems = MIN(pList->moParam.mcNumVisibleItems, (pList->moParam.mwTotalItems - pList->moParam.mwFirstDisplayItem));
for(cIndex = 0; cIndex < cNumItems; cIndex++)
{
pListItem = (MSO_LISTITEM __NEAR*)OVLIST_CreatAndAddItem((MSO_OBJECT __NEAR*)pList, (MS_DESCRIPTOR*)pDescriptorListItem, TRUE, FALSE);
wItemIndex = pList->moParam.mwFirstDisplayItem + cIndex;
MS_SendOperation((MSO_OBJECT __NEAR*)pListItem, MS_OP_OPEN, 0);
pListItem->moParam.mwOsdMsgIndex = pDescriptorChoice->mpData[wItemIndex].mwOsdMsgIndex;
pListItem->moParam.mwValue = pDescriptorChoice->mpData[wItemIndex].mwValue;
MS_SendOperation((MSO_OBJECT __NEAR*)pListItem, MS_OP_INIT, 0);
if(pChoice->moParam.mwCurrValIndex == wItemIndex)
MS_SetSelected(pListItem);
}
return TRUE;
}
return FALSE;
}
/***************************************************************************************
* Function : OCHOICE_GetIndexFromValue
*
* In : pThis = Pointer to List to the MSO_CHOICE object.
*
* wValue = Value, who's index is to be searched for.
*
* Out : None.
*
* Return : Index corresponding to wValue.
*
* Desc : This function search the table of value (mpData), and returns the index number
* corresponding to wValue. Returns index of the first item if the value cannot be
* found in the table.
****************************************************************************************/
UINT8 OCHOICE_GetIndexFromValue(MSO_OBJECT __NEAR* pThis, UINT16 wValue)
{
if(NULL != pThis)
{
UINT8 cIndex;
MS_DESCRIPTOR_CHOICE* pDescriptor = (MS_DESCRIPTOR_CHOICE*)pThis->mpDescriptor;
for(cIndex = 0; cIndex < pDescriptor->mcTotalValues; cIndex++)
{
if(wValue == pDescriptor->mpData[cIndex].mwValue)
return cIndex;
}
}
return 0;// Return index of the first item, if the specified value is not found.
}
/***************************************************************************************
* Function : OCHOICE_GetValueFromIndex
*
* In : pThis = Pointer to List to the MSO_CHOICE object.
*
* wIndex = Index, who's value is to be searched for.
*
* Out : None.
*
* Return : Value corresponding to wIndex.
*
* Desc : This function returns the value (mpData) at index wIndex in the mpData table.
****************************************************************************************/
UINT16 OCHOICE_GetValueFromIndex(MSO_OBJECT __NEAR* pThis, UINT16 wIndex)
{
if(NULL != pThis)
{
MS_DESCRIPTOR_CHOICE* pDescriptor = (MS_DESCRIPTOR_CHOICE*)pThis->mpDescriptor;
if(wIndex >= pDescriptor->mcTotalValues)
return INVALID_VALUE;
else
return pDescriptor->mpData[wIndex].mwValue;
}
return INVALID_VALUE;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -