hydrogen 1.2.3
SelectionWidget< Elem > Class Template Referenceabstract

SelectionWidget defines the interface used by the Selection manager to communicate with a widget implementing selection, and provides for event translation, testing for intersection with selectable objects, keyboard input cursor geometry, and screen refresh. More...

#include <Selection.h>

Public Types

typedef Elem SelectionIndex
 

Public Member Functions

virtual bool canDragElements ()
 Can elements be dragged as well as being selected? This may change to suit widget's current state.
 
virtual bool checkDeselectElements (std::vector< SelectionIndex > &elements)
 Inform the client that we're deselecting elements.
 
virtual std::vector< SelectionIndexelementsIntersecting (QRect r)=0
 Find list of elements which intersect a rectangular area.
 
virtual QScrollArea * findScrollArea ()
 Find the QScrollArea, if any, which contains the widget.
 
virtual QRect getKeyboardCursorRect ()=0
 Calculate screen space occupied by keyboard cursor.
 
virtual void updateWidget ()=0
 Selection or selection-related visual elements have changed, widget needs to be updated.
 
virtual void validateSelection ()=0
 Ensure that the Selection contains only valid elements.
 
User-level mouse events

Inform client of user-level mouse actions.

  • Clicks are delivered as a single event callback
  • Drags have separate events for start, update and end

Additionally, dragging a selection is managed by the Selection class and only an 'end' event is delivered to the client.

virtual void mouseClickEvent (QMouseEvent *ev)=0
 
virtual void mouseDragStartEvent (QMouseEvent *ev)=0
 
virtual void mouseDragUpdateEvent (QMouseEvent *ev)=0
 
virtual void mouseDragEndEvent (QMouseEvent *ev)=0
 
virtual void selectionMoveUpdateEvent (QMouseEvent *ev)
 
virtual void selectionMoveEndEvent (QInputEvent *ev)=0
 
virtual void selectionMoveCancelEvent ()
 
Mouse gesture hooks

Hooks for extra actons (eg.

changing the mouse cursor) at the beginning and end of mouse gestures.

virtual void startMouseLasso (QMouseEvent *ev)
 
virtual void startMouseMove (QMouseEvent *ev)
 
virtual void endMouseGesture ()
 

Detailed Description

template<class Elem>
class SelectionWidget< Elem >

SelectionWidget defines the interface used by the Selection manager to communicate with a widget implementing selection, and provides for event translation, testing for intersection with selectable objects, keyboard input cursor geometry, and screen refresh.

It must be subclassed and implemented by any widget which uses the Selection class.

Definition at line 47 of file Selection.h.

Member Typedef Documentation

◆ SelectionIndex

template<class Elem >
typedef Elem SelectionIndex

Definition at line 50 of file Selection.h.

Member Function Documentation

◆ canDragElements()

template<class Elem >
virtual bool canDragElements ( )
inlinevirtual

Can elements be dragged as well as being selected? This may change to suit widget's current state.

Reimplemented in SongEditor.

Definition at line 57 of file Selection.h.

◆ checkDeselectElements()

template<class Elem >
virtual bool checkDeselectElements ( std::vector< SelectionIndex > & elements)
inlinevirtual

Inform the client that we're deselecting elements.

Definition at line 70 of file Selection.h.

◆ elementsIntersecting()

template<class Elem >
virtual std::vector< SelectionIndex > elementsIntersecting ( QRect r)
pure virtual

Find list of elements which intersect a rectangular area.

This may be a selection lasso rectangle, or a single point such as a mouse click. This should concern itself only with the geometry.

Implemented in DrumPatternEditor, NotePropertiesRuler, PianoRollEditor, and SongEditor.

◆ endMouseGesture()

template<class Elem >
virtual void endMouseGesture ( )
inlinevirtual

Reimplemented in PatternEditor, and SongEditor.

Definition at line 99 of file Selection.h.

◆ findScrollArea()

template<class Elem >
virtual QScrollArea * findScrollArea ( )
inlinevirtual

Find the QScrollArea, if any, which contains the widget.

This will be used to scroll the widget during drag operations.

Definition at line 104 of file Selection.h.

◆ getKeyboardCursorRect()

template<class Elem >
virtual QRect getKeyboardCursorRect ( )
pure virtual

Calculate screen space occupied by keyboard cursor.

Implemented in DrumPatternEditor, NotePropertiesRuler, PianoRollEditor, and SongEditor.

◆ mouseClickEvent()

template<class Elem >
virtual void mouseClickEvent ( QMouseEvent * ev)
pure virtual

◆ mouseDragEndEvent()

template<class Elem >
virtual void mouseDragEndEvent ( QMouseEvent * ev)
pure virtual

◆ mouseDragStartEvent()

template<class Elem >
virtual void mouseDragStartEvent ( QMouseEvent * ev)
pure virtual

◆ mouseDragUpdateEvent()

template<class Elem >
virtual void mouseDragUpdateEvent ( QMouseEvent * ev)
pure virtual

◆ selectionMoveCancelEvent()

template<class Elem >
virtual void selectionMoveCancelEvent ( )
inlinevirtual

Reimplemented in NotePropertiesRuler.

Definition at line 91 of file Selection.h.

◆ selectionMoveEndEvent()

template<class Elem >
virtual void selectionMoveEndEvent ( QInputEvent * ev)
pure virtual

◆ selectionMoveUpdateEvent()

template<class Elem >
virtual void selectionMoveUpdateEvent ( QMouseEvent * ev)
inlinevirtual

Reimplemented in NotePropertiesRuler.

Definition at line 89 of file Selection.h.

◆ startMouseLasso()

template<class Elem >
virtual void startMouseLasso ( QMouseEvent * ev)
inlinevirtual

Reimplemented in PatternEditor, and SongEditor.

Definition at line 97 of file Selection.h.

◆ startMouseMove()

template<class Elem >
virtual void startMouseMove ( QMouseEvent * ev)
inlinevirtual

Reimplemented in PatternEditor.

Definition at line 98 of file Selection.h.

◆ updateWidget()

template<class Elem >
virtual void updateWidget ( )
pure virtual

Selection or selection-related visual elements have changed, widget needs to be updated.

At a minimum, the widget's own update() method should be called.

Implemented in PatternEditor, and SongEditor.

◆ validateSelection()

template<class Elem >
virtual void validateSelection ( )
pure virtual

Ensure that the Selection contains only valid elements.

Implemented in PatternEditor, and SongEditor.