2
Bear Engine - Model editor
4
Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
6
This program is free software; you can redistribute it and/or modify it
7
under the terms of the GNU General Public License as published by the
8
Free Software Foundation; either version 2 of the License, or (at your
9
option) any later version.
11
This program is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16
You should have received a copy of the GNU General Public License along
17
with this program; if not, write to the Free Software Foundation, Inc.,
18
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
contact: plee-the-bear@gamned.org
22
Please add the tag [Bear] in the subject of your mails.
25
* \file bf/history/action_set_item_field.hpp
26
* \brief The action of changing the value of a field of an item.
27
* \author S�bastien Angibaud
29
#ifndef __BF_ACTION_SET_ITEM_FIELD_HPP__
30
#define __BF_ACTION_SET_ITEM_FIELD_HPP__
32
#include "bf/history/model_action.hpp"
40
* \brief The action of changing the value of a field of an item.
41
* \author S�bastien Angibaud
43
template<typename ValueType>
44
class action_set_item_field:
49
* \brief Constructor. Remove the value of a field.
50
* \param item The item to modify.
51
* \param name The name of the field to change.
53
action_set_item_field( item_instance* item, const std::string& name );
56
* \brief Constructor. Give a new value to a field.
57
* \param item The item to modify.
58
* \param name The name of the field to change.
59
* \param val The new value of the field.
62
( item_instance* item, const std::string& name, const ValueType& val );
65
* \remark Calling execute() two times will restore the initial value.
67
void execute( gui_model& mdl );
68
void undo( gui_model& mdl );
70
bool is_identity( const gui_model& gui ) const;
71
wxString get_description() const;
74
/** \brief The item to modify. */
75
item_instance* const m_item;
77
/** \brief The name of the field to set. */
78
const std::string m_name;
80
/** \brief The new value of the field. */
83
/** \brief Tell if a value has been given to m_value. */
86
}; // class action_set_item_field
89
#include "bf/history/impl/action_set_item_field.tpp"
91
#endif // __BF_ACTION_SET_ITEM_FIELD_HPP__