}
}
- if (event.type == SWT.MouseExit) {
- changeComboState(STATE_NORMAL);
- if (null != childShell && !childShell.isDisposed()) {
- Rectangle rect = combo.getBounds();
- if (rect.y + rect.height > event.y) {
- childShell.close();
- childShell = null;
- }
- }
- }
+ // if (event.type == SWT.MouseExit) {
+ // changeComboState(STATE_NORMAL);
+ // if (null != childShell && !childShell.isDisposed()) {
+ // Rectangle rect = combo.getBounds();
+ // if (rect.y + rect.height > event.y) {
+ // childShell.close();
+ // childShell = null;
+ // }
+ // }
+ // }
if (event.type == SWT.MouseDown) {
changeComboState(STATE_PUSH);
popup.addListener(SWT.MouseMove, canvasMouseEventListener);
popup.addListener(SWT.MouseUp, canvasMouseUpListener);
popup.addListener(SWT.FocusOut, canvasMouseEventListener);
+ popup.addListener(SWT.MouseWheel, canvasMouseEventListener);
if (size > MAX_SIZE) {
upArrowButton = new DAButton(childShell, SWT.NONE);
data.height = height;
upArrowButton.setLayoutData(data);
upArrowButton.addClickListener(upArrowListener);
- upArrowButton.setDAButtonAction(new ComboButtonAction(childShell,
- upArrowButton, true));
+// upArrowButton.setDAButtonAction(new ComboButtonAction(childShell,
+// upArrowButton, true));
shellHeight += height;
data = new FormData();
data.height = height;
downArrowButton.setLayoutData(data);
downArrowButton.addClickListener(downArrowListener);
- downArrowButton.setDAButtonAction(new ComboButtonAction(childShell,
- downArrowButton, false));
+// downArrowButton.setDAButtonAction(new ComboButtonAction(childShell,
+// downArrowButton, false));
shellHeight += height;
childShell.setSize(shellWidth, shellHeight);
}
}
- if (event.type == SWT.MouseExit) {
- if (null != upArrowButton && null != downArrowButton) {
- Rectangle rect = popup.getClientArea();
- if (rect.y < event.y && rect.y + rect.height > event.y) {
- childShell.close();
- childShell = null;
- }
- } else {
- childShell.close();
- childShell = null;
- }
- }
+ // if (event.type == SWT.MouseExit) {
+ // if (null != upArrowButton && null != downArrowButton) {
+ // Rectangle rect = popup.getClientArea();
+ // if (rect.y < event.y && rect.y + rect.height > event.y) {
+ // childShell.close();
+ // childShell = null;
+ // }
+ // } else {
+ // childShell.close();
+ // childShell = null;
+ // }
+ // }
if (event.type == SWT.FocusOut) {
childShell.close();
childShell = null;
}
+
+ if (event.type == SWT.MouseWheel) {
+ int size = getItems().size();
+ if (event.count < 0) {
+ if (itemIndex - event.count + MAX_SIZE >= size - 1) {
+ itemIndex = size - MAX_SIZE;
+ downArrowButton.setEnabled(false);
+ } else {
+ itemIndex -= event.count;
+ }
+
+ if (itemIndex - pageSize > 0) {
+ upArrowButton.setEnabled(true);
+ }
+ } else {
+
+ if (itemIndex - event.count < 0) {
+ itemIndex = 0;
+ upArrowButton.setEnabled(false);
+ } else {
+ itemIndex -= event.count;
+ }
+
+ if (itemIndex + event.count < size - 1) {
+ downArrowButton.setEnabled(true);
+ }
+ }
+ popup.redraw();
+ }
}
};
private Listener canvasMouseUpListener = new Listener() {