[haiku-development] Re: BMenuBar scrolling support

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 31 Dec 2011 20:13:04 +0100

On 30.12.2011 23:10, John Scipione wrote:
On Thu, Dec 29, 2011 at 6:00 PM, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx
<mailto:axeld@xxxxxxxxxxxxxxxx>> wrote:
    The point is that this feature does not belong into BMenu. Scrolling
    can be implemented in a number of ways, and it's a feature that has
    nothing to do with a BMenu itself. Putting too much unrelated
    functionality into a single class is bad design, and makes
    complicated code that cannot be re-used easily.
    See QMainWidget for an example of bad class design: while it can be
    a good idea to have a convenience class that bundles existing
    functionality, it's just bad to have it wired all into one class
    that you cannot use in other contexts (like its dock).
If the code to do menu scrolling doesn't belong in BMenu perhaps it
could be moved to its own class derived from BView, for sake of argument
let's call it BInlineScrollView, and then make BMenu derive from that
class instead of BView.

You misunderstood: this *feature* does not belong into BMenu. Neither through a subclass (which isn't possible as Alex pointed out, at least not with a bit of voodoo magic), nor through an inner class. BMenu is the sole provider of its functionality, it shouldn't get stuff that doesn't belong there. Instead, a separate class should be used. Like a BScrollView which would be the cleanest solution, anyway.

    Besides that, we should switch to a BScrollBar instead of the not so
    useful scroll buttons, as has been pointed out already.
No, as I already mentioned, scrollbars take up space in the wrong
dimension so won't work.

I actually missed that earlier, but it don't quite see why it wouldn't work. It surely works in every other case where scroll bars are being used. In case of a BMenu in its own window, the window could just get larger, but in the case of the Deskbar, the menu should just shrink horizontally itself -- where is the problem?

Bye,
   Axel.

Other related posts: