[haiku-appserver] origin, bounds, frame

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Wed, 27 Apr 2005 13:46:54 +0200 CEST

Hi,

I'm confused about the BView coordinate system handling/implementation. 
In ServerWindow, there seems to be a pretty inconsistent usage of 
Layer::fFrame, Layer::fFrame.LeftTop(), Layer::fBoundsLeftTop. 
BView::Bounds() uses AS_LAYER_GET_COORD, but does it confuse Frame() 
and Bounds()?

Here is my understanding of the BView coordinate system:
Frame() is where the BView is situated within it's parent coordinate 
system. Bounds() is the BViews currenly visible portion stated in its 
local coordinate system, it is the same size as Frame(). Let's suppose 
I create a BView(BRect(20, 30, 70, 80)...). That rectangle states the 
area in the parent where this view will be added. Calling Bounds() on 
the view will return BRect(0, 0, 50, 50). If I call MoveTo(40, 50), it 
will move within the parent. Bounds() is then still BRect(0, 0, 50, 
50). If I call ScrollBy(20, 0), Bounds() will be BRect(20, 0, 70, 50) 
whereas Frame() will not have changed. ScrollBy() modifies the views 
origin. The origin is part of the BViews current state! Whereas Frame() 
doesn't have anything to do with states.

Ok, that having been said, what is our BView::originX/Y? What is 
Layer::fBoundsLeftTop and fFrame? How should Layer::fState->Origin() be 
used? I think it needs to play a role in those ConvertToParent() 
methods.

Best regards,
-Stephan



Other related posts:

  • » [haiku-appserver] origin, bounds, frame