Search in sources :

Example 11 with Composite

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;
}
Also used : Composite(org.eclipse.swt.widgets.Composite)

Example 12 with Composite

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;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel)

Example 13 with Composite

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;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) TapPressType(edu.cmu.cs.hcii.cogtool.model.TapPressType) Composite(org.eclipse.swt.widgets.Composite) ComboWithEnableFix(edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel)

Example 14 with Composite

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;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) DisplayLabel(edu.cmu.cs.hcii.cogtool.util.DisplayLabel) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 15 with Composite

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);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button)

Aggregations

Composite (org.eclipse.swt.widgets.Composite)1543 GridData (org.eclipse.swt.layout.GridData)1136 GridLayout (org.eclipse.swt.layout.GridLayout)1098 Label (org.eclipse.swt.widgets.Label)594 SelectionEvent (org.eclipse.swt.events.SelectionEvent)495 Button (org.eclipse.swt.widgets.Button)492 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)421 Text (org.eclipse.swt.widgets.Text)373 Group (org.eclipse.swt.widgets.Group)233 ModifyListener (org.eclipse.swt.events.ModifyListener)152 ModifyEvent (org.eclipse.swt.events.ModifyEvent)149 Combo (org.eclipse.swt.widgets.Combo)135 FillLayout (org.eclipse.swt.layout.FillLayout)131 TableViewer (org.eclipse.jface.viewers.TableViewer)127 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)114 Table (org.eclipse.swt.widgets.Table)112 Point (org.eclipse.swt.graphics.Point)104 SelectionListener (org.eclipse.swt.events.SelectionListener)90 Control (org.eclipse.swt.widgets.Control)88 FormData (org.eclipse.swt.layout.FormData)87