use of edu.cmu.cs.hcii.cogtool.util.ManagedCombo in project cogtool by cogtool.
the class SWTMouseState method dealWithEvent.
// Force subclasses to implement the "dealWith" versions
protected void dealWithEvent(Event evt) {
// if on Windows, handle contextual menu key
if (evt.type == SWT.MenuDetect) {
// isMenuClick true means a right-click; need location!
if (OSUtils.MACOSX || isMenuClick) {
Control c = (Control) evt.widget;
Text focusedText = WindowUtil.getFocusedText();
if (focusedText != null) {
if (focusedText instanceof ManagedText) {
ManagedText txt = (ManagedText) focusedText;
if (!txt.confirm(ManagedText.LOSE_FOCUS)) {
return;
}
}
c.forceFocus();
}
Combo focusedCombo = WindowUtil.getFocusedCombo();
if (focusedCombo != null) {
if (focusedCombo instanceof ManagedCombo) {
ManagedCombo combo = (ManagedCombo) focusedCombo;
if (!combo.confirm(ManagedCombo.LOSE_FOCUS)) {
return;
}
}
c.forceFocus();
}
Point p = c.toControl(evt.x, evt.y);
menuUI.showContextMenu(p.x, p.y);
} else {
menuUI.showContextMenu();
}
}
}
use of edu.cmu.cs.hcii.cogtool.util.ManagedCombo in project cogtool by cogtool.
the class Draw2DMouseState method dealWithEvent.
// Force subclasses to implement the "dealWith" versions
/**
* Returns true if subclass processing should continue, false
* if subclass processing should be terminated.
*/
protected boolean dealWithEvent(Event evt) {
if (evt.type == SWT.MenuDetect) {
// that each of our windows using Draw2D contains only one Canvas!
if (isMenuClick || (OSUtils.MACOSX && (evt.widget instanceof Canvas))) {
Canvas c = (Canvas) evt.widget;
Text focusedText = WindowUtil.getFocusedText();
if (focusedText != null) {
if (focusedText instanceof ManagedText) {
ManagedText txt = (ManagedText) focusedText;
if (!txt.confirm(ManagedText.LOSE_FOCUS)) {
return false;
}
}
c.forceFocus();
}
Combo focusedCombo = WindowUtil.getFocusedCombo();
if (focusedCombo != null) {
if (focusedCombo instanceof ManagedCombo) {
ManagedCombo combo = (ManagedCombo) focusedCombo;
if (!combo.confirm(ManagedCombo.LOSE_FOCUS)) {
return false;
}
}
c.forceFocus();
}
Point p = c.toControl(evt.x, evt.y);
menuUI.showContextMenu(p.x, p.y);
} else {
menuUI.showContextMenu();
}
}
return true;
}
Aggregations