[haiku-commits] Re: haiku: hrev47180 - src/apps/showimage

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 29 Apr 2014 09:28:14 +0000

> We really don't have a toggle button? That is somewhat incredible.

 BButton now has SetBehavior, which was added recently by Ingo as part of his 
work on OpenJDK and SWT.
 This works for a standard toggle button, but what I want here is a bit more 
complex.

 The "Original size" button works as before, as a standard button. If you 
shift+click it, you enter the new mode where images are forced to original 
size, instead of fitted to the window. To show this, the button switches to 
toggle mode and stays pressed. Clicking the button again (with or without 
shift) restores the normal behavior and depresses the button.

 I also used this subclass to include the button behavior in the invoke 
message. This allows the app to easily know that the button was clicked, locked 
(shift+click), or unlocked. We could make this a shared class, if we want to 
have the same behavior in other places, but I think it is quite specific to 
this.

 -- 
 Adrien.
  

Other related posts: