本文整理汇总了C++中HyperTextAccessible::CharBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ HyperTextAccessible::CharBounds方法的具体用法?C++ HyperTextAccessible::CharBounds怎么用?C++ HyperTextAccessible::CharBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HyperTextAccessible
的用法示例。
在下文中一共展示了HyperTextAccessible::CharBounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
NS_IMETHODIMP
xpcAccessibleHyperText::GetCharacterExtents(int32_t aOffset,
int32_t* aX, int32_t* aY,
int32_t* aWidth, int32_t* aHeight,
uint32_t aCoordType)
{
NS_ENSURE_ARG_POINTER(aX);
NS_ENSURE_ARG_POINTER(aY);
NS_ENSURE_ARG_POINTER(aWidth);
NS_ENSURE_ARG_POINTER(aHeight);
*aX = *aY = *aWidth = *aHeight;
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
if (text->IsDefunct())
return NS_ERROR_FAILURE;
nsIntRect rect = text->CharBounds(aOffset, aCoordType);
*aX = rect.x; *aY = rect.y;
*aWidth = rect.width; *aHeight = rect.height;
return NS_OK;
}
示例2: GetAccessibleWrap
static void
getCharacterExtentsCB(AtkText *aText, gint aOffset,
gint *aX, gint *aY,
gint *aWidth, gint *aHeight,
AtkCoordType aCoords)
{
if(!aX || !aY || !aWidth || !aHeight) {
return;
}
nsIntRect rect;
uint32_t geckoCoordType;
if (aCoords == ATK_XY_SCREEN) {
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
} else {
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
}
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (accWrap) {
HyperTextAccessible* text = accWrap->AsHyperText();
if (!text || !text->IsTextRole()) {
return;
}
rect = text->CharBounds(aOffset, geckoCoordType);
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
rect = proxy->CharBounds(aOffset, geckoCoordType);
} else {
return;
}
*aX = rect.x;
*aY = rect.y;
*aWidth = rect.width;
*aHeight = rect.height;
}