This patch is a modification to the keyboard input(enter, space, esc).
When focused state, Button can receive a space key input.
If there is no focused button in the current window, Default button is activated.
Default button can receive a enter key input.
Change-Id: Ie7e6dcaa92a752a5c51ce5c8ed18b54ebcc20f09
Signed-off-by: HyunJong Park <paulhj.park@samsung.com>
public abstract class TizenAbstractButtonRenderer {
- protected int buttonState = TizenCheckBoxButtonRenderer.NORMAL;
+ protected int buttonState = TizenPushButtonRenderer.STATE_NORMAL;
protected Composite parentComposite = null;
protected TizenButton parent;
protected void setDefaultButtonListener(boolean enable) {
}
+ protected void radioButtonPressed() {
+ }
+
+ protected void setGrayed(boolean grayed) {
+ }
+
+ protected boolean getGrayed() {
+ return false;
+ }
+
abstract protected void drawButton(Event e);
abstract protected Listener getMouseListener();
*/
package org.eclipse.swt.custom;
+import java.util.*;
+
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
});
this.addListener(SWT.KeyDown, new Listener() {
- public void handleEvent(Event e) {
- if (buttonRenderer.isDefaultButton) {
+ public void handleEvent(Event event) {
+ if (!isFocus()) {
return;
}
- switch (e.character) {
- case ' ': // $NON-NLS-1$
- case '\r': // $NON-NLS-1$
- case '\n': // $NON-NLS-1$
- redraw();
- fireSelectionEvent();
- updateCheckButtonStateWhenPressedSpaceKey();
+ switch (event.character) {
+ case SWT.SPACE:
+ fireEventWhenSpaceKeyPressed();
+ break;
+ case SWT.CR:
+ fireEventWhenEnterKeyPressed();
break;
}
}
});
}
- private void updateCheckButtonStateWhenPressedSpaceKey() {
- if (this.isDisposed() || (!isEqualsType(getStyle(), SWT.CHECK) && !isFocus())) {
- return;
- }
- buttonRenderer.setSelection(buttonRenderer.getSelection() == false);
- }
-
protected void fireSelectionEvent() {
Event e = new Event();
e.item = this;
notifyListeners(SWT.Selection, e);
}
+ private void fireEventWhenEnterKeyPressed() {
+ if (isEqualsType(getStyle(), SWT.PUSH)) {
+ fireSelectionEvent();
+ } else {
+ fireSelectionEventOfDefaultButton();
+ }
+ }
+
+ private void fireEventWhenSpaceKeyPressed() {
+ if (isEqualsType(getStyle(), SWT.PUSH)) {
+ fireSelectionEvent();
+ } else if (isEqualsType(getStyle(), SWT.CHECK)) {
+ fireSelectionEvent();
+ buttonRenderer.setSelection(buttonRenderer.getSelection() == false);
+ } else if (isEqualsType(getStyle(), SWT.RADIO)) {
+ buttonRenderer.radioButtonPressed();
+ }
+ }
+
+ protected Widget[] getWidgetList() {
+ return null;
+ }
+
+ protected ArrayList<Button> getPushButtonInWindow() {
+ ArrayList<Button> buttonArray = new ArrayList<Button>();
+ /*
+ * Get all widgets from current window.
+ */
+ Widget[] widgetList = getWidgetList();
+ for (Widget widget : widgetList) {
+ if (!(widget instanceof Button)) {
+ continue;
+ }
+ Button button = (Button) widget;
+ if (!button.isEqualsType(button.getStyle(), SWT.PUSH)) {
+ continue;
+ }
+ buttonArray.add(button);
+ }
+ return buttonArray;
+ }
+
+ private void fireSelectionEventOfDefaultButton() {
+ ArrayList<Button> buttonList = getPushButtonInWindow();
+ for (Button button : buttonList) {
+ if (button.isDefaultButton()) {
+ button.setFocus();
+ button.fireSelectionEvent();
+ return;
+ }
+ }
+ }
+
/**
* SelectionListeners are notified when the button is clicked
* @param listener
if (!isEqualsType(getStyle(), SWT.CHECK)) {
return;
}
- buttonRenderer.isGrayed = grayed;
+ buttonRenderer.setGrayed(grayed);
redraw();
}
public boolean getGrayed() {
- return false;
+ return buttonRenderer.getGrayed();
}
}
}
public void setImage(Image img) {
- this.images.put(TizenRadioButtonRenderer.SELECTED, img);
- this.images.put(TizenRadioButtonRenderer.SELECTED_HOVER, img);
- this.images.put(TizenRadioButtonRenderer.SELECTED_DISABLE, img);
- this.images.put(TizenRadioButtonRenderer.NORMAL, img);
- this.images.put(TizenRadioButtonRenderer.NORML_HOVER, img);
- this.images.put(TizenRadioButtonRenderer.NORMAL_DISABLE, img);
+ this.images.put(TizenPushButtonRenderer.STATE_NORMAL, img);
+ this.images.put(TizenPushButtonRenderer.STATE_FOCUSED, img);
+ this.images.put(TizenPushButtonRenderer.STATE_HOVER, img);
+ this.images.put(TizenPushButtonRenderer.STATE_PRESSED, img);
+ this.images.put(TizenPushButtonRenderer.STATE_DIMMED, img);
}
public Color getBackGroundcolor(int state) {
}
@Override
- protected Image getImage(int state) {
- /*
- * FIXME: To simplify the branch statement.
- * @author: paulhj.park@samsung.com
- * @since: 2016-05-24
- */
- switch (getButtonState()) {
- case SELECTED:
- if (isGrayed) {
- return TizenResourceManager.getInstance().checkBoxGrayed;
- } else {
- return TizenResourceManager.getInstance().checkBoxSelected;
- }
- case SELECTED_HOVER:
- if (isGrayed) {
- return TizenResourceManager.getInstance().checkBoxGrayedHover;
- } else {
- return TizenResourceManager.getInstance().checkBoxSelectedHover;
- }
- case SELECTED_DISABLE:
- if (isGrayed) {
- return TizenResourceManager.getInstance().checkBoxGrayedDisable;
- } else {
- return TizenResourceManager.getInstance().checkBoxSelectedDisable;
- }
- case SELECTED_FOCUSED:
- if (isGrayed) {
- return TizenResourceManager.getInstance().checkBoxGrayedFocused;
- } else {
- return TizenResourceManager.getInstance().checkBoxSelectedFocused;
- }
- case NORMAL:
- return TizenResourceManager.getInstance().checkBoxNormal;
- case NORML_HOVER:
+ protected Image getImage() {
+ if (isState(state, (SELECT | ENABLE | HOVER | GRAYED))) {
+ return TizenResourceManager.getInstance().checkBoxGrayedHover;
+ } else if (isState(state, (SELECT | ENABLE | FOCUS | GRAYED))) {
+ return TizenResourceManager.getInstance().checkBoxGrayedFocused;
+ } else if (isState(state, (SELECT | ENABLE | GRAYED))) {
+ return TizenResourceManager.getInstance().checkBoxGrayed;
+ } else if (isState(state, (SELECT | GRAYED))) {
+ return TizenResourceManager.getInstance().checkBoxGrayedDisable;
+ } else if (isState(state, (SELECT | ENABLE | HOVER))) {
+ return TizenResourceManager.getInstance().checkBoxSelectedHover;
+ } else if (isState(state, (SELECT | ENABLE | FOCUS))) {
+ return TizenResourceManager.getInstance().checkBoxSelectedFocused;
+ } else if (isState(state, (SELECT | ENABLE))) {
+ return TizenResourceManager.getInstance().checkBoxSelected;
+ } else if (isState(state, (SELECT))) {
+ return TizenResourceManager.getInstance().checkBoxSelectedDisable;
+ } else if (isState(state, (ENABLE | HOVER))) {
return TizenResourceManager.getInstance().checkBoxNormalHover;
- case NORMAL_DISABLE:
- return TizenResourceManager.getInstance().checkBoxNormalDisable;
- case NORMAL_FOCUSED:
+ } else if (isState(state, (ENABLE | FOCUS))) {
return TizenResourceManager.getInstance().checkBoxNormalFocused;
- default:
+ } else if (isState(state, (ENABLE))) {
return TizenResourceManager.getInstance().checkBoxNormal;
+ } else {
+ return TizenResourceManager.getInstance().checkBoxNormalDisable;
}
}
+
+ @Override
+ protected void setGrayed(boolean grayed) {
+ if (grayed) {
+ state |= GRAYED;
+ } else {
+ state &= ~GRAYED;
+ }
+ }
+
+ @Override
+ protected boolean getGrayed() {
+ return ((state & GRAYED) == GRAYED);
+ }
+
}
*/
package org.eclipse.swt.custom;
+import java.util.*;
+
import org.eclipse.swt.*;
+import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
private boolean isButtonPressed = false;
- private final int STATE_NORMAL = 0;
- private final int STATE_FOCUSED = 1;
- private final int STATE_HOVER = 2;
- private final int STATE_PRESSED = 3;
- private final int STATE_DIMMED = 4;
+ protected final static int STATE_NORMAL = 0;
+ protected final static int STATE_FOCUSED = 1;
+ protected final static int STATE_HOVER = 2;
+ protected final static int STATE_PRESSED = 3;
+ protected final static int STATE_DIMMED = 4;
private static int eventEnterKeyTime = 0;
} else {
setButtonState(STATE_NORMAL);
}
+ if (null == getFocusedWidget()) {
+ parent.setFocus();
+ }
} else {
setButtonState(STATE_DIMMED);
+ parent.removeFocus();
}
parent.redraw();
}
isFocus = true;
if (getButtonState() != STATE_DIMMED) {
setButtonState(STATE_FOCUSED);
- setLastFocusOnly();
+ removeFocusAnotherButton();
parent.redraw();
}
return true;
isFocus = false;
if (getButtonState() != STATE_DIMMED) {
setButtonState(STATE_NORMAL);
- parent.redraw();
}
+
+ if (null == getFocusedWidget()) {
+ parent.setFocus();
+ }
+ if (null == getFocusedPushButton()) {
+ redrawDefaultButton();
+ }
+ parent.redraw();
return false;
}
- private boolean enableDefaultButton() {
- if (isDefaultButton && getButtonState() != STATE_DIMMED && getButtonState() != STATE_PRESSED) {
- return true;
- } else {
- return false;
+ private Control getFocusedWidget() {
+ return Display.getCurrent().getFocusControl();
+ }
+
+ private Button getFocusedPushButton() {
+ Control control = getFocusedWidget();
+ if (null == control) {
+ return null;
+ }
+ if (!(control instanceof Button)) {
+ return null;
}
+ Button button = (Button) control;
+ if (!button.isEqualsType(button.getStyle(), SWT.PUSH)) {
+ return null;
+ }
+ return button;
}
- private void setLastFocusOnly() {
- if (!parent.isEqualsType(parent.getStyle(), SWT.PUSH)) {
- return;
+ private boolean isActiveDefaultButton() {
+ if (!isDefaultButton) {
+ return false;
}
- for (Control child : parentComposite.getChildren()) {
- if (!(child instanceof Button)) {
- continue;
- }
- Button button = (Button) child;
- if (!button.isEqualsType(child.getStyle(), SWT.PUSH)) {
+ if (getButtonState() == STATE_DIMMED) {
+ return false;
+ }
+ if (null != getFocusedPushButton()) {
+ return false;
+ }
+ return true;
+ }
+
+ private void removeFocusAnotherButton() {
+ ArrayList<Button> buttonList = parent.getPushButtonInWindow();
+ for (Button button : buttonList) {
+ if (parent == button) {
continue;
}
button.removeFocus();
}
}
+ private void redrawDefaultButton() {
+ ArrayList<Button> buttonList = parent.getPushButtonInWindow();
+ for (Button button : buttonList) {
+ if (button.isDefaultButton()) {
+ button.redraw();
+ continue;
+ }
+ }
+ }
+
+ private void updateDefaultButton() {
+ if (null != getFocusedPushButton()) {
+ return;
+ }
+ if (isActiveDefaultButton()) {
+ return;
+ }
+ redrawDefaultButton();
+ }
+
@Override
public Listener getMouseListener() {
return new Listener() {
@Override
protected void setDefaultButtonListener(boolean enable) {
isDefaultButton = enable;
- if (enable) {
- setFocus();
- }
- Display.getDefault().addFilter(SWT.Traverse, new Listener() {
- public void handleEvent(Event event) {
+ parent.getShell().addTraverseListener(new TraverseListener() {
+ public void keyTraversed(TraverseEvent event) {
if (parent.isDisposed()) {
return;
}
- if (SWT.TRAVERSE_RETURN != event.detail) {
- return;
- }
- if (!enableDefaultButton()) {
- return;
- }
- if (eventEnterKeyTime == event.time) {
- return;
- } else {
- eventEnterKeyTime = event.time;
- }
- if (event.widget instanceof StyledText) {
- return;
+ switch (event.character) {
+ case SWT.ESC:
+ Display.getCurrent().getActiveShell().dispose();
+ break;
+ case SWT.CR:
+ /*
+ * Filter the key event of focus state
+ * because the SWT.KeyDown listener also handle key event.
+ */
+ if (isFocus()) {
+ return;
+ }
+
+ if (!isActiveDefaultButton()) {
+ return;
+ }
+
+ if (eventEnterKeyTime == event.time) {
+ return;
+ } else {
+ eventEnterKeyTime = event.time;
+ }
+
+ if (event.widget instanceof StyledText) {
+ return;
+ }
+
+ event.doit = false;
+ parent.fireSelectionEvent();
+ break;
}
- event.doit = false;
- parent.fireSelectionEvent();
}
});
}
drawBackground(e.gc, rect, getButtonState(), parent.getAttribute());
drawButtonImage(e.gc, rect, parent.getAttribute(), getButtonState());
drawIcon(e.gc, rect, parent.getAttribute());
- drawBorder(e.gc, rect, getButtonState(), parent.getAttribute());
drawButtonText(e.gc, rect, getButtonState(), parent.getAttribute());
- if ((enableDefaultButton() || isFocus) && parent.isEnabled()) {
- drawHighlightBorder(e.gc, rect, getButtonState(), parent.getAttribute());
+ drawBorder(e.gc, rect, getButtonState(), parent.getAttribute());
+ updateDefaultButton();
+ }
+
+ private void drawBorder(GC gc, Rectangle rect, int state, TizenButtonAttribute attr) {
+ Button focusedButton = getFocusedPushButton();
+ if (null != focusedButton && focusedButton == parent && parent.isEnabled()) {
+ drawHighlightBorder(gc, rect, getButtonState(), parent.getAttribute());
+ } else if (isActiveDefaultButton() && parent.isEnabled()) {
+ drawHighlightBorder(gc, rect, getButtonState(), parent.getAttribute());
} else {
- drawBorder(e.gc, rect, getButtonState(), parent.getAttribute());
+ drawNormalBorder(gc, rect, getButtonState(), parent.getAttribute());
}
}
gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
}
- private void drawBorder(GC gc, Rectangle rect, int state, TizenButtonAttribute attr) {
+ private void drawNormalBorder(GC gc, Rectangle rect, int state, TizenButtonAttribute attr) {
if (null == attr) {
return;
}
import org.eclipse.swt.widgets.*;
public class TizenRadioButtonRenderer extends TizenAbstractButtonRenderer {
- public static final int SELECTED = 0;
- public static final int SELECTED_HOVER = 1;
- public static final int SELECTED_DISABLE = 2;
- public static final int SELECTED_FOCUSED = 3;
- public static final int NORMAL = 4;
- public static final int NORML_HOVER = 5;
- public static final int NORMAL_DISABLE = 6;
- public static final int NORMAL_FOCUSED = 7;
+ protected static final int DISABLE = 1 << 0; // 1
+ protected static final int SELECT = 1 << 1; // 2
+ protected static final int ENABLE = 1 << 2; // 4
+ protected static final int FOCUS = 1 << 3; // 8
+ protected static final int HOVER = 1 << 4; // 16
+ protected static final int GRAYED = 1 << 5; // 32
+ protected int state = ENABLE;
TizenRadioButtonRenderer(TizenButton parent, Composite parentComposite) {
super(parent, parentComposite);
- setPushButtonDefaultColors();
}
- private void setPushButtonDefaultColors() {
- parent.attr.setForeGroundColor(SELECTED, TizenResourceManager.RADIO_BUTTON_SELECT_COLOR);
- parent.attr.setForeGroundColor(SELECTED_HOVER, TizenResourceManager.RADIO_BUTTON_SELECT_COLOR);
- parent.attr.setForeGroundColor(SELECTED_DISABLE, TizenResourceManager.RADIO_BUTTON_DISABLE_FONT_COLOR);
- parent.attr.setForeGroundColor(SELECTED_FOCUSED, TizenResourceManager.RADIO_BUTTON_NORMAL_FONT_COLOR);
- parent.attr.setForeGroundColor(NORMAL, TizenResourceManager.RADIO_BUTTON_NORMAL_FONT_COLOR);
- parent.attr.setForeGroundColor(NORML_HOVER, TizenResourceManager.RADIO_BUTTON_NORMAL_FONT_COLOR);
- parent.attr.setForeGroundColor(NORMAL_DISABLE, TizenResourceManager.RADIO_BUTTON_DISABLE_FONT_COLOR);
- parent.attr.setForeGroundColor(NORMAL_FOCUSED, TizenResourceManager.RADIO_BUTTON_NORMAL_FONT_COLOR);
+ protected boolean isState(int style, int cmpStyle) {
+ return ((style & cmpStyle) == cmpStyle);
}
- /*
- * FIXME: To simplify the branch statement.
- * @author: paulhj.park@samsung.com
- * @since: 2016-05-24
- */
@Override
public Listener getMouseListener() {
return new Listener() {
switch (event.type) {
case SWT.MouseHover:
case SWT.MouseEnter:
- if (!isEnable) {
- break;
- }
- if (getButtonState() == SELECTED) {
- setButtonState(SELECTED_HOVER);
- } else if (getButtonState() == SELECTED_HOVER) {
- setButtonState(SELECTED_HOVER);
- } else if (getButtonState() == SELECTED_FOCUSED) {
- setButtonState(SELECTED_HOVER);
- } else if (getButtonState() == NORMAL) {
- setButtonState(NORML_HOVER);
- } else if (getButtonState() == NORML_HOVER) {
- setButtonState(NORML_HOVER);
- } else if (getButtonState() == NORMAL_FOCUSED) {
- setButtonState(NORML_HOVER);
- }
-
- parent.redraw();
+ drawMouseHover();
break;
case SWT.MouseExit:
- if (!isEnable) {
- break;
- }
- if (getButtonState() == SELECTED_HOVER) {
- if (isFocus()) {
- setButtonState(SELECTED_FOCUSED);
- } else {
- setButtonState(SELECTED);
- }
- } else if (getButtonState() == NORML_HOVER) {
- if (isFocus()) {
- setButtonState(NORMAL_FOCUSED);
- } else {
- setButtonState(NORMAL);
- }
- }
- parent.redraw();
- break;
- case SWT.MouseDown:
+ drawMouseExit();
break;
case SWT.MouseUp:
- if (!isEnable) {
- break;
- }
- if (getButtonState() == SELECTED) {
- setButtonState(NORMAL);
- } else if (getButtonState() == SELECTED_HOVER) {
- setButtonState(NORML_HOVER);
- } else if (getButtonState() == SELECTED_FOCUSED) {
- setButtonState(NORMAL_FOCUSED);
- } else if (getButtonState() == NORMAL) {
- setButtonState(SELECTED);
- } else if (getButtonState() == NORML_HOVER) {
- setButtonState(SELECTED_HOVER);
- } else if (getButtonState() == NORMAL_FOCUSED) {
- setButtonState(SELECTED_FOCUSED);
- }
- parent.redraw();
- selectRadio();
- parent.fireSelectionEvent();
+ radioButtonPressed();
break;
case SWT.Paint:
drawButton(event);
@Override
protected void setBackground(Color color) {
- parent.attr.setBackGroundColor(SELECTED, color);
- parent.attr.setBackGroundColor(SELECTED_HOVER, color);
- parent.attr.setBackGroundColor(SELECTED_DISABLE, color);
- parent.attr.setBackGroundColor(SELECTED_FOCUSED, color);
- parent.attr.setBackGroundColor(NORMAL, color);
- parent.attr.setBackGroundColor(NORML_HOVER, color);
- parent.attr.setBackGroundColor(NORMAL_DISABLE, color);
- parent.attr.setBackGroundColor(NORMAL_FOCUSED, color);
+ parent.getAttribute().setBackGroundColor(ENABLE, color);
}
@Override
protected void setForeground(Color color) {
- parent.attr.setForeGroundColor(SELECTED, color);
- parent.attr.setForeGroundColor(SELECTED_HOVER, color);
- parent.attr.setForeGroundColor(SELECTED_DISABLE, color);
- parent.attr.setForeGroundColor(SELECTED_FOCUSED, color);
- parent.attr.setForeGroundColor(NORMAL, color);
- parent.attr.setForeGroundColor(NORML_HOVER, color);
- parent.attr.setForeGroundColor(NORMAL_DISABLE, color);
- parent.attr.setForeGroundColor(NORMAL_FOCUSED, color);
+ parent.getAttribute().setForeGroundColor(ENABLE, color);
+ }
+
+ private void drawMouseHover() {
+ if (!isEnable) {
+ return;
+ }
+ state |= HOVER;
+ parent.redraw();
+ }
+
+ private void drawMouseExit() {
+ if (!isEnable) {
+ return;
+ }
+ if (isFocus()) {
+ state |= FOCUS;
+ }
+ state &= ~HOVER;
+ parent.redraw();
+ }
+
+ @Override
+ protected void radioButtonPressed() {
+ if (!isEnable) {
+ return;
+ }
+ state ^= SELECT;
+ parent.redraw();
+ selectRadio();
+ parent.fireSelectionEvent();
}
@Override
protected void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (enabled) {
- if (getButtonState() == SELECTED_DISABLE) {
- setButtonState(SELECTED);
- } else if (getButtonState() == NORMAL_DISABLE) {
- setButtonState(NORMAL);
- }
+ state |= ENABLE;
} else {
- if (getButtonState() == SELECTED) {
- setButtonState(SELECTED_DISABLE);
- } else if (getButtonState() == NORMAL) {
- setButtonState(NORMAL_DISABLE);
- }
+ state &= ~ENABLE;
}
parent.redraw();
}
@Override
protected void setSelection(boolean selected) {
if (selected) {
- if (isEnable) {
- setButtonState(SELECTED);
- } else {
- setButtonState(SELECTED_DISABLE);
- }
+ state |= SELECT;
} else {
- if (isEnable) {
- setButtonState(NORMAL);
- } else {
- setButtonState(NORMAL_DISABLE);
- }
+ state &= ~SELECT;
}
parent.redraw();
}
@Override
protected boolean getSelection() {
- if (getButtonState() == SELECTED || getButtonState() == SELECTED_HOVER || getButtonState() == SELECTED_DISABLE || getButtonState() == SELECTED_FOCUSED) {
- return true;
- } else {
- return false;
- }
+ return((state & SELECT) == SELECT);
}
@Override
if (!isEnable) {
return true;
}
- if (getButtonState() == NORMAL) {
- setButtonState(NORMAL_FOCUSED);
- } else if (getButtonState() == SELECTED) {
- setButtonState(SELECTED_FOCUSED);
- }
+ state |= FOCUS;
parent.redraw();
return true;
}
if (!isEnable) {
return true;
}
- if (getButtonState() == NORMAL_FOCUSED) {
- setButtonState(NORMAL);
- } else if (getButtonState() == SELECTED_FOCUSED) {
- setButtonState(SELECTED);
- }
+ state &= ~FOCUS;
parent.redraw();
return false;
}
if (!(child instanceof Button)) {
continue;
}
-
if (!((Button) child).isEqualsType(child.getStyle(), SWT.RADIO)) {
continue;
}
if (parent == child) {
- ((Button) child).setButtonState(TizenCheckBoxButtonRenderer.SELECTED);
+ ((Button) child).setSelection(true);
} else {
- ((Button) child).setButtonState(TizenCheckBoxButtonRenderer.NORMAL);
+ ((Button) child).setSelection(false);
}
((Button) child).redraw();
}
}
- protected Image getImage(int state) {
- switch (getButtonState()) {
- case SELECTED:
- return TizenResourceManager.getInstance().radioSelected;
- case SELECTED_HOVER:
+ protected Image getImage() {
+ if (isState(state, (SELECT | ENABLE | HOVER))) {
return TizenResourceManager.getInstance().radioSelectedHover;
- case SELECTED_DISABLE:
- return TizenResourceManager.getInstance().radioSelectedDisable;
- case SELECTED_FOCUSED:
+ } else if (isState(state, (SELECT | ENABLE | FOCUS))) {
return TizenResourceManager.getInstance().radioSelectedFocused;
- case NORMAL:
- return TizenResourceManager.getInstance().radioNormal;
- case NORML_HOVER:
+ } else if (isState(state, (SELECT | ENABLE))) {
+ return TizenResourceManager.getInstance().radioSelected;
+ } else if (isState(state, (SELECT))) {
+ return TizenResourceManager.getInstance().radioSelectedDisable;
+ } else if (isState(state, (ENABLE | HOVER))) {
return TizenResourceManager.getInstance().radioNormalHover;
- case NORMAL_DISABLE:
- return TizenResourceManager.getInstance().radioNormalDisable;
- case NORMAL_FOCUSED:
+ } else if (isState(state, (ENABLE | FOCUS))) {
return TizenResourceManager.getInstance().radioNormalFocused;
- default:
+ } else if (isState(state, (ENABLE))) {
return TizenResourceManager.getInstance().radioNormal;
+ } else {
+ return TizenResourceManager.getInstance().radioNormalDisable;
}
}
Rectangle rect = me.getClientArea();
int x = 0;
int y = 0;
- Image img = getImage(getButtonState());
+ Image img = getImage();
if (null != img) {
Rectangle imgRect = img.getBounds();
y = (rect.height - imgRect.height) / 2;
y = (rect.height - fontHeight) / 2;
}
- if (null != parent.getAttribute().getForeGroundcolor(getButtonState())) {
- e.gc.setForeground(parent.getAttribute().getForeGroundcolor(getButtonState()));
+ if (null != parent.getAttribute().getForeGroundcolor(ENABLE)) {
+ e.gc.setForeground(parent.getAttribute().getForeGroundcolor(ENABLE));
} else if (null != parent.getForeground()) {
e.gc.setForeground(parent.getForeground());
} else {
/* Tizen */
public class Button extends TizenButton {
- public Button(Composite parent, int style) {
- super(parent, style);
- }
+ public Button(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ @Override
+ protected Widget[] getWidgetList() {
+ return computeTabRoot().computeTabList();
+ }
}
//public class Button extends Control {
}
return new Widget[0];
}
-
-Control computeTabRoot () {
+/* Tizen */
+//Control computeTabRoot () {
+protected Control computeTabRoot () {
+/* ==== */
Control[] tabList = parent._getTabList();
if (tabList != null) {
int index = 0;
}
@Override
-Control computeTabRoot () {
+/* Tizen */
+//Control computeTabRoot () {
+protected Control computeTabRoot () {
+/* ===== */
return this;
}
/* Tizen */
public class Button extends TizenButton {
- public Button(Composite parent, int style) {
- super(parent, style);
- }
+ public Button(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ @Override
+ protected Widget[] getWidgetList() {
+ return computeTabRoot().computeTabList();
+ }
}
//public class Button extends Control {
//}
//
//}
-/* ===== */
\ No newline at end of file
+/* ===== */
}
return new Widget[0];
}
-
-Control computeTabRoot () {
+/* Tizen */
+//Control computeTabRoot () {
+protected Control computeTabRoot () {
+/* ===== */
Control[] tabList = parent._getTabList();
if (tabList != null) {
int index = 0;
}
@Override
-Control computeTabRoot () {
+/* Tizen */
+//Control computeTabRoot () {
+protected Control computeTabRoot () {
+/* ===== */
return this;
}
/* Tizen */
public class Button extends TizenButton {
- public Button(Composite parent, int style) {
- super(parent, style);
- }
+ public Button(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ @Override
+ protected Widget[] getWidgetList() {
+ return computeTabRoot().computeTabList();
+ }
}
//public class Button extends Control {
if (isTabGroup ()) return this;
return parent.computeTabGroup ();
}
-
-Control computeTabRoot () {
+/* Tizen */
+//Control computeTabRoot () {
+protected Control computeTabRoot () {
+/* ===== */
Control [] tabList = parent._getTabList ();
if (tabList != null) {
int index = 0;
}
@Override
-Control computeTabRoot () {
+/* Tizen */
+//Control computeTabRoot () {
+protected Control computeTabRoot () {
+/* ===== */
return this;
}