diff options
-rw-r--r-- | src/gui/charselectdialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/playerbox.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/playerbox.h | 2 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index a912b9198..8315bb5d4 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -565,6 +565,9 @@ CharacterDisplay::CharacterDisplay(const Widget2 *const widget, mButton(new Button(this, "wwwwwwwww", "go", charSelectDialog)), mDelete(new Button(this, _("Delete"), "delete", charSelectDialog)) { + mPlayerBox->setActionEventId("use"); + mPlayerBox->addActionListener(charSelectDialog); + LayoutHelper h(this); ContainerPlacer placer = h.getPlacer(0, 0); diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 1718ef513..e6f5965d1 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -133,3 +133,13 @@ void PlayerBox::drawFrame(gcn::Graphics *graphics) } BLOCK_END("PlayerBox::drawFrame") } + +void PlayerBox::mouseReleased(gcn::MouseEvent& event) +{ + ScrollArea::mouseReleased(event); + if (event.getButton() == gcn::MouseEvent::LEFT) + { + if (!mActionEventId.empty()) + distributeActionEvent(); + } +} diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index b35b8175c..8526117a9 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -80,6 +80,8 @@ class PlayerBox final : public Widget2, Being *getBeing() A_WARN_UNUSED { return mBeing; } + void mouseReleased(gcn::MouseEvent& event); + private: Being *mBeing; /**< The character used for display */ |