ManaPlus
Public Member Functions | Private Attributes
TextSkillListener Class Reference

#include <textskilllistener.h>

Inheritance diagram for TextSkillListener:
ActionListener

Public Member Functions

 TextSkillListener ()
 
void action (const ActionEvent &event)
 
void setSkill (const int skillId, const int x, const int y, const int level)
 
void setDialog (TextDialog *dialog)
 
- Public Member Functions inherited from ActionListener
virtual ~ActionListener ()
 

Private Attributes

TextDialogmDialog
 
int mSkillId
 
int mX
 
int mY
 
int mLevel
 

Additional Inherited Members

- Protected Member Functions inherited from ActionListener
 ActionListener ()
 

Detailed Description

Definition at line 31 of file textskilllistener.h.

Constructor & Destructor Documentation

◆ TextSkillListener()

TextSkillListener::TextSkillListener ( )

Definition at line 30 of file textskilllistener.cpp.

30  :
32  mDialog(nullptr),
33  mSkillId(0),
34  mX(0),
35  mY(0),
36  mLevel(0)
37 {
38 }
TextDialog * mDialog

Member Function Documentation

◆ action()

void TextSkillListener::action ( const ActionEvent actionEvent)
virtual

Called when an action is recieved from a widget. It is used to be able to recieve a notification that an action has occured.

Parameters
actionEventThe event of the action.

Implements ActionListener.

Definition at line 51 of file textskilllistener.cpp.

52 {
53  if (event.getId() == "ok" && (mDialog != nullptr))
54  {
55  const std::string text = mDialog->getText();
56  if (text.empty())
57  return;
59  mLevel,
60  mX, mY,
61  text);
62  }
63  mDialog = nullptr;
64 }
virtual void usePos(const int id, const int level, const int x, const int y) const =0
const std::string & getText() const
Definition: textdialog.cpp:124
Net::SkillHandler * skillHandler
Definition: net.cpp:97

References ActionEvent::getId(), TextDialog::getText(), mDialog, mLevel, mSkillId, mX, mY, skillHandler, and Net::SkillHandler::usePos().

◆ setDialog()

void TextSkillListener::setDialog ( TextDialog dialog)
inline

Definition at line 45 of file textskilllistener.h.

46  { mDialog = dialog; }

References mDialog.

Referenced by SkillDialog::useSkillDefault(), SkillDialog::useSkillPosition(), and SkillDialog::useSkillTarget().

◆ setSkill()

void TextSkillListener::setSkill ( const int  skillId,
const int  x,
const int  y,
const int  level 
)

Definition at line 40 of file textskilllistener.cpp.

44 {
45  mSkillId = skillId;
46  mX = x;
47  mY = y;
48  mLevel = level;
49 }

References mLevel, mSkillId, mX, mY, x, and y.

Referenced by SkillDialog::useSkillDefault(), SkillDialog::useSkillPosition(), and SkillDialog::useSkillTarget().

Field Documentation

◆ mDialog

TextDialog* TextSkillListener::mDialog
private

Definition at line 49 of file textskilllistener.h.

Referenced by action(), and setDialog().

◆ mLevel

int TextSkillListener::mLevel
private

Definition at line 53 of file textskilllistener.h.

Referenced by action(), and setSkill().

◆ mSkillId

int TextSkillListener::mSkillId
private

Definition at line 50 of file textskilllistener.h.

Referenced by action(), and setSkill().

◆ mX

int TextSkillListener::mX
private

Definition at line 51 of file textskilllistener.h.

Referenced by action(), and setSkill().

◆ mY

int TextSkillListener::mY
private

Definition at line 52 of file textskilllistener.h.

Referenced by action(), and setSkill().


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