Envision
A visual programming IDE for object-oriented languages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | Private Member Functions | Private Attributes
Interaction::Menu Class Referenceabstract

This class provides a standard interface for creating a menu which is opened at the last cursor position. More...

Inheritance diagram for Interaction::Menu:
Core::Reflect< Base >

Public Member Functions

virtual ~Menu ()
 
QVector< QVector< Visualization::Item * > > currentItems () const
 
bool executeFocused ()
 Executes the currently focused item's function. More...
 
Visualization::ItemfocusedItem () const
 The currently focused item. More...
 
void selectItem (Visualization::Item *item)
 Selects the given item as the focused item. More...
 
virtual void updateGeometry (int availableWidth, int availableHeight) override
 

Static Public Member Functions

static void hide ()
 Hides the active menu. More...
 
static void initializeForms ()
 
static bool isVisible ()
 Returns whether a menu is currently visible on screen. More...
 

Protected Member Functions

 Menu (QVector< QVector< Visualization::Item * >> items, Visualization::Item *selectedItem, Visualization::Item *target, StyleType *style=itemStyles().get())
 
virtual void endFocusMode (Visualization::Item *target)=0
 End focus mode on the given target. More...
 
virtual bool executeEntry (Visualization::Item *item)=0
 The function to execute when selecting the given visualization. More...
 
QPoint indexOf (Visualization::Item *item) const
 The index of the given item in the node grid. More...
 
virtual bool sceneEventFilter (QGraphicsItem *watched, QEvent *event) override
 
virtual void startFocusMode (Visualization::Item *target)=0
 Start focus mode with the given target to be focused. More...
 

Static Protected Member Functions

static void hideNow ()
 

Static Protected Attributes

static Menuinstance {}
 

Private Member Functions

QPoint correctCoordinates (QPoint point) const
 Corrects the coordinates given by the point to ensure they are located within the grid. More...
 

Private Attributes

QVector< QVector< Visualization::Item * > > currentItems_
 
Visualization::ItemfocusedItem_ {}
 
bool inFocusMode_ {}
 
QPointF mousePosition_
 
Visualization::Itemtarget_ {}
 

Additional Inherited Members

- Protected Types inherited from Core::Reflect< Base >
using Super = Reflect< Base >
 

Detailed Description

This class provides a standard interface for creating a menu which is opened at the last cursor position.

Any kind of node can be used and actions may be associated with the nodes. The interface can also optionally contain a text field which is located above the normal items, where any text can be entered.

Constructor & Destructor Documentation

◆ ~Menu()

Interaction::Menu::~Menu ( )
virtual

◆ Menu()

Interaction::Menu::Menu ( QVector< QVector< Visualization::Item * >>  items,
Visualization::Item selectedItem,
Visualization::Item target,
StyleType *  style = itemStyles().get() 
)
protected

Member Function Documentation

◆ correctCoordinates()

QPoint Interaction::Menu::correctCoordinates ( QPoint  point) const
private

Corrects the coordinates given by the point to ensure they are located within the grid.

Implements a wraparound technique if the position selected is out of bounds.

◆ currentItems()

QVector< QVector< Visualization::Item * > > Interaction::Menu::currentItems ( ) const
inline

◆ endFocusMode()

virtual void Interaction::Menu::endFocusMode ( Visualization::Item target)
protectedpure virtual

End focus mode on the given target.

◆ executeEntry()

virtual bool Interaction::Menu::executeEntry ( Visualization::Item item)
protectedpure virtual

The function to execute when selecting the given visualization.

◆ executeFocused()

bool Interaction::Menu::executeFocused ( )

Executes the currently focused item's function.

Returns whether it was successfully executed.

◆ focusedItem()

Visualization::Item * Interaction::Menu::focusedItem ( ) const
inline

The currently focused item.

Either the text field, or a visualization of one of the nodes.

◆ hide()

void Interaction::Menu::hide ( )
static

Hides the active menu.

◆ hideNow()

void Interaction::Menu::hideNow ( )
staticprotected

◆ indexOf()

QPoint Interaction::Menu::indexOf ( Visualization::Item item) const
protected

The index of the given item in the node grid.

Returns (-1, -1) if not found.

◆ initializeForms()

void Interaction::Menu::initializeForms ( )
static

◆ isVisible()

bool Interaction::Menu::isVisible ( )
inlinestatic

Returns whether a menu is currently visible on screen.

◆ sceneEventFilter()

bool Interaction::Menu::sceneEventFilter ( QGraphicsItem *  watched,
QEvent *  event 
)
overrideprotectedvirtual

◆ selectItem()

void Interaction::Menu::selectItem ( Visualization::Item item)

Selects the given item as the focused item.

◆ startFocusMode()

virtual void Interaction::Menu::startFocusMode ( Visualization::Item target)
protectedpure virtual

Start focus mode with the given target to be focused.

◆ updateGeometry()

void Interaction::Menu::updateGeometry ( int  availableWidth,
int  availableHeight 
)
overridevirtual

Member Data Documentation

◆ currentItems_

QVector<QVector<Visualization::Item*> > Interaction::Menu::currentItems_
private

◆ focusedItem_

Visualization::Item* Interaction::Menu::focusedItem_ {}
private

◆ inFocusMode_

bool Interaction::Menu::inFocusMode_ {}
private

◆ instance

Menu * Interaction::Menu::instance {}
staticprotected

◆ mousePosition_

QPointF Interaction::Menu::mousePosition_
private

◆ target_

Visualization::Item* Interaction::Menu::target_ {}
private