From fe70719d67a964c9e8d961818641ae41e0a94670 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 14 May 2014 20:46:47 +0300 Subject: Move guitableactionlistener into separate file. --- src/gui/widgets/guitable.cpp | 54 +------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 6feed2b12..298348f78 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -31,6 +31,7 @@ #include "input/keydata.h" #include "listeners/actionlistener.h" +#include "listeners/guitableactionlistener.h" #include "render/graphics.h" @@ -41,59 +42,6 @@ float GuiTable::mAlpha = 1.0; -class GuiTableActionListener final : public ActionListener -{ -public: - GuiTableActionListener(GuiTable *restrict _table, - Widget *restrict _widget, - int _row, int _column); - - A_DELETE_COPY(GuiTableActionListener) - - ~GuiTableActionListener(); - - void action(const ActionEvent& actionEvent) override final; - -protected: - GuiTable *mTable; - int mRow; - int mColumn; - Widget *mWidget; -}; - - -GuiTableActionListener::GuiTableActionListener(GuiTable *restrict table, - Widget *restrict widget, - int row, int column) : - ActionListener(), - mTable(table), - mRow(row), - mColumn(column), - mWidget(widget) -{ - if (widget) - { - widget->addActionListener(this); - widget->setParent(table); - } -} - -GuiTableActionListener::~GuiTableActionListener() -{ - if (mWidget) - { - mWidget->removeActionListener(this); - mWidget->setParent(nullptr); - } -} - -void GuiTableActionListener::action(const ActionEvent &actionEvent A_UNUSED) -{ - mTable->setSelected(mRow, mColumn); - mTable->distributeActionEvent(); -} - - GuiTable::GuiTable(const Widget2 *const widget, TableModel *const initial_model, const bool opacity) : -- cgit v1.2.3-70-g09d2