diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-14 20:46:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-14 20:49:50 +0300 |
commit | fe70719d67a964c9e8d961818641ae41e0a94670 (patch) | |
tree | 72a7bfd32316228b0b63f51c9db7f04f82d9b83a /src/gui | |
parent | bc3fd285b51fbcb02958307e76b4bca8aabb1792 (diff) | |
download | plus-fe70719d67a964c9e8d961818641ae41e0a94670.tar.gz plus-fe70719d67a964c9e8d961818641ae41e0a94670.tar.bz2 plus-fe70719d67a964c9e8d961818641ae41e0a94670.tar.xz plus-fe70719d67a964c9e8d961818641ae41e0a94670.zip |
Move guitableactionlistener into separate file.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/guitable.cpp | 54 |
1 files changed, 1 insertions, 53 deletions
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) : |