本文整理汇总了C++中nsSplitterFrame::StyleVisibility方法的典型用法代码示例。如果您正苦于以下问题:C++ nsSplitterFrame::StyleVisibility方法的具体用法?C++ nsSplitterFrame::StyleVisibility怎么用?C++ nsSplitterFrame::StyleVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsSplitterFrame
的用法示例。
在下文中一共展示了nsSplitterFrame::StyleVisibility方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetResizeAfter
void
nsSplitterFrameInner::MouseDrag(nsPresContext* aPresContext, nsGUIEvent* aEvent)
{
if (mDragging && mOuter) {
//printf("Dragging\n");
bool isHorizontal = !mOuter->IsHorizontal();
// convert coord to pixels
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
mParentBox);
nscoord pos = isHorizontal ? pt.x : pt.y;
// mDragStart is in frame coordinates
nscoord start = mDragStart;
// take our current position and subtract the start location
pos -= start;
//printf("Diff=%d\n", pos);
ResizeType resizeAfter = GetResizeAfter();
bool bounded;
if (resizeAfter == nsSplitterFrameInner::Grow)
bounded = false;
else
bounded = true;
int i;
for (i=0; i < mChildInfosBeforeCount; i++)
mChildInfosBefore[i].changed = mChildInfosBefore[i].current;
for (i=0; i < mChildInfosAfterCount; i++)
mChildInfosAfter[i].changed = mChildInfosAfter[i].current;
nscoord oldPos = pos;
ResizeChildTo(aPresContext, pos, mChildInfosBefore, mChildInfosAfter, mChildInfosBeforeCount, mChildInfosAfterCount, bounded);
State currentState = GetState();
bool supportsBefore = SupportsCollapseDirection(Before);
bool supportsAfter = SupportsCollapseDirection(After);
const bool isRTL = mOuter->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
bool pastEnd = oldPos > 0 && oldPos > pos;
bool pastBegin = oldPos < 0 && oldPos < pos;
if (isRTL) {
// Swap the boundary checks in RTL mode
bool tmp = pastEnd;
pastEnd = pastBegin;
pastBegin = tmp;
}
const bool isCollapsedBefore = pastBegin && supportsBefore;
const bool isCollapsedAfter = pastEnd && supportsAfter;
// if we are in a collapsed position
if (isCollapsedBefore || isCollapsedAfter)
{
// and we are not collapsed then collapse
if (currentState == Dragging) {
if (pastEnd)
{
//printf("Collapse right\n");
if (supportsAfter)
{
nsCOMPtr<nsIContent> outer = mOuter->mContent;
outer->SetAttr(kNameSpaceID_None, nsGkAtoms::substate,
NS_LITERAL_STRING("after"),
true);
outer->SetAttr(kNameSpaceID_None, nsGkAtoms::state,
NS_LITERAL_STRING("collapsed"),
true);
}
} else if (pastBegin)
{
//printf("Collapse left\n");
if (supportsBefore)
{
nsCOMPtr<nsIContent> outer = mOuter->mContent;
outer->SetAttr(kNameSpaceID_None, nsGkAtoms::substate,
NS_LITERAL_STRING("before"),
true);
outer->SetAttr(kNameSpaceID_None, nsGkAtoms::state,
NS_LITERAL_STRING("collapsed"),
true);
}
}
}
} else {
// if we are not in a collapsed position and we are not dragging make sure
// we are dragging.
if (currentState != Dragging)
mOuter->mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::state, NS_LITERAL_STRING("dragging"), true);
AdjustChildren(aPresContext);
}
mDidDrag = true;
//.........这里部分代码省略.........