I am trying to create buttons shaped as in the following picture: 
This works pretty well by doing the following:
class ArrowButton extends Composite {
ArrowButton(Composite parent, int style) {
[...]
setRegion(customRegion);
}
}
addStuff(Composite parent) {
ArrowButton b = new ArrowButton(parent, SWT.NONE);
b.setBounds(x, y, width, height);
}
However, I want to use a layout manager to layout these buttons. Ideally, the buttons are layouted on a standard size, after which they can still paint outside of this region.
Is this at all possible? How can I do this?
Layout managers have two functions: calculating the size of the composite that they are applied to and setting the bounds of the composite's children. Given the relative simplicity of your requirements (line up buttons horizontally) I'd say that you're better off doing the layout yourself (rather than trying to hack an existing implementation). You can always put your code into a delegate behind the Layout interface, if that feels better.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With