[haiku-3rdparty-dev] Re: changing the frame of a BView

  • From: Rene Gollent <anevilyak@xxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Wed, 21 Mar 2012 16:59:51 -0400

On Wed, Mar 21, 2012 at 4:49 PM, Ryan Kingston <ryanmk54@xxxxxxxxx> wrote:
> I am trying to do something more or less like the zoom on LibreOffice
> writer or calc.
> What I can do right now is draw a page and put text inside one page.
> I don't want to go any further until I know how I could zoom.
> The page is its own BView so I'm not sure how I would go about zooming
> all the BViews and their content at once.

If that's the case you probably want to shift your design a bit. It
might be more straightforward to manage something like this if,
instead of making each page its own view, you make it an object that
has a function which takes a view + bounds within that view as
parameters and knows how to draw itself using that. This way your top
level view just has to manage the list of pages, and when you want to
zoom, you can alter the scale and relayout the pages accordingly, then
ask them all to draw (or skip drawing entirely for pages that fall
outside of the currently visible area). The same approach could be
extended to other subobjects within each page (i.e. graphics/tables).

Regards,

Rene

Other related posts: