use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionPropertySet method createKeyComposite.
@Override
protected Composite createKeyComposite() {
Composite c = super.createKeyComposite();
// this.setAsDefaultKeyboard enabling handled in the override of
// handleModifiedText because our superclass already has a
// ModifyListener on this.keyboardText!
setAsDefaultKeyboard = createSetAsDefaultButton(c);
restoreDefaultsKeyboard = createRestoreDefaultsButton(c);
keyboardChoice = choiceStrings.size();
choiceStrings.add(KEYBOARD_LABEL);
choiceUseIndexes[keyboardChoice] = ActionSet.USE_KEYBOARD;
return c;
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionSet method createVoiceComposite.
protected Composite createVoiceComposite() {
Composite voiceComp = new Composite(actionSettings, SWT.NONE);
voiceComp.setLayout(new FormLayout());
voiceTextLabel = new DisplayLabel(voiceComp, SWT.NONE);
voiceTextLabel.setText(L10N.get("DE.VoiceTextCaption", "Spoken Input") + ":");
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionDestinationLabelVoice = createTransitionDestinationLabel(voiceComp);
transitionDestinationNameVoice = createTransitionDestinationName(voiceComp);
voiceText = createVoiceText(voiceComp);
voiceIsCmd = new Button(voiceComp, SWT.CHECK);
voiceIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
voiceIsCmd.addSelectionListener(deviceActionChange);
return voiceComp;
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionSet method createTouchComposite.
protected Composite createTouchComposite() {
Composite touchComp = new Composite(actionSettings, SWT.NONE);
touchComp.setLayout(new FormLayout());
touchActionLabel = new DisplayLabel(touchComp, SWT.NONE);
touchActionLabel.setText(L10N.get("DE.ButtonActionCaption", "Action") + ":");
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionSourceLabelTouch = createTransitionSourceLabel(touchComp);
transitionSourceNameTouch = createTransitionSourceName(touchComp);
transitionDestinationLabelTouch = createTransitionDestinationLabel(touchComp);
transitionDestinationNameTouch = createTransitionDestinationName(touchComp);
touchActionCombo = new ComboWithEnableFix(touchComp, SWT.DROP_DOWN | SWT.READ_ONLY);
for (TapPressType element : TapPressType.DISPLAY) {
touchActionCombo.add(element.toString());
}
touchActionCombo.select(0);
touchActionCombo.addSelectionListener(widgetActionChange);
return touchComp;
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionSet method createKeyComposite.
protected Composite createKeyComposite() {
Composite keyComp = new Composite(actionSettings, SWT.NONE);
keyComp.setLayout(new FormLayout());
keyboardTextLabel = new DisplayLabel(keyComp, SWT.NONE);
keyboardTextLabel.setText(L10N.get("DE.KeyboardTextCaption", "Text") + ":");
keyboardText = createKeyboardText(keyComp);
keyboardText.setFont(FontUtils.SYMBOL_FONT);
keyboardIsCmd = new Button(keyComp, SWT.CHECK);
keyboardIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
keyboardIsCmd.addSelectionListener(deviceActionChange);
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionDestinationLabelKeyboard = createTransitionDestinationLabel(keyComp);
transitionDestinationNameKeyboard = createTransitionDestinationName(keyComp);
/* TODO: add back in when single character stuff is straightened out
this.keyboardActionLabel = new DisplayLabel(keyComp, SWT.NONE);
this.keyboardActionLabel.setText(L10N.get("DE.KeyActionCaption",
"Action")
+ ":");
this.keyboardActionCombo =
new ComboWithEnableFix(keyComp,
SWT.DROP_DOWN | SWT.READ_ONLY);
for (int i = 0; i < KeyPressType.DISPLAY.length; i++) {
this.keyboardActionCombo.add(KeyPressType.DISPLAY[i].toString());
}
this.keyboardActionCombo.select(0);
this.keyboardActionCombo.addSelectionListener(this.deviceActionChange);
*/
SelectionListener insertSpecial = new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
Control source = (Control) e.getSource();
keyboardText.insert((String) source.getData());
Point selection = keyboardText.getSelection();
keyboardText.setFocus();
keyboardText.setSelection(selection);
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
};
// TODO: replace alignTo with this.keyboardActionCombo when the above TODO is done!
// can't assign using ?: because Java is stupid
Control alignTo;
if (vertical) {
alignTo = transitionDestinationNameKeyboard;
} else {
alignTo = keyboardText.getOuter();
}
keyboardSpecials = new KeyboardSpecialChars(alignTo, insertSpecial, vertical);
return keyComp;
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class Palette method selectButton.
protected void selectButton(Button toBeSelected) {
// It's a toggle button, but pushing it again shouldn't toggle
// We use toggle so that it can be seen as "depressed".
Button currentlySelected = (Button) getData();
if (toBeSelected != currentlySelected) {
if (currentlySelected != null) {
Composite bkg = currentlySelected.getParent();
bkg.setBackground(UNSELECTED_BKG);
currentlySelected.setSelection(false);
}
}
Composite bkg = toBeSelected.getParent();
bkg.setBackground(SELECTED_BKG);
toBeSelected.setSelection(true);
setData(toBeSelected);
}
Aggregations