예제 #1
0
	    void OnPaint(wxPaintEvent& event)
        {
	        wxPaintDC dc(this);

	        wxTreeCtrl::OnPaint(event);

            // Reset the device origin since it may have been set
            dc.SetDeviceOrigin(0, 0);

	        wxPen pen(wxColour(_T("BLACK")), 1, wxSOLID);
	        dc.SetPen(pen);
            
	        dc.SetBrush(* wxTRANSPARENT_BRUSH);

            wxSize clientSize = GetClientSize();
	        wxRect itemRect;
	        int cy=0;
	        wxTreeItemId h, lastH;
	        for(h=GetFirstVisibleItem();h;h=GetNextVisible(h))
	        {
		        if (h.IsOk() && GetBoundingRect(h, itemRect))
		        {
			        cy = itemRect.GetTop();
			        dc.DrawLine(0, cy, clientSize.x, cy);
			        lastH = h;
		        }
	        }
	        if (lastH.IsOk() && GetBoundingRect(lastH, itemRect))
	        {
		        cy = itemRect.GetBottom();
		        dc.DrawLine(0, cy, clientSize.x, cy);
	        }
        }
/*
 * Paint the row lines.
 */
void CScrolledTreeCtrl::OnPaint(wxPaintEvent& event)
{
    wxPaintDC dc(this);

    wxTreeCtrl::OnPaint(event);

    if (! m_drawRowLines)
        return;

    // Reset the device origin since it may have been set
    dc.SetDeviceOrigin(0, 0);

    wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
    dc.SetPen(pen);
    dc.SetBrush(* wxTRANSPARENT_BRUSH);

    wxSize clientSize = GetClientSize();
    wxRect itemRect;
    int cy=0;
    wxTreeItemId h, lastH;
    for(h = GetFirstVisibleItem(); h.IsOk(); h = GetNextVisible(h)) {
        if (GetBoundingRect(h, itemRect)) {
            cy = itemRect.GetTop();
            dc.DrawLine(0, cy, clientSize.x, cy);
            lastH = h;
        }
        if (!IsVisible(h)) {
            break;
        }
    }
    if (lastH.IsOk() && GetBoundingRect(lastH, itemRect)) {
        cy = itemRect.GetBottom();
        dc.DrawLine(0, cy, clientSize.x, cy);
    }
}
예제 #3
0
void FixSubgraphSizes(ICluster * cluster, RectD  & parentRect)
{
	RectD childRect;
	for(IClusterSet::const_iterator itr = cluster->GetClusters().begin(); itr != cluster->GetClusters().end(); ++itr)
	{
		std::string cluster;
		FixSubgraphSizes(itr->get(), childRect);
	}

	for(IVertexSet::const_iterator itr = cluster->GetVertices().begin(); itr != cluster->GetVertices().end(); ++itr)
	{
		if (childRect.IsEmptyArea())
			childRect = GetBoundingRect(itr->get());
		else
			childRect.Union(GetBoundingRect(itr->get()));
	}

	//if (!GetBoundingRect(cluster).Contains(childRect))
	{
		if (childRect.IsEmptyArea())
			childRect = GetBoundingRect(cluster);
		else
			childRect.Union(GetBoundingRect(cluster));


		if (ElementG * eg = GetElementG(cluster))
		{
			assert(eg->m_polygons.size() == 1);
			if (eg->m_polygons.size() == 1)
			{
				eg->m_polygons[0]->m_points.clear();
				eg->m_polygons[0]->SetBoundingBox(RectD());
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetLeft(), childRect.GetBottom()));
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetLeft(), childRect.GetTop()));
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetRight(), childRect.GetTop()));
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetRight(), childRect.GetBottom()));
				eg->m_polygons[0]->m_points.push_back(PointD(childRect.GetLeft(), childRect.GetBottom()));
			}
			//eg->SetBoundingBox(childRect);
			eg->CalcBoundingBox();
		}

		//childRect.Union(GetBoundingRect(cluster));
		//ElementGPtr elementG = new ElementG(childRect);
		//cluster->SetProperty(SVG_PROP_ELEMENTG, elementG);
	}
	if (parentRect.IsEmptyArea())
		parentRect = childRect;
	else
		parentRect.Union(childRect);
}
예제 #4
0
void NodeBrush::RenderObjectBlobs(RenderRegion* pRegion)
{
#if !defined(EXCLUDE_FROM_RALPH)
    // Find out about the groups bounding rect
    DocRect BoundingRect = GetBoundingRect();

    // Inflate the bounds by the width of a blob
    DocRect TempRect;
    GetApplication()->GetBlobManager()->GetBlobRect(BoundingRect.lo,&TempRect);
    INT32 Delta = ((TempRect.hi.x - TempRect.lo.x)*3)/4;
    BoundingRect.Inflate(Delta);

    // Find out where to draw the blobs
    DocCoord Low  = BoundingRect.LowCorner();
    DocCoord High = BoundingRect.HighCorner();

    // Set the colours of the blobs
    pRegion->SetFillColour(COLOUR_UNSELECTEDBLOB);
    pRegion->SetLineColour(COLOUR_NONE);

    // Draw all the blobs
    pRegion->DrawBlob(Low, BT_UNSELECTED);
    pRegion->DrawBlob(High, BT_UNSELECTED);
    pRegion->DrawBlob(DocCoord(Low.x, High.y), BT_UNSELECTED);
    pRegion->DrawBlob(DocCoord(High.x, Low.y), BT_UNSELECTED);

    // for some reason the NBP is never called, there is probably a
    // proper fix for this but I don't have time right now, so render
    // the nodeblend path here
    m_pNodeBrushPath->RenderObjectBlobs(pRegion);


#endif
}
예제 #5
0
Projectile::Projectile( Type type, const TextureManager & textures, b2Body * body ) :
	Entity( 1, body ),
	pImpl( new Impl( type, textures ) )
{
	// Add particle system for missiles
	if ( IsGuided() )
	{
		std::unique_ptr<EmitterNode> smoke( new EmitterNode( Particle::Type::Smoke ) );
		smoke->setPosition( 0.f, GetBoundingRect().height / 2.f );
		AttachChild( std::move( smoke ) );

		std::unique_ptr<EmitterNode> propellant( new EmitterNode( Particle::Type::Propellant ) );
		propellant->setPosition( 0.f, GetBoundingRect().height / 2.f );
		AttachChild( std::move( propellant ) );
	}
}
예제 #6
0
void ListedTextItems::ClearEntries()
{
    Rect oldrect = GetBoundingRect();
    _items.Clear();
    OnItemsClear();
    SetDimensions( GetWidth(), GetH() );
}
예제 #7
0
파일: svlTypes.cpp 프로젝트: Shuyoung/cisst
bool svlTriangle::IsWithin(int x, int y) const
{
    // Test bounding rectangle first; that's fast
    svlRect bounding;
    GetBoundingRect(bounding);
    if (bounding.IsWithin(x, y) == false) return false;

    // Perform proper test next
    vctFloat2 v0(x3 - x1, y3 - y1);
    vctFloat2 v1(x2 - x1, y2 - y1);
    vctFloat2 v2(x - x1, y - y1);

    const float dp00 = v0.DotProduct(v0);
    const float dp01 = v0.DotProduct(v1);
    const float dp02 = v0.DotProduct(v2);
    const float dp11 = v1.DotProduct(v1);
    const float dp12 = v1.DotProduct(v2);

    float det = dp00 * dp11 - dp01 * dp01;
    if (det == 0.0f) return false;
    det = 1.0f / det;

    const float u = (dp11 * dp02 - dp01 * dp12) * det;
    const float v = (dp00 * dp12 - dp01 * dp02) * det;

    if (u >= 0.0f && v >= 0.0f && (u + v) < 1.0f) return true;
    return false;
}
예제 #8
0
void Widget::AlignSize ( const Rect &offsetAndSize, const Pos &placement )
{
    Rect my_rect = GetBoundingRect() + GetPosition();
    Rect rect = my_rect;
    // align width
    if ( offsetAndSize.w > 0 )
    {
        rect.w -= offsetAndSize.x;
        rect.w /= offsetAndSize.w;
        rect.w *= offsetAndSize.w;
        rect.w += offsetAndSize.x;
    }
    // align height
    if ( offsetAndSize.h > 0 )
    {
        rect.h -= offsetAndSize.y;
        rect.h /= offsetAndSize.h;
        rect.h *= offsetAndSize.h;
        rect.h += offsetAndSize.y;
    }
    rect.x = my_rect.x + ((my_rect.w - rect.w) * placement.x / 100);
    rect.y = my_rect.y + ((my_rect.h - rect.h) * placement.y / 100);
    // apply new size
    Resize( rect.w, rect.h );
    // apply new position
    SetPosition( rect.GetPos() );
}
예제 #9
0
grenade::grenade(float x, float y, player* _player)
{ 
	armStat stats = _player->getArmStat();

	loadFromTex(*images::allProjectiles.find(stats.projName)->second);
	assert(IsLoaded());

	_player->setArmFacing(sf::Vector2f(x,y));

	accX = 0;
	accY = _player->gravity;

	sf::Vector2f armPos = _player->getArmTip();

	float angle = _player->getArmRotation();
	
	const float pi = 3.14159265f;
	velX = cos(angle*pi/180)*stats.projectileSpeed;
	velY = sin(angle*pi/180)*stats.projectileSpeed;

	ownerPlayerNum = _player->getPlayerNum();
	boxDamage = stats.boxDamage;
	playerDamage = stats.playerDamage;

	expRadius = stats.explRadius;
	knockForce = stats.force;
	explTime = stats.explTime;
	knockTime = stats.knockTime;

	SetPosition(armPos.x, armPos.y-GetBoundingRect().height/2);
}
예제 #10
0
void Widget::Align( int inner_alignment)
{
    Rect client_area = GetParent()->GetClientRect( this);
    Rect bound = GetBoundingRect() + GetPosition();
    bound.Align( client_area, Rect::Alignment( inner_alignment));
    SetBoundingRect( bound);
}
예제 #11
0
/**
 * Method used to draw the box around a specified node
 * 
 * @param id    The node that needs the box
 */
void DecoratedTree::DrawOutline(wxTreeItemId id)
{
    // Add the new decorations
    wxRect bound;
    int w, h;
    bool visible;
    wxTreeItemIdValue cookie;
    wxTreeItemId current = GetFirstChild(id, cookie);
    
    GetSize(&w, &h);
    wxClientDC dc(this);

    //wxWidgets-2.6.3:deprecated->dc.BeginDrawing();
    
    while (current > (wxTreeItemId)0) {
        visible = GetBoundingRect(current, bound, TRUE);
        dc.SetPen(wxPen(wxColour(0xaf, 0xaf, 0xaf), 1, wxSOLID));

        // Top and bottom
        dc.DrawLine(bound.x, bound.y-1, w-offset, bound.y-1);
        dc.DrawLine(bound.x, bound.y+rowHeight+1, w-offset, bound.y+rowHeight+1);
        dc.DrawLine(bound.x, bound.y-1, bound.x, bound.y+rowHeight+1);
        dc.DrawLine(w-offset, bound.y+1, w-offset, bound.y+rowHeight+1);

//          dc.DrawLine(4, bound.y-1, w-20, bound.y-1);
//          dc.DrawLine(4, bound.y+rowHeight+1, w-20, bound.y+rowHeight+1);
//          dc.DrawLine(4, bound.y-1, 4, bound.y+rowHeight+1);
//          dc.DrawLine(w-20, bound.y+1, w-20, bound.y+rowHeight+1);
        
        DrawOutline(current);
        current = GetNextChild(id, cookie);
    }
    
    //wxWidgets-2.6.3:deprecated->dc.EndDrawing();
}
예제 #12
0
파일: treetest.cpp 프로젝트: gitrider/wxsj2
void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event)
{
    wxPoint pt = event.GetPosition();
    wxTreeItemId item;
    if ( !HasFlag(wxTR_MULTIPLE) )
        item = GetSelection();
    wxLogMessage(wxT("OnContextMenu at screen coords (%i, %i)"), pt.x, pt.y);

    // check if event was generated by keyboard (MSW-specific?)
    if ( pt.x == -1 && pt.y == -1 ) //(this is how MSW indicates it)
    {
        // attempt to guess where to show the menu
        if ( item.IsOk() )
        {
            // if an item was clicked, show menu to the right of it
            wxRect rect;
            GetBoundingRect(item, rect, true /* only the label */);
            pt = wxPoint(rect.GetRight(), rect.GetTop());
        }
        else
        {
            pt = wxPoint(0, 0);
        }
    }
    else // event was generated by mouse, use supplied coords
    {
        pt = ScreenToClient(pt);
    }

    ShowMenu(item, pt);
}
예제 #13
0
int ListedTextItems::ItemAtPosition( const Pos &pos) const
{
    if ( GetBoundingRect().IsInside( pos.x, pos.y ) ) 
    { 
        return pos.y/_entry_height; 
    }
    return -1;
}
예제 #14
0
int TableListedItems::ItemAtPosition( const Pos &pos) const 
{ 
    if ( GetBoundingRect().IsInside( pos.x, pos.y ) ) 
    { 
        return TableWidget::GetRow(pos.y);
    }
    return -1;
}
예제 #15
0
wxSize wxTreeCtrlBase::DoGetBestSize() const
{
    wxSize size;

    // this doesn't really compute the total bounding rectangle of all items
    // but a not too bad guess of it which has the advantage of not having to
    // examine all (potentially hundreds or thousands) items in the control

    if (GetQuickBestSize())
    {
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
        for ( wxTreeItemId item = GetRootItem();
              item.IsOk();
              item = GetLastChild(item) )
        {
            wxRect rect;

            // last parameter is "true" to get only the dimensions of the text
            // label, we don't want to get the entire item width as it's determined
            // by the current size
            if ( GetBoundingRect(item, rect, true) )
            {
                if ( size.x < rect.x + rect.width )
                    size.x = rect.x + rect.width;
                if ( size.y < rect.y + rect.height )
                    size.y = rect.y + rect.height;
            }
        }
    }
    else // use precise, if potentially slow, size computation method
    {
        // iterate over all items recursively
        wxTreeItemId idRoot = GetRootItem();
        if ( idRoot.IsOk() )
            wxGetBestTreeSize(this, idRoot, size);
    }

    // need some minimal size even for empty tree
    if ( !size.x || !size.y )
        size = wxControl::DoGetBestSize();
    else
    {
        // Add border size
        size += GetWindowBorderSize();

        CacheBestSize(size);
    }

    return size;
}
예제 #16
0
/*! Show widget. While it executes even if widget is allready shown,
 *  it may act like a refresh.
 */
void Widget::Show()
{
    _is_visible=true;
    if ( _is_on_top ) { GetParent()->BringOnTop(this); }

    NotifyAncestors(true);
    SetDirty( GetBoundingRect() );
    OnVisible.Send_1(true);
}
예제 #17
0
파일: Label.cpp 프로젝트: rarosu/BTH-Gomoku
	void Label::Draw()
	{
		if(!IsVisible())
			return;

		RECT textPos = GetBoundingRect();
		mFont->WriteText(mCaption, &mShadowPosition, mShadowColor, mAlignHor, mAlignVer);
		mFont->WriteText(mCaption, &textPos, mTextColor, mAlignHor, mAlignVer);
	}
예제 #18
0
void ecConfigTreeCtrl::OnKeyDown(wxKeyEvent& event)
{
    wxTreeItemId id = GetSelection();
    if (event.GetKeyCode() == WXK_F10 && event.ShiftDown())
    {
        if (id.IsOk())
        {
            wxRect rect;
            if (GetBoundingRect(id, rect))
            {
                GetPropertiesMenu()->SetClientData((void*) TRUE);
                PopupMenu(GetPropertiesMenu(), 100, rect.GetTop() + 4);
            }
        }
    }
    else if (event.GetKeyCode() == '<')
    {
        if (id.IsOk())
        {
            ecConfigItem* item = ((ecTreeItemData*) GetItemData(id))->GetConfigItem();
            item->BumpItem(-1);
        }
    }
    else if (event.GetKeyCode() == '>')
    {
        if (id.IsOk())
        {
            ecConfigItem* item = ((ecTreeItemData*) GetItemData(id))->GetConfigItem();
            item->BumpItem(+1);
        }        
    }
    else if (event.GetKeyCode() == WXK_SPACE)
    {
        if (id.IsOk())
        {
            ecConfigItem* item = ((ecTreeItemData*) GetItemData(id))->GetConfigItem();
            item->BumpItem(0);
        }
    }
    else if (event.GetKeyCode() == WXK_RETURN && event.AltDown())
    {
        if (id.IsOk())
        {
            ecConfigItem* item = ((ecTreeItemData*) GetItemData(id))->GetConfigItem();
            
            ecConfigPropertiesDialog dialog(wxGetApp().GetTopWindow(), item);
            dialog.SetTitle(item->GetName());
            dialog.ShowModal();
        }
    }
    else
    {
        event.Skip();
    }
}
예제 #19
0
/*! Hide widget, which is not allready hidden.
 *  If widget is hidden, function does nothing.
 */
void Widget::Hide()
{ 
    if (IsVisible())
    {
        SetDirty(GetBoundingRect());
        _is_visible=false;
        Accept( InputReset(this) );
        NotifyAncestors(false);
        OnVisible.Send_1(false); 
    }
}
예제 #20
0
// Method calculates area that is dirty and sets it dirty
void Widget::SetExposed( const Rect &area_before_changes )
{
    Rect current_area = GetBoundingRect();
    if ( (current_area & area_before_changes)!= area_before_changes )
    {
        SetDirty( current_area | area_before_changes );
        OnResize.Send_2( current_area.GetW(), current_area.GetH() );
    }
    else
    {   SetDirty( current_area );
    }
}
예제 #21
0
 void OnScroll(wxScrollWinEvent& event)
 {
     event.Skip();
     if (event.GetOrientation() == wxHORIZONTAL) return;
     if (!m_EditCtrl) return;
     
     wxTreeItemId id = GetSelection();
     wxRect bounding;
     GetBoundingRect(id, bounding);
     
     m_EditCtrl->Move(-1, bounding.y);
 }
예제 #22
0
// Adjust the containing wxScrolledWindow's scrollbars appropriately
void wxRemotelyScrolledTreeCtrl::AdjustRemoteScrollbars()
{
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
    if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
	{
		// This is for the generic tree control.
		// It calls SetScrollbars which has been overridden
		// to adjust the parent scrolled window vertical
		// scrollbar.
		((wxGenericTreeCtrl*) this)->AdjustMyScrollbars();
        return;
	}
	else
#endif
	{
		// This is for the wxMSW tree control
		wxScrolledWindow* scrolledWindow = GetScrolledWindow();
		if (scrolledWindow)
		{
			wxRect itemRect;
			if (GetBoundingRect(GetRootItem(), itemRect))
			{
                // Actually, the real height seems to be 1 less than reported
                // (e.g. 16 instead of 16)
                int itemHeight = itemRect.GetHeight() - 1;
				
				int w, h;
				GetClientSize(&w, &h);
				
				wxRect rect(0, 0, 0, 0);
				CalcTreeSize(rect);

                double f = ((double) (rect.GetHeight()) / (double) itemHeight)  ;
                int treeViewHeight = (int) ceil(f);
				
				int scrollPixelsPerLine = itemHeight;
				int scrollPos = - (itemRect.y / itemHeight);
				
				scrolledWindow->SetScrollbars(0, scrollPixelsPerLine, 0, treeViewHeight, 0, scrollPos);
				
				// Ensure that when a scrollbar becomes hidden or visible,
				// the contained window sizes are right.
				// Problem: this is called too early (?)
				wxSizeEvent event(scrolledWindow->GetSize(), scrolledWindow->GetId());
				scrolledWindow->GetEventHandler()->ProcessEvent(event);
			}
		}
	}
}
예제 #23
0
/*! Place self inside parents-client area.
 *  Proportions are rect.{x|y|w|h} / base.{x|y|x|y}.
 *  If base.{x|y}==0 then position and size in {X|Y} direction will be preserved.
 */
void Widget::Place ( const Rect &rect, const Pos &base)
{
    Rect client_area = GetParent()->GetClientRect( this);
    Rect my_rect = GetBoundingRect() + GetPosition();
    double x = my_rect.GetX();
    double y = my_rect.GetY();
    double w = my_rect.GetW();
    double h = my_rect.GetH();
    if ( base.x > 0) { x = as_double( client_area.GetW() * rect.GetX() ) / as_double( base.x ); }
    if ( base.y > 0) { y = as_double( client_area.GetH() * rect.GetY() ) / as_double( base.y ); }
    if ( base.x > 0) { w = as_double( client_area.GetW() * rect.GetW() ) / as_double( base.x ); }
    if ( base.y > 0) { h = as_double( client_area.GetH() * rect.GetH() ) / as_double( base.y ); }
    SetPosition( client_area.GetPos() + Pos( std::floor(x), std::floor(y) ));
    Resize( std::ceil(w), std::ceil(h) );
}
예제 #24
0
void MovingGameObject::HandleMovingCollisions() {
    auto it = _collides_with.begin();
    while (it != _collides_with.end()) {
        if ((*it)->IsNoClip()) {
            RemoveCollidingObject(*it++);
            continue;
        }
        // Coordinate info needed to be able to reset the object when
        // it overlaps the other
        sf::Vector2f coll_pos = (*it)->GetPosition();
        sf::Vector2f this_pos = GetPosition();

        sf::Rect<float> coll_rect = (*it)->GetBoundingRect();
        sf::Rect<float> this_rect = GetBoundingRect();

        const float coll_r_side = coll_rect.left + coll_rect.width;
        const float coll_l_side = coll_rect.left;
        const float coll_u_side = coll_rect.top;
        const float coll_d_side = coll_rect.top + coll_rect.height;

        const float this_r_side = this_rect.left + this_rect.width;
        const float this_l_side = this_rect.left;
        const float this_u_side = this_rect.top;
        const float this_d_side = this_rect.top + this_rect.height;

        // Flip direction upon collision
        if (_moved_left) {
            _velocity_x = - _velocity_x;
            //if(this_l_side < coll_r_side)
            //    SetPosition(thisPos.x + (coll_r_side - this_l_side), thisPos.y);
        } else if (_moved_right) {
            _velocity_x = - _velocity_x;
            //if(this_r_side > coll_l_side)
            //    SetPosition(thisPos.x - (this_r_side - coll_l_side), thisPos.y);
        }
        if (_moved_up) {
            _velocity_y = - _velocity_y;
            //if(this_d_side > coll_u_side)
            //    SetPosition(thisPos.x, thisPos.y - (this_d_side - coll_u_side));
        } else if (_moved_down) {
            _velocity_y = - _velocity_y;
            //if(this_u_side < coll_d_side)
            //    SetPosition(thisPos.x, thisPos.y + (coll_d_side - this_u_side));
        }

        RemoveCollidingObject(*it++);
    }
}
예제 #25
0
void
SceneNode::DrawBoundingRect(
    sf::RenderTarget& target,
    sf::RenderStates
) const {
    sf::FloatRect rect = GetBoundingRect();

    sf::RectangleShape shape;
    shape.setPosition( sf::Vector2f( rect.left, rect.top ) );
    shape.setSize( sf::Vector2f( rect.width, rect.height ) );
    shape.setFillColor( sf::Color::Transparent );
    shape.setOutlineColor( sf::Color::Green );
    shape.setOutlineThickness( 1.0f );

    target.draw( shape );
}
void CScrolledTreeCtrl::CalcTreeSize(const wxTreeItemId & id, wxRect & rect)
{
    //wxLogVerbose(wxT("CScrolledTreeCtrl::CalcTreeSize"));
    // More efficient implementation would be to find the last item (but how?)
    // Q: is the bounding rect relative to the top of the virtual tree workspace
    // or the top of the window? How would we convert?
    wxRect itemSize;
    if (GetBoundingRect(id, itemSize)) {
        rect = CombineRectangles(rect, itemSize);
    }

    wxTreeItemIdValue cookie;
    wxTreeItemId childId = GetFirstChild(id, cookie);
    while (childId) {
        CalcTreeSize(childId, rect);
        childId = GetNextChild(childId, cookie);
    }
}
예제 #27
0
void AutoResizingTreeCtrl::DoGetBestSizePrivate
    (wxSize& best_size
    ,wxTreeItemId const& node
    ,bool is_root
    )
{
    // This method recursivly expands all the nodes in the tree and calculates
    // widest bounding rectangle width. It then collapses back originally
    // collapsed nodes and returns.
    if(!is_root)
        {
        wxRect rect;
        if(GetBoundingRect(node, rect, true))
            {
            // adjust width only. height does not matter
            best_size.x = std::max(best_size.x, rect.x + rect.width);
            }
        }

    if(node.IsOk() && GetChildrenCount(node))
        {
        bool originally_expanded = is_root || IsExpanded(node);
        if(!originally_expanded)
            {
            Expand(node);
            }

        wxTreeItemIdValue cookie;
        for
            (wxTreeItemId child = GetFirstChild(node, cookie)
            ;child.IsOk()
            ;child = GetNextChild(node, cookie)
            )
            {
            DoGetBestSizePrivate(best_size, child);
            }

        if(!originally_expanded)
            {
            Collapse(node);
            }
        }
}
예제 #28
0
 void OnSelChange(wxTreeEvent& event)
 {
     if (m_EditCtrl != NULL)
     {
         m_EditCtrl->EndEdit();
         m_EditCtrl = NULL;
     }
 
     wxTreeItemId item = event.GetItem();
     PETreeData *dt = (PETreeData*)GetItemData(item);
     if (dt != NULL)
     {
         wxRect bounding;
         GetBoundingRect(item, bounding);
         bounding.SetX(0);
         bounding.SetWidth(GetCompanionWindow()->GetSize().x); 
         dt->EditCtrl->BeginEdit(bounding, item);
         m_EditCtrl = dt->EditCtrl;
     }
 }
예제 #29
0
SubtreeRenderState NodeEffect::RenderSubtree(RenderRegion* pRender, Node** ppNextNode, BOOL bClip)
{
	if (pRender == NULL)							// If no render region supplied, assume we need to be rendered
		return SUBTREE_ROOTANDCHILDREN;

	// Go find out about my bounding rectangle
	DocRect BoundingRect = GetBoundingRect();
	DocRect ClipRect = pRender->GetClipRect();

	if (bClip && !ClipRect.IsIntersectedWith(BoundingRect))	// If not within the clipping rect then
		return SUBTREE_NORENDER;					// Don't render us or our children

	// Ask Helper function to set up cacheing for me...
// AMB wonders whethere this was commented out during porting - 20051212
//	if (RenderCached(pRender))						// If we can find a cached bitmap for this node and render it
//	{
//		return SUBTREE_NORENDER;					// Then tell the renderer to move on without doing any more...
//	}

	return SUBTREE_ROOTANDCHILDREN;					// Else we must render ourselves and our children
}
예제 #30
0
파일: nodeshap.cpp 프로젝트: vata/xarino
DocRect NodeSimpleShape::GetBlobBoundingRect()
{
#if !defined(EXCLUDE_FROM_RALPH)
	// Find the Shapes bounding rectangle
	DocRect Rect = GetBoundingRect();

	// Find the blob manager
	BlobManager* pBlobMgr = GetApplication()->GetBlobManager();

	// And if we can find the current view, add on the size of a selection blob
	if (pBlobMgr!= NULL)
	{
		// Wee need to add in each of the blobs. there is a blob on each corner
		// of the parallelogram
		DocRect BlobSize;
		pBlobMgr->GetBlobRect(Parallel[0], &BlobSize);
		Rect = Rect.Union(BlobSize);
		
		// Next corner of the parallelogram
		pBlobMgr->GetBlobRect(Parallel[1], &BlobSize);
		Rect = Rect.Union(BlobSize);

		// and the next
		pBlobMgr->GetBlobRect(Parallel[2], &BlobSize);
		Rect = Rect.Union(BlobSize);

		// and the last one
		pBlobMgr->GetBlobRect(Parallel[3], &BlobSize);
		Rect = Rect.Union(BlobSize);
	}

	// Make sure we include the Bounds of our children
	IncludeChildrensBoundingRects(&Rect);

	// return the rectangle with the blobs included
	return Rect;
#else
	return DocRect(0,0,0,0);
#endif
}