[haiku-development] Re: BButton enhancements

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 29 Dec 2013 19:29:35 +0100

On 12/29/2013 12:45 PM, Axel Dörfler wrote:
On 29.12.2013 02:50, Ingo Weinhold wrote:
The functionality is needed for an SWT port [1], but I figured that it
is generally useful and should better be added to the standard class.

So I guessed right, neat! :-)

How far have you gotten already? If there is eclipse, I would just need
VPN and could work from Haiku (well, that and IMAP...) :-)

Well, you know whom to talk about IMAP. :-) But I guess you'll have a lot of time, since eclipse is far away. The SWT port is mostly stubs ATM. The only more or less complete widget is Button (if you ignore minor details like support for tab chains, mnemonics, multi-line labels, accessibility). And at the rate it is going it will likely be months of full time work (which I don't have) to implement all the widgets.

But well, it's open source, so maybe someone else helps out ...

One possible option is to add a new behavior constant,
B_DROP_DOWN_BEHAVIOR (currently there are B_BUTTON_BEHAVIOR and
B_TOGGLE_BEHAVIOR), which would add the arrow and detect its click in
MouseDown(). I don't think opening the menu (or whatever) should be
BButton's concern, so I'd just send a message (settable) to the button's
target and the API user can do whatever is desired.

What sort of behavior would that constant change? If it changes the
look, it would be misplaced,

Well it changes the look, but also the behavior, as the arrow part wouldn't press the button. I thought about a separate boolean property to enable the drop down look and behavior, but I don't think it makes any sense that it can be combined with the toggle behavior, so making it a third behavior constant seemed best.

The "behavior" property could be renamed to something more general like "style", though.

and I guess a BButton could always send an
optional message on button press (ie. via a SetPressedMessage() method
or the like).

Well, the button wouldn't actually be pressed when hitting the arrow. But having a setter for the arrow message is what I was thinking of anyway.

CU, Ingo


Other related posts: