Search in sources :

Example 6 with FrameEltGroupHalo

use of edu.cmu.cs.hcii.cogtool.uimodel.FrameEltGroupHalo in project cogtool by cogtool.

the class FrameEditorUI method showContextMenu.

/**
     * Show a context menu at a specific X,Y Used for contextual menu's on
     * unselected or selected objects.
     */
@Override
public void showContextMenu(int x, int y) {
    // Check which region of the frame was hit
    FrameEltSelnFig<?> eltFig = (FrameEltSelnFig<?>) frameUI.getFigureAtXY(x, y, FrameUIModel.ONLY_GRAPHICAL_WIDGETS);
    // Check for appropriate MoveHalo
    if (eltFig == null) {
        MoveHalo halo = moveHaloUnderXY(x, y);
        if (halo instanceof FrameEltGroupHalo) {
            eltFig = (FrameEltGroupHalo) halo;
        }
    }
    // Invocation in empty space?
    if (eltFig == null) {
        contextSelection.deselectAll();
        showContextMenu(contextSelection, View.CONTEXT);
    } else // Invocation on a selection widget
    if (eltFig.isSelected()) {
        showContextMenu();
        Iterator<FrameEltSelnFig<?>> selectedFigs = selection.getSelectedFigures();
        while (selectedFigs.hasNext()) {
            FrameEltSelnFig<?> selectedFig = selectedFigs.next();
            selectedFig.dynamicHighlight(true);
        }
        // The mac requires an additional repaint to display the highlight
        if (OSUtils.MACOSX) {
            updateUISupport();
        }
    } else // Invocation on an unselected widget
    {
        eltFig.dynamicHighlight(true);
        // Populate the context selection
        // This does not impact current selection, just the context one.
        contextSelection.setSelectedSelnFig(eltFig);
        // Display the correct context menu.
        showContextMenu(contextSelection, View.CONTEXT);
        // The mac requires an additional repaint to display highlighting
        if (OSUtils.MACOSX) {
            updateUISupport();
        }
    }
}
Also used : MoveHalo(edu.cmu.cs.hcii.cogtool.view.MoveHalo) Iterator(java.util.Iterator) FrameEltSelnFig(edu.cmu.cs.hcii.cogtool.uimodel.FrameEltSelnFig) FrameEltGroupHalo(edu.cmu.cs.hcii.cogtool.uimodel.FrameEltGroupHalo)

Aggregations

FrameEltGroupHalo (edu.cmu.cs.hcii.cogtool.uimodel.FrameEltGroupHalo)6 DoublePoint (edu.cmu.cs.hcii.cogtool.model.DoublePoint)4 GraphicalWidget (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalWidget)4 IWidget (edu.cmu.cs.hcii.cogtool.model.IWidget)3 SimpleWidgetGroup (edu.cmu.cs.hcii.cogtool.model.SimpleWidgetGroup)3 FrameEltSelnFig (edu.cmu.cs.hcii.cogtool.uimodel.FrameEltSelnFig)3 GraphicalChildWidget (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalChildWidget)3 MoveHalo (edu.cmu.cs.hcii.cogtool.view.MoveHalo)3 Iterator (java.util.Iterator)3 DoubleRectangle (edu.cmu.cs.hcii.cogtool.model.DoubleRectangle)2 FrameElement (edu.cmu.cs.hcii.cogtool.model.FrameElement)2 GridButton (edu.cmu.cs.hcii.cogtool.model.GridButton)2 GraphicalTraversableWidget (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalTraversableWidget)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 FrameElementGroup (edu.cmu.cs.hcii.cogtool.model.FrameElementGroup)1 GridButtonGroup (edu.cmu.cs.hcii.cogtool.model.GridButtonGroup)1 TraversableWidget (edu.cmu.cs.hcii.cogtool.model.TraversableWidget)1 GraphicalMenuItem (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalMenuItem)1 GraphicalParentWidget (edu.cmu.cs.hcii.cogtool.uimodel.GraphicalParentWidget)1 InteractionDrawingEditor (edu.cmu.cs.hcii.cogtool.view.InteractionDrawingEditor)1