[haiku-development] Re: BMenuBar scrolling support

  • From: Alex Wilson <yourpalal2@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 27 Dec 2011 16:28:15 -0700

On 12/27/11, John Scipione <jscipione@xxxxxxxxx> wrote:
> On Tue, Dec 27, 2011 at 5:01 PM, John Scipione <jscipione@xxxxxxxxx> wrote:
>
>> I'd like to add the following private member vars to BMenu:
>>
>> fBeginScroller (the left/top scroller)
>> fEndScroller (the right/bottom scroller)
>> fScrollLimit (the current amount that you can scroll by)
>> fScrollValue (the amount you have scrolled)
>>
>> as well as two new public methods:
>>
>> EnableScrolling(bool enable)
>> ScrollingEnabled()
>>
>
> I guess I'd also need an fScrollingEnabled private member var as well… and
> possibly a fScrollStep var to set the step value to scroll by, although I
> could get away with just hard coding the step size instead.

I'm not going to comment on the design/implementation/focus/etc.. of
your planned changes, but only the ABI stuff.

You need lots of fields there, probably the best solution is to make a
struct to hold the scrolling info, like BView::fLayoutInfo. Assuming
there is at least one uint32 of reserved space left on the BMenu
class, this approach will work. However, if there is enough reserved
space for all the new scrolling fields you want to add, they could be
added directly, and moved into a struct later if we need to add even
more things to BMenu.

As for the public methods, they are safe to add, as long as they're
not virtual. If they are virtual methods, then there needs to be one
_ReservedBMenu*() method each. I don't think those methods would be
virtual, so you're probably safe there.

--Alex

Other related posts: