FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::ActionEvent Class Reference

#include <actionevent.hpp>

Inheritance diagram for fcn::ActionEvent:
fcn::Event

Public Member Functions

 ActionEvent (Widget *source, std::string id)
std::string const & getId () const
Public Member Functions inherited from fcn::Event
 Event (Widget *source)
WidgetgetSource () const

Protected Attributes

std::string mId
Protected Attributes inherited from fcn::Event
WidgetmSource {nullptr}

Detailed Description

Represents an action trigger (e.g., button click).

An action event is an event that can be fired by a widget whenever an action has occurred. What exactly an action is is up to the widget that fires the action event. An example is a Button which fires an action event as soon as the Button is clicked, another example is TextField which fires an action event as soon as the enter key is pressed.

Any object can listen for actions from widgets by implementing the ActionListener interface.

If you have implement a widget of your own it's a good idea to let the widget fire action events whenever you feel an action has occurred so action listeners of the widget can be informed of the state of the widget.

See also
Widget::addActionListener, Widget::removeActionListener, Widget::distributeActionEvent

Definition at line 41 of file actionevent.hpp.

Constructor & Destructor Documentation

◆ ActionEvent()

fcn::ActionEvent::ActionEvent ( Widget * source,
std::string id )

Constructor.

Parameters
sourceThe source widget of the event.
idAn identifier of the event.

Definition at line 14 of file actionevent.cpp.

References fcn::Event::Event(), and mId.

Member Function Documentation

◆ getId()

std::string const & fcn::ActionEvent::getId ( ) const

Gets the identifier of the event.

An identifier can be used to distinguish from two actions from the same widget or to let many widgets fire the same widgets that should be treated equally.

Returns
The identifier of the event.

Definition at line 16 of file actionevent.cpp.

References mId.

Member Data Documentation

◆ mId

std::string fcn::ActionEvent::mId
protected

Holds the identifier of the event.

Definition at line 66 of file actionevent.hpp.

Referenced by ActionEvent(), and getId().


The documentation for this class was generated from the following files: