本文整理汇总了C++中nsSplitterFrame::GetContent方法的典型用法代码示例。如果您正苦于以下问题:C++ nsSplitterFrame::GetContent方法的具体用法?C++ nsSplitterFrame::GetContent怎么用?C++ nsSplitterFrame::GetContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsSplitterFrame
的用法示例。
在下文中一共展示了nsSplitterFrame::GetContent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveEventListenerByIID
void
nsSplitterFrameInner::RemoveListener()
{
ENSURE_TRUE(mOuter);
mOuter->GetContent()->
RemoveEventListenerByIID(static_cast<nsIDOMMouseListener*>(this),
NS_GET_IID(nsIDOMMouseListener));
mOuter->GetContent()->
RemoveEventListenerByIID(static_cast<nsIDOMMouseMotionListener*>(this),
NS_GET_IID(nsIDOMMouseMotionListener));
}
示例2: AddEventListener
void
nsSplitterFrameInner::AddListener(nsPresContext* aPresContext)
{
mOuter->GetContent()->
AddEventListener(NS_LITERAL_STRING("mouseup"), this, false, false);
mOuter->GetContent()->
AddEventListener(NS_LITERAL_STRING("mousedown"), this, false, false);
mOuter->GetContent()->
AddEventListener(NS_LITERAL_STRING("mousemove"), this, false, false);
mOuter->GetContent()->
AddEventListener(NS_LITERAL_STRING("mouseout"), this, false, false);
}
示例3: RemoveEventListener
void
nsSplitterFrameInner::RemoveListener()
{
ENSURE_TRUE(mOuter);
mOuter->GetContent()->
RemoveEventListener(NS_LITERAL_STRING("mouseup"), this, false);
mOuter->GetContent()->
RemoveEventListener(NS_LITERAL_STRING("mousedown"), this, false);
mOuter->GetContent()->
RemoveEventListener(NS_LITERAL_STRING("mousemove"), this, false);
mOuter->GetContent()->
RemoveEventListener(NS_LITERAL_STRING("mouseout"), this, false);
}
示例4: AdjustChildren
void
nsSplitterFrameInner::MouseUp(nsPresContext* aPresContext, nsGUIEvent* aEvent)
{
if (mDragging && mOuter) {
AdjustChildren(aPresContext);
AddListener(aPresContext);
nsIPresShell::SetCapturingContent(nullptr, 0); // XXXndeakin is this needed?
mDragging = false;
State newState = GetState();
// if the state is dragging then make it Open.
if (newState == Dragging)
mOuter->mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::state, EmptyString(), true);
mPressed = false;
// if we dragged then fire a command event.
if (mDidDrag) {
nsCOMPtr<nsIDOMXULElement> element = do_QueryInterface(mOuter->GetContent());
element->DoCommand();
}
//printf("MouseUp\n");
}
delete[] mChildInfosBefore;
delete[] mChildInfosAfter;
mChildInfosBefore = nullptr;
mChildInfosAfter = nullptr;
mChildInfosBeforeCount = 0;
mChildInfosAfterCount = 0;
}
示例5: switch
nsSplitterFrameInner::ResizeType
nsSplitterFrameInner::GetResizeBefore()
{
static nsIContent::AttrValuesArray strings[] =
{&nsGkAtoms::farthest, &nsGkAtoms::flex, nullptr};
switch (mOuter->GetContent()->FindAttrValueIn(kNameSpaceID_None,
nsGkAtoms::resizebefore,
strings, eCaseMatters)) {
case 0: return Farthest;
case 1: return Flex;
}
return Closest;
}
示例6: state
nsresult
nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_TRUE(mOuter, NS_OK);
nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));
if (!mouseEvent)
return NS_OK;
PRUint16 button = 0;
mouseEvent->GetButton(&button);
// only if left button
if (button != 0)
return NS_OK;
if (mOuter->GetContent()->
AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
nsGkAtoms::_true, eCaseMatters))
return NS_OK;
mParentBox = mOuter->GetParentBox();
if (!mParentBox)
return NS_OK;
// get our index
nsPresContext* outerPresContext = mOuter->PresContext();
const nsFrameList& siblingList(mParentBox->PrincipalChildList());
PRInt32 childIndex = siblingList.IndexOf(mOuter);
// if it's 0 (or not found) then stop right here.
// It might be not found if we're not in the parent's primary frame list.
if (childIndex <= 0)
return NS_OK;
PRInt32 childCount = siblingList.GetLength();
// if it's the last index then we need to allow for resizeafter="grow"
if (childIndex == childCount - 1 && GetResizeAfter() != Grow)
return NS_OK;
nsRefPtr<nsRenderingContext> rc =
outerPresContext->PresShell()->GetReferenceRenderingContext();
NS_ENSURE_TRUE(rc, NS_ERROR_FAILURE);
nsBoxLayoutState state(outerPresContext, rc);
mCurrentPos = 0;
mPressed = true;
mDidDrag = false;
EnsureOrient();
bool isHorizontal = !mOuter->IsHorizontal();
ResizeType resizeBefore = GetResizeBefore();
ResizeType resizeAfter = GetResizeAfter();
delete[] mChildInfosBefore;
delete[] mChildInfosAfter;
mChildInfosBefore = new nsSplitterInfo[childCount];
mChildInfosAfter = new nsSplitterInfo[childCount];
// create info 2 lists. One of the children before us and one after.
PRInt32 count = 0;
mChildInfosBeforeCount = 0;
mChildInfosAfterCount = 0;
nsIFrame* childBox = mParentBox->GetChildBox();
while (nullptr != childBox)
{
nsIContent* content = childBox->GetContent();
nsIDocument* doc = content->OwnerDoc();
PRInt32 dummy;
nsIAtom* atom = doc->BindingManager()->ResolveTag(content, &dummy);
// skip over any splitters
if (atom != nsGkAtoms::splitter) {
nsSize prefSize = childBox->GetPrefSize(state);
nsSize minSize = childBox->GetMinSize(state);
nsSize maxSize = nsBox::BoundsCheckMinMax(minSize, childBox->GetMaxSize(state));
prefSize = nsBox::BoundsCheck(minSize, prefSize, maxSize);
mOuter->AddMargin(childBox, minSize);
mOuter->AddMargin(childBox, prefSize);
mOuter->AddMargin(childBox, maxSize);
nscoord flex = childBox->GetFlex(state);
nsMargin margin(0,0,0,0);
childBox->GetMargin(margin);
nsRect r(childBox->GetRect());
r.Inflate(margin);
// We need to check for hidden attribute too, since treecols with
// the hidden="true" attribute are not really hidden, just collapsed
if (!content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::fixed,
nsGkAtoms::_true, eCaseMatters) &&
!content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
nsGkAtoms::_true, eCaseMatters)) {
if (count < childIndex && (resizeBefore != Flex || flex > 0)) {
mChildInfosBefore[mChildInfosBeforeCount].childElem = content;
mChildInfosBefore[mChildInfosBeforeCount].min = isHorizontal ? minSize.width : minSize.height;
mChildInfosBefore[mChildInfosBeforeCount].max = isHorizontal ? maxSize.width : maxSize.height;
//.........这里部分代码省略.........