return;
}
}
if (style == ToolButtonStyle.MENU) {
if (menu != null) {
final Dimension box = WidgetHelper.getOffsetSize(this);
final int left = DOM.getAbsoluteLeft(getElement());
final int top = DOM.getAbsoluteTop(getElement()) + box.height;
menu.setPopupPosition(left, top);
menu.show();
}
return;
}
if (style == ToolButtonStyle.CHECKBOX) {
setChecked(!isChecked());
}
if (style == ToolButtonStyle.RADIO) {
setChecked(true);
}
super.onBrowserEvent(event);
break;
case Event.ONMOUSEDOWN:
if (style == ToolButtonStyle.SPLIT
&& event.getTarget() == getElement()) {
final int[] p = DOM.getPaddingSizes(getElement());
if (getElement().getAbsoluteLeft()
+ (getElement().getOffsetWidth() - p[1]) < event.getClientX()) {
addStyleName("mosaic-Split-Button-activeoption");
return;
}
}
super.onBrowserEvent(event);
break;
case Event.ONMOUSEUP:
if (style == ToolButtonStyle.SPLIT
&& event.getTarget() == getElement()) {
final int[] m = DOM.getPaddingSizes(getElement());
if (getElement().getAbsoluteLeft()
+ (getElement().getOffsetWidth() - m[1]) < event.getClientX()) {
if (menu != null) {
// TODO fix that code
// Region r = DOM.getRegion(getElement());
final Dimension box = WidgetHelper.getOffsetSize(this);
final int left = DOM.getAbsoluteLeft(getElement());
final int top = DOM.getAbsoluteTop(getElement()) + box.height;
menu.setPopupPosition(left, top);
menu.show();
}