From e82b08179b74bd8bf54157897ee06626422f72b8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 12 May 2013 18:52:54 +0300 Subject: add double click selection in chat selection dialog. --- src/gui/charselectdialog.cpp | 6 +----- src/gui/widgets/characterdisplay.cpp | 8 ++++++++ src/gui/widgets/characterdisplay.h | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 65829662d..0cbac6a68 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -222,11 +222,7 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) if (selected >= 0) { - if (eventId == "select") - { - logger->log("select"); - } - else if (eventId == "use") + if (eventId == "use") { use(selected); return; diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index dba6be286..1815ec395 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -42,6 +42,8 @@ CharacterDisplay::CharacterDisplay(const Widget2 *const widget, { mPlayerBox->setActionEventId("select"); mPlayerBox->addActionListener(charSelectDialog); + setActionEventId("use"); + addActionListener(charSelectDialog); LayoutHelper h(this); ContainerPlacer placer = h.getPlacer(0, 0); @@ -114,3 +116,9 @@ void CharacterDisplay::mouseMoved(gcn::MouseEvent &event) SDL_GetMouseState(&mouseX, &mouseY); mPopup->show(mouseX, mouseY, mName->getCaption()); } + +void CharacterDisplay::mousePressed(gcn::MouseEvent &event) +{ + if (event.getClickCount() == 2) + distributeActionEvent(); +} diff --git a/src/gui/widgets/characterdisplay.h b/src/gui/widgets/characterdisplay.h index c7302ef48..ed8a36031 100644 --- a/src/gui/widgets/characterdisplay.h +++ b/src/gui/widgets/characterdisplay.h @@ -79,6 +79,8 @@ class CharacterDisplay final : public Container, void mouseMoved(gcn::MouseEvent &event) override; + void mousePressed(gcn::MouseEvent &event); + private: void update(); -- cgit v1.2.3-70-g09d2