When the right mouse button, set foucs the button.
Change-Id: I46e127be9a40703e1e45001781ed42676afe97d1
Signed-off-by: HyunJong Park <paulhj.park@samsung.com>
protected Composite parentComposite = null;
protected static final int MARGIN = 5;
+ protected static final int MOUSE_LEFT = 1;
+ protected static final int MOUSE_RIGHT = 3;
+
protected boolean isFocus = false;
protected boolean isSelection = false;
protected boolean isEnable = true;
- protected static boolean isFocusFromTabKey = false;
+ protected static boolean isFocusByKeyInput = false;
protected boolean isDefaultButton = false;
protected boolean isGrayed = false;
return false;
}
- protected void setFocusFromTabKey(boolean isFocusFromTabKey) {
- this.isFocusFromTabKey = isFocusFromTabKey;
+ protected void setFocusByKeyInput(boolean isFocusFromTabKey) {
+ this.isFocusByKeyInput = isFocusFromTabKey;
}
- protected boolean isFocusFromTabKey() {
- return isFocusFromTabKey;
+ protected boolean isFocusByKeyInput() {
+ return isFocusByKeyInput;
}
protected boolean isActiveDefaultButton() {
this.addListener(SWT.FocusIn, new Listener() {
public void handleEvent(Event e) {
- TizenButton.this.buttonRenderer.setFocusFromTabKey(true);
+ TizenButton.this.buttonRenderer.setFocusByKeyInput(true);
TizenButton.this.buttonRenderer.setFocus();
}
});
case SWT.CR:
fireEventWhenEnterKeyPressed();
break;
+ case SWT.ESC:
+// Display.getCurrent().g
+// Display.getCurrent().getActiveShell().dispose();
+ break;
}
}
});
return false;
}
super.setFocus();
- TizenButton.this.buttonRenderer.setFocusFromTabKey(false);
+ buttonRenderer.setFocusByKeyInput(false);
buttonRenderer.setFocus();
return true;
}
return true;
}
- if (null != button && isFocusFromTabKey()) {
+ if (null != button && isFocusByKeyInput()) {
return false;
}
return true;
if (!isEnable) {
break;
}
- isButtonPressed = true;
+ if (event.button == MOUSE_RIGHT) {
+ parent.setFocus();
+ } else {
+ isButtonPressed = true;
+ }
+ setFocusByKeyInput(true);
parent.redraw();
-
break;
case SWT.MouseUp:
+ if (event.button == MOUSE_RIGHT) {
+ return;
+ }
+
/*
* To check that click on the button of current window.
* Some widgets open a new window when the mouse down.
}
switch (event.character) {
case SWT.ESC:
- Display.getCurrent().getActiveShell().dispose();
+// Display.getCurrent().getActiveShell().dispose();
break;
case SWT.CR:
/*
}
private void drawBorder(GC gc, Rectangle rect, TizenButtonAttribute attr) {
- if (isEnable && isFocus() && isFocusFromTabKey == true) {
+ if (isEnable && isFocus() && isFocusByKeyInput == true) {
drawHighlightBorder(gc, rect, parent.getAttribute());
} else if (isActiveDefaultButton() && parent.isEnabled()) {
drawHighlightBorder(gc, rect, parent.getAttribute());
TizenRadioButtonRenderer(TizenButton parent, Composite parentComposite) {
super(parent, parentComposite);
+ if (parentComposite instanceof Group) {
+ this.setEnabled(parentComposite.getEnabled());
+ }
+
}
protected boolean isState(int style, int cmpStyle) {
case SWT.MouseExit:
drawMouseExit();
break;
+ case SWT.MouseDown:
+ if (event.button == MOUSE_RIGHT) {
+ parent.setFocus();
+ return;
+ }
+ break;
case SWT.MouseUp:
+ if (event.button == MOUSE_RIGHT) {
+ return;
+ }
radioButtonPressed();
break;
case SWT.Paint: