DiscreteGraphicSelectionContext (class)
public abstract DiscreteGraphicSelectionContext {inherits DiscreteSelectionContext, ContainerDragScroller}
Import from: CURL.GUI.STANDARD. Defined in package CURL.GUI.SHAPES.
Direct Known Subclasses: DiscreteGraphicSelectionFrame

Standard SelectionContext for desktop-like discrete selection of Shapes and Graphics.

Description

This context allows users to select GraphicSelectables or ShapeSelectables that have been associated with objects that fall within it.

This class supports dragging out of rectangular selection rectangles as well as standard click selection. It also supports additive (i.e. CTRL key depressed) as well as standard selection modes.

To use, mix-in to a Box.

Notes

DiscreteGraphicSelectionFrame is an implementation of this class that is directly usable.

Constructors
default:Construct new DiscreteGraphicSelectionContext
constructor public {DiscreteGraphicSelectionContext.default
draw-style:GraphicSelectableDrawStyle = GraphicSelectableDrawStyle.invert,
selection-rectangle-enabled?:bool = true,
multiple-selection-enabled?:bool = true
}

Properties
container:The Graphic to which this SelectionContext applies.
accessor public DiscreteGraphicSelectionContext.container:Graphic
draw-style:How should the selected Graphics or Shapes be drawn when they are selected?
field public DiscreteGraphicSelectionContext.draw-style:GraphicSelectableDrawStyle =GraphicSelectableDrawStyle.invert
selection-rectangle-enabled?:Should a drag gesture create a rectangle for multiple selection?
field public DiscreteGraphicSelectionContext.selection-rectangle-enabled?:bool =true
Properties inherited from DiscreteSelectionContext: multiple-selection-enabled?, selection
Properties inherited from ContainerDragScroller: ctrl-mode?, dragscrolling?, inner-scroll-buffer
Properties inherited from SelectionContext: can-redo?, can-undo?, selection-context-active?
Properties inherited from CommandContext: commands
Properties inherited from EventTarget: event-handlers

Methods
create-command:Create a command lazily
public {DiscreteGraphicSelectionContext.create-command
name:String
}:#Command
internal-fire-event-at-selectable:Fire a SelectionEvent at a Selectable
protected {DiscreteGraphicSelectionContext.internal-fire-event-at-selectable}:void
note-dragscroll-continued:Note that the dragscroll gesture is continuing.
public {DiscreteGraphicSelectionContext.note-dragscroll-continued}:void
note-dragscroll-ended:Note that the dragscroll gesture has ended.
public {DiscreteGraphicSelectionContext.note-dragscroll-ended}:void
note-dragscroll-started:Note that the dragscroll gesture has begun.
public {DiscreteGraphicSelectionContext.note-dragscroll-started}:void
on-drag-started:The static event handler for DragStarted events.
public {DiscreteGraphicSelectionContext.on-drag-started}:void
on-pointer-press:The static event handler for PointerPress events.
public {DiscreteGraphicSelectionContext.on-pointer-press}:void
on-pointer-release:The static event handler for PointerRelease events.
public {DiscreteGraphicSelectionContext.on-pointer-release}:void
overdraw-selection:Draw selection affordances on top of g which is in this selection context.
public {DiscreteGraphicSelectionContext.overdraw-selection}:void
overdraw-shape-selection:Draw selection affordances on top of s which is in this selection context.
public {DiscreteGraphicSelectionContext.overdraw-shape-selection
shape:Shape,
selectable:ShapeSelectable,
gc:Renderer2d
}:bool
select-all:Select all Selectables within this context.
public {DiscreteGraphicSelectionContext.select-all}:void
Methods inherited from DiscreteSelectionContext: deselect, note-selection-context-activated, note-selection-context-deactivated, select, select-nothing, swap-selection
Methods inherited from ContainerDragScroller: on-grab-release, on-pointer-motion, start-dragscroll
Methods inherited from SelectionContext: on-selection-changed, redo, selection-context-request-activate, undo
Methods inherited from GuiEventTarget: handle-delegate-event, handle-event, on-action, on-cancel-mode, on-command-changed, on-commit, on-composition-change-event, on-composition-result-event, on-context-menu-event, on-current-record-change-request, on-current-record-changed, on-destroy-notify, on-destroy-requested, on-drag-enter, on-drag-leave, on-drag-over, on-drag-pointer, on-drop, on-end-composition-event, on-focus-event, on-focus-in, on-focus-out, on-gesture, on-gesture-begin, on-gesture-end, on-gesture-magnify, on-gesture-pan, on-gesture-rotate, on-gesture-swipe, on-gesture-tap, on-gesture-touch, on-gui-event, on-input-method-event, on-inspection, on-key-event, on-key-press, on-pointer-button, on-pointer-crossing, on-pointer-enter, on-pointer-envelope-event, on-pointer-event, on-pointer-leave, on-pointer-scroll, on-raw-key-event, on-raw-key-press, on-raw-key-release, on-reset, on-selectable-added, on-selectable-removed, on-selection-context-activated, on-selection-context-deactivated, on-selection-event, on-start-composition-event, on-start-event, on-stop-event, on-view-activate, on-view-deactivate, on-window-close, remove-event-handlers-for-event-class
Methods inherited from CommandContext: add-command, command-enabled?, command-supported?, do-command, get-command, request-update-commands
Methods inherited from EventTarget: accepts-event-class?, add-event-handler, event-handler-present?, remove-event-handler, verify-event
Methods inherited from BasicEventTarget: enqueue-event
Methods inherited from Object: object-describe, object-describe-for-debugging, object-serialize



Constructor Details
default (constructor)
public {DiscreteGraphicSelectionContext.default
draw-style:GraphicSelectableDrawStyle = GraphicSelectableDrawStyle.invert,
selection-rectangle-enabled?:bool = true,
multiple-selection-enabled?:bool = true
}

Construct new DiscreteGraphicSelectionContext

draw-style: GraphicSelectableDrawStyle indicating the style with which the selected items should be displayed. To display selected items in a custom way, specify GraphicSelectableDrawStyle.none and provide event handlers on the GraphicSelectables and ShapeSelectables.
selection-rectangle-enabled?: Should this context support selection via dragging out a selection rectangle?
multiple-selection-enabled?: Should this context support selection of multiple items?



Property Details
container (accessor)
accessor public DiscreteGraphicSelectionContext.container:Graphic

The Graphic to which this SelectionContext applies.

Description

All contents of this Graphic (including graphical children) which are not members of a nested SelectionContext are candidates for selection by this object.


draw-style (field)
public DiscreteGraphicSelectionContext.draw-style:GraphicSelectableDrawStyle =GraphicSelectableDrawStyle.invert

How should the selected Graphics or Shapes be drawn when they are selected?

Description

The selected items can be drawn by default in several ways, as specified by GraphicSelectableDrawStyle. Note that users may also change properties of the Graphics (i.e. background) as they are selected/deselected by adding event handlers to the individual instances of GraphicSelectable or ShapeSelectable.


selection-rectangle-enabled? (field)
public DiscreteGraphicSelectionContext.selection-rectangle-enabled?:bool =true

Should a drag gesture create a rectangle for multiple selection?






Method Details
create-command (method)
public {DiscreteGraphicSelectionContext.create-command
name:String
}:#Command

Create a command lazily

Description

Not normally called directly. Consider calling CommandContext.get-command instead.

Overriding

Override this method for any commands which should be instantiated dynamically for this CommandContext when requested. Be sure to call the superclass implementation of this method if you wish to inherit dynamically created commands from the superclasses as well.

Note that commands may also be specified by calling the method CommandContext.add-command in the class constructor. For performance reasons, and to allow subclasses to override commands, it is recommended to use this method instead.


internal-fire-event-at-selectable (method)
protected {DiscreteGraphicSelectionContext.internal-fire-event-at-selectable}:void

Fire a SelectionEvent at a Selectable

Overriding

Subclasses that wish to take additional steps before or after the firing of these events should override this method.


note-dragscroll-continued (method)
public {DiscreteGraphicSelectionContext.note-dragscroll-continued}:void

Note that the dragscroll gesture is continuing.

x: Horizontal point where the gesture continues.
y: Vertical point where the gesture continues.

Description

This method will be called whenever the mouse moves or, if autoscrolling is occurring, at the regular intervals when the autoscrolling timer fires.


note-dragscroll-ended (method)
public {DiscreteGraphicSelectionContext.note-dragscroll-ended}:void

Note that the dragscroll gesture has ended.



note-dragscroll-started (method)
public {DiscreteGraphicSelectionContext.note-dragscroll-started}:void

Note that the dragscroll gesture has begun.

x: Horizontal point where the gesture started.
y: Vertical point where the gesture started.


on-drag-started (method)
public {DiscreteGraphicSelectionContext.on-drag-started}:void

The static event handler for DragStarted events.

Description

See GuiEventTarget.on-pointer-event for general information about static event handlers.


on-pointer-press (method)
public {DiscreteGraphicSelectionContext.on-pointer-press}:void

The static event handler for PointerPress events.

Description

See GuiEventTarget.on-pointer-event for general information about static event handlers.


on-pointer-release (method)
public {DiscreteGraphicSelectionContext.on-pointer-release}:void

The static event handler for PointerRelease events.

Description

See GuiEventTarget.on-pointer-event for general information about static event handlers.


overdraw-selection (method)
public {DiscreteGraphicSelectionContext.overdraw-selection}:void

Draw selection affordances on top of g which is in this selection context.

Description

This method is called by the curl drawing mechanism and should not typically be called directly.

Overriding

Implementations of this method should note that the clipping-rectangle set on gc is set to be the cell-bounds of g. This allows the SelectionContext to draw selection affordances on top of g's border and margins as well as g's bounds. Note that it may be appropriate for implementations of this method to perform further clipping, and in particular before calling associated draw methods on g.


overdraw-shape-selection (method)
public {DiscreteGraphicSelectionContext.overdraw-shape-selection
shape:Shape,
selectable:ShapeSelectable,
gc:Renderer2d
}:bool

Draw selection affordances on top of s which is in this selection context.

Returns

A bool indicating whether or not the Shape was selected. It is true if the Shape was selected, and therefore was overdrawn.

Description

This method is called by the curl drawing mechanism and should not typically be called directly.

Notes

This method is very similar to DiscreteGraphicSelectionContext.overdraw-selection, except that it deals with Shape objects instead of Graphic objects. Also, please note that shape may not correspond to selectable.shape. selectable may in fact be the ShapeSelectable belonging to one of the ancestors of shape.


select-all (method)
public {DiscreteGraphicSelectionContext.select-all}:void

Select all Selectables within this context.

Description

If DiscreteSelectionContext.multiple-selection-enabled? is false, calling this method will result in an error.