this.skinObject = skinObject;
Listener l = new Listener() {
boolean bDownPressed;
public void handleEvent(Event event) {
if (event.type == SWT.MouseDown) {
bDownPressed = true;
return;
} else if (!bDownPressed) {
return;
}
bDownPressed = false;
if (isDisabled()) {
return;
}
for (Iterator iter = listeners.iterator(); iter.hasNext();) {
ButtonListenerAdapter l = (ButtonListenerAdapter) iter.next();
l.pressed(SWTSkinButtonUtility.this);
}
}
};
if (skinObject instanceof SWTSkinObjectContainer) {
Utils.addListenerAndChildren((Composite) skinObject.getControl(),
SWT.MouseUp, l);
Utils.addListenerAndChildren((Composite) skinObject.getControl(),
SWT.MouseDown, l);
} else {
skinObject.getControl().addListener(SWT.MouseUp, l);
skinObject.getControl().addListener(SWT.MouseDown, l);
}