Menu

#4 Allow to change virtual size

closed
nobody
None
5
2010-12-08
2010-11-03
No

Is it possible to show the user a bigger screen view, eg : allow the devs to change the size used in wxSFShapeCanvas::UpdateVirtualSize().
A solution is to make GetTotalBoundingBox virtual, in order to allow to update the returned size. An other one, which may ne better, is to add a virtual method, empty by default, which can allow to modify the area size :

// Here is a way to make the area size 10 px bigger :
virtual void VirtualSizeUpdating(wxRect& virtRect)
{
virtRect.Inflate(10);
}

void wxSFShapeCanvas::UpdateVirtualSize()
{
wxRect virtRct = GetTotalBoundingBox();

// Allow the user to change the area size
VirtualSizeUpdating(virtRct);

// update virtual area of the scrolled window if neccessary
if(!virtRct.IsEmpty())
{
SetVirtualSize(int(virtRct.GetRight()*m_Settings.m_nScale), int(virtRct.GetBottom()*m_Settings.m_nScale));
}
else
SetVirtualSize(500, 500);
}

What do you think ?

Discussion

  • Michal Bližňák

    Implemented in SVN 320.

     
  • Michal Bližňák

    • status: open --> closed