Changeset View
Changeset View
Standalone View
Standalone View
source/gui/SettingTypes/CGUIHotkey.cpp
- This file was copied from source/gui/ObjectTypes/CImage.h.
Show All 9 Lines | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
* GNU General Public License for more details. | * GNU General Public License for more details. | ||||
* | * | ||||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#ifndef INCLUDED_CIMAGE | #include "precompiled.h" | ||||
#define INCLUDED_CIMAGE | |||||
#include "CGUIHotkey.h" | |||||
#include "gui/CGUISprite.h" | |||||
#include "gui/ObjectBases/IGUIObject.h" | #include "gui/ObjectBases/IGUIObject.h" | ||||
#include "scriptinterface/ScriptInterface.h" | |||||
/** | bool CGUIHotkey::DoFromString(const CStrW& value) | ||||
* Object just for drawing a sprite. Like CText, without the | |||||
* possibility to draw text. | |||||
* | |||||
* Created, because I've seen the user being indecisive about | |||||
* what control to use in these situations. I've seen button | |||||
* without functionality used, and that is a lot of unnecessary | |||||
* overhead. That's why I thought I'd go with an intuitive | |||||
* control. | |||||
*/ | |||||
class CImage : public IGUIObject | |||||
{ | { | ||||
GUI_OBJECT(CImage) | m_pObject.GetGUI().UnsetObjectHotkey(&m_pObject, m_Setting); | ||||
m_Setting = value.ToUTF8(); | |||||
m_pObject.GetGUI().SetObjectHotkey(&m_pObject, m_Setting); | |||||
return true; | |||||
} | |||||
public: | bool CGUIHotkey::DoFromJSVal(const ScriptRequest& rq, JS::HandleValue value) | ||||
CImage(CGUI& pGUI); | { | ||||
virtual ~CImage(); | m_pObject.GetGUI().UnsetObjectHotkey(&m_pObject, m_Setting); | ||||
if (!ScriptInterface::FromJSVal(rq, value, m_Setting)) | |||||
protected: | return false; | ||||
/** | m_pObject.GetGUI().SetObjectHotkey(&m_pObject, m_Setting); | ||||
* Draws the Image | return true; | ||||
*/ | } | ||||
virtual void Draw(); | |||||
// Settings | void CGUIHotkey::OnSettingChange(const CStr& setting, bool sendMessage) | ||||
CGUISpriteInstance m_Sprite; | { | ||||
}; | IGUISetting::OnSettingChange(setting, sendMessage); | ||||
} | |||||
#endif // INCLUDED_CIMAGE |
Wildfire Games · Phabricator