2004-01-26 08:10:06 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2007-04-28 17:24:54 +00:00
|
|
|
* Copyright (C) 2001-2007 The ScummVM project
|
2004-01-26 08:10:06 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-01-26 08:10:06 +00:00
|
|
|
*
|
2006-02-11 12:47:47 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2004-01-26 08:10:06 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2004-01-26 08:10:06 +00:00
|
|
|
#include "ItemAction.h"
|
|
|
|
|
|
|
|
namespace CEGUI {
|
|
|
|
|
2005-07-05 20:27:14 +00:00
|
|
|
ItemAction::ItemAction(WORD reference, GUI::ActionType action) :
|
2004-01-26 08:10:06 +00:00
|
|
|
PanelItem(reference) {
|
|
|
|
_action = action;
|
2005-07-05 20:27:14 +00:00
|
|
|
if (!GUI::Actions::Instance()->isEnabled(_action))
|
2004-01-26 08:10:06 +00:00
|
|
|
_visible = false;
|
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
ItemAction::~ItemAction() {
|
2004-01-26 08:10:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ItemAction::action(int x, int y, bool pushed) {
|
|
|
|
|
2004-01-26 20:32:29 +00:00
|
|
|
if (checkInside(x, y) && _visible && pushed) {
|
2007-04-28 17:24:54 +00:00
|
|
|
GUI::Actions::Instance()->perform(_action, true);
|
|
|
|
GUI::Actions::Instance()->perform(_action, false);
|
2004-01-26 08:10:06 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
2005-06-24 16:08:31 +00:00
|
|
|
}
|