本文整理汇总了C++中Area::ParseCoords方法的典型用法代码示例。如果您正苦于以下问题:C++ Area::ParseCoords方法的具体用法?C++ Area::ParseCoords怎么用?C++ Area::ParseCoords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Area
的用法示例。
在下文中一共展示了Area::ParseCoords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
nsresult
nsImageMap::AddArea(nsIContent* aArea)
{
static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::rect, &nsGkAtoms::rectangle,
&nsGkAtoms::circle, &nsGkAtoms::circ,
&nsGkAtoms::_default,
&nsGkAtoms::poly, &nsGkAtoms::polygon,
nullptr};
Area* area;
switch (aArea->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::shape,
strings, eIgnoreCase)) {
case nsIContent::ATTR_VALUE_NO_MATCH:
case nsIContent::ATTR_MISSING:
case 0:
case 1:
area = new RectArea(aArea);
break;
case 2:
case 3:
area = new CircleArea(aArea);
break;
case 4:
area = new DefaultArea(aArea);
break;
case 5:
case 6:
area = new PolyArea(aArea);
break;
default:
area = nullptr;
NS_NOTREACHED("FindAttrValueIn returned an unexpected value.");
break;
}
if (!area)
return NS_ERROR_OUT_OF_MEMORY;
//Add focus listener to track area focus changes
aArea->AddSystemEventListener(NS_LITERAL_STRING("focus"), this, false,
false);
aArea->AddSystemEventListener(NS_LITERAL_STRING("blur"), this, false,
false);
// This is a nasty hack. It needs to go away: see bug 135040. Once this is
// removed, the code added to RestyleManager::RestyleElement,
// nsCSSFrameConstructor::ContentRemoved (both hacks there), and
// RestyleManager::ProcessRestyledFrames to work around this issue can
// be removed.
aArea->SetPrimaryFrame(mImageFrame);
nsAutoString coords;
aArea->GetAttr(kNameSpaceID_None, nsGkAtoms::coords, coords);
area->ParseCoords(coords);
mAreas.AppendElement(area);
return NS_OK;
}
示例2: switch
nsresult
nsImageMap::AddArea(nsIContent* aArea)
{
nsAutoString coords;
static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::_empty, &nsGkAtoms::rect, &nsGkAtoms::rectangle,
&nsGkAtoms::poly, &nsGkAtoms::polygon, &nsGkAtoms::circle,
&nsGkAtoms::circ, &nsGkAtoms::_default, nsnull};
aArea->GetAttr(kNameSpaceID_None, nsGkAtoms::coords, coords);
Area* area;
switch (aArea->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::shape,
strings, eIgnoreCase)) {
case nsIContent::ATTR_MISSING:
case 0:
case 1:
case 2:
area = new RectArea(aArea);
break;
case 3:
case 4:
area = new PolyArea(aArea);
break;
case 5:
case 6:
area = new CircleArea(aArea);
break;
case 7:
area = new DefaultArea(aArea);
break;
default:
// Unknown area type; bail
return NS_OK;
}
if (!area)
return NS_ERROR_OUT_OF_MEMORY;
//Add focus listener to track area focus changes
aArea->AddEventListenerByIID(this, NS_GET_IID(nsIDOMFocusListener));
// This is a nasty hack. It needs to go away: see bug 135040. Once this is
// removed, the code added to nsCSSFrameConstructor::RestyleElement,
// nsCSSFrameConstructor::ContentRemoved (both hacks there), and
// nsCSSFrameConstructor::ProcessRestyledFrames to work around this issue can
// be removed.
aArea->SetPrimaryFrame(mImageFrame);
area->ParseCoords(coords);
mAreas.AppendElement(area);
return NS_OK;
}