本文整理汇总了C++中WritingMode::IsVerticalLR方法的典型用法代码示例。如果您正苦于以下问题:C++ WritingMode::IsVerticalLR方法的具体用法?C++ WritingMode::IsVerticalLR怎么用?C++ WritingMode::IsVerticalLR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WritingMode
的用法示例。
在下文中一共展示了WritingMode::IsVerticalLR方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
nsNativeTheme::IsFrameRTL(nsIFrame* aFrame)
{
if (!aFrame) {
return false;
}
WritingMode wm = aFrame->GetWritingMode();
return !(wm.IsVertical() ? wm.IsVerticalLR() : wm.IsBidiLTR());
}
示例2: GetWritingModeName
explicit GetWritingModeName(const WritingMode& aWritingMode)
{
if (!aWritingMode.IsVertical()) {
Assign("Horizontal");
return;
}
if (aWritingMode.IsVerticalLR()) {
Assign("Vertical (LTR)");
return;
}
Assign("Vertical (RTL)");
}
示例3:
void
nsCaret::ComputeCaretRects(nsIFrame* aFrame, int32_t aFrameOffset,
nsRect* aCaretRect, nsRect* aHookRect)
{
NS_ASSERTION(aFrame, "Should have a frame here");
WritingMode wm = aFrame->GetWritingMode();
bool isVertical = wm.IsVertical();
nscoord bidiIndicatorSize;
*aCaretRect = GetGeometryForFrame(aFrame, aFrameOffset, &bidiIndicatorSize);
// on RTL frames the right edge of mCaretRect must be equal to framePos
const nsStyleVisibility* vis = aFrame->StyleVisibility();
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
if (isVertical) {
aCaretRect->y -= aCaretRect->height;
} else {
aCaretRect->x -= aCaretRect->width;
}
}
// Simon -- make a hook to draw to the left or right of the caret to show keyboard language direction
aHookRect->SetEmpty();
if (!IsBidiUI()) {
return;
}
bool isCaretRTL;
nsIBidiKeyboard* bidiKeyboard = nsContentUtils::GetBidiKeyboard();
// if bidiKeyboard->IsLangRTL() fails, there is no way to tell the
// keyboard direction, or the user has no right-to-left keyboard
// installed, so we never draw the hook.
if (bidiKeyboard && NS_SUCCEEDED(bidiKeyboard->IsLangRTL(&isCaretRTL))) {
// If keyboard language is RTL, draw the hook on the left; if LTR, to the right
// The height of the hook rectangle is the same as the width of the caret
// rectangle.
if (isVertical) {
bool isSidewaysLR = wm.IsVerticalLR() && !wm.IsLineInverted();
if (isSidewaysLR) {
aHookRect->SetRect(aCaretRect->x + bidiIndicatorSize,
aCaretRect->y + (!isCaretRTL ? bidiIndicatorSize * -1 :
aCaretRect->height),
aCaretRect->height,
bidiIndicatorSize);
} else {
aHookRect->SetRect(aCaretRect->XMost() - bidiIndicatorSize,
aCaretRect->y + (isCaretRTL ? bidiIndicatorSize * -1 :
aCaretRect->height),
aCaretRect->height,
bidiIndicatorSize);
}
} else {
aHookRect->SetRect(aCaretRect->x + (isCaretRTL ? bidiIndicatorSize * -1 :
aCaretRect->width),
aCaretRect->y + bidiIndicatorSize,
bidiIndicatorSize,
aCaretRect->width);
}
}
}