NS_IMETHODIMP inDeepTreeWalker::PreviousNode(nsIDOMNode **_retval) { if (!mCurrentNode || mStack.Length() == 1) { // Nowhere to go from here *_retval = nullptr; return NS_OK; } nsCOMPtr<nsIDOMNode> node; PreviousSibling(getter_AddRefs(node)); if (!node) { return ParentNode(_retval); } // Now we're positioned at our previous sibling. But since the DOM tree // traversal is depth-first, the previous node is its most deeply nested last // child. Just loop until LastChild() returns null; since the LastChild() // call that returns null won't affect our position, we will then be // positioned at the correct node. while (node) { LastChild(getter_AddRefs(node)); } NS_ADDREF(*_retval = mCurrentNode); return NS_OK; }
const TiXmlElement* TiXmlNode::PreviousSiblingElement( const char * _value ) const { const TiXmlNode* node; for ( node = PreviousSibling( _value ); node; node = node->PreviousSibling( _value ) ) { if ( node->ToElement() ) return node->ToElement(); } return 0; }
void BRadioButton::SetValue(int32 value) { if (value != Value()) { BControl::SetValueNoUpdate(value); Invalidate(); if (value == B_CONTROL_ON) { for (BView *sibling = NextSibling(); sibling != NULL; sibling = sibling->NextSibling()) { BRadioButton *rbtn = cast_as(sibling, BRadioButton); if (rbtn != NULL) rbtn->SetValue(B_CONTROL_OFF); } for (BView *sibling = PreviousSibling(); sibling != NULL; sibling = sibling->PreviousSibling()) { BRadioButton *rbtn = cast_as(sibling, BRadioButton); if (rbtn != NULL) rbtn->SetValue(B_CONTROL_OFF); } } } }
void SeqSplitterView::MouseMoved( BPoint where, uint32 code, const BMessage* message) { if (code == B_ENTERED_VIEW) { if (mDirection == B_VERTICAL && gVrtCursor) SetViewCursor(gVrtCursor); if (mDirection == B_HORIZONTAL && gHrzCursor) SetViewCursor(gHrzCursor); } if( !mMouseDown || !Window() || !Window()->CurrentMessage() ) return; BView* prev = PreviousSibling(); BView* next = NextSibling(); if( !prev || !next ) return; // The mouse moved message's "where" field is in window // coordinates. We need to use that instead of view // coordinates because the changes in this view's frame // are asynchronous with the mouse events we receive. BPoint screenWhere; Window()->CurrentMessage()->FindPoint("where", &screenWhere); Window()->ConvertToScreen(&screenWhere); BPoint delta = screenWhere - mPointDown; bool locked = false; //printf("recived mouse of %f\n", where.x); if( Window() && Window()->Lock() ) { locked = true; Window()->BeginViewTransaction(); } if( mDirection == B_VERTICAL ) { /* Move me */ float prevLeft = prev->Frame().left; float nextRight = next->Frame().right; float x = mFrameDown.left + delta.x; float y = mFrameDown.top; if( x < prevLeft ) x = prevLeft; if( x + Bounds().Width() > nextRight ) x = nextRight - Bounds().Width(); MoveTo( x, y ); /* Move prev */ float height = prev->Bounds().Height(); float prevRight = Frame().left - 1; prev->ResizeTo( prevRight - prevLeft, height ); /* Move next */ height = next->Bounds().Height(); float nextTop = next->Frame().top; float nextLeft = Frame().right + 1; //printf("\tsending out move to %f\n", nextLeft); BRect f = next->Frame(); if( f.left != nextLeft ) next->MoveTo( nextLeft, nextTop ); if( f.Width() != nextRight - nextLeft ) next->ResizeTo( nextRight - nextLeft, height ); #if 0 next->MoveTo( nextLeft, nextTop ); next->ResizeTo( nextRight - nextLeft, height ); #endif } else { /* Move me */ float prevTop = prev->Frame().top; float nextBottom = next->Frame().bottom; float x = mFrameDown.left; float y = mFrameDown.top + delta.y; if( y < prevTop ) y = prevTop; if( y + Bounds().Height() > nextBottom ) y = nextBottom - Bounds().Height(); MoveTo( x, y ); /* Move prev */ float width = prev->Bounds().Width(); float prevBottom = Frame().top - 1; prev->ResizeTo( width, prevBottom - prevTop ); /* Move next */ width = next->Bounds().Width(); float nextLeft = next->Frame().left; float nextTop = Frame().bottom + 1; next->MoveTo( nextLeft, nextTop ); next->ResizeTo( width, nextBottom - nextTop ); } if( locked ) { Window()->EndViewTransaction(); Window()->Unlock(); } }
if( locked ) { Window()->EndViewTransaction(); Window()->Unlock(); } } void SeqSplitterView::SetDrawingFlags(uint32 flags) { mDrawingFlags = flags; } void SeqSplitterView::MoveVerticalSplitter(float left) { ArpVALIDATE(mDirection == B_VERTICAL, return); BView* prev = PreviousSibling(); BView* next = NextSibling(); if (!prev || !next) return; /* Move me */ float prevLeft = prev->Frame().left; float nextRight = next->Frame().right; float x = left; float y = Frame().top; if (x < prevLeft) x = prevLeft; if (x + Bounds().Width() > nextRight ) x = nextRight - Bounds().Width(); MoveTo(x, y); /* Move prev */ float height = prev->Bounds().Height(); float prevRight = Frame().left - 1;