/* * OpenClonk, http://www.openclonk.org * * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/ * Copyright (c) 2009-2016, The OpenClonk Team and contributors * * Distributed under the terms of the ISC license; see accompanying file * "COPYING" for details. * * "Clonk" is a registered trademark of Matthes Bender, used with permission. * See accompanying file "TRADEMARK" for details. * * To redistribute this file separately, substitute the full license texts * for the above references. */ // generic user interface // that which can be pressed #include "C4Include.h" #include "gui/C4Gui.h" #include "gui/C4MouseControl.h" #include "graphics/C4GraphicsResource.h" #include "graphics/C4Draw.h" namespace C4GUI { // -------------------------------------------------- // Button Button::Button(const char *szBtnText, const C4Rect &rtBounds) : Control(rtBounds), pCustomGfx(nullptr), pCustomGfxDown(nullptr), fDown(false), fMouseOver(false), fEnabled(true), dwCustomFontClr(0), pCustomFont(nullptr) { // key callbacks C4CustomKey::CodeList keys; keys.push_back(C4KeyCodeEx(K_SPACE)); keys.push_back(C4KeyCodeEx(K_RETURN)); if (Config.Controls.GamepadGuiControl) ControllerKeys::Ok(keys); pKeyButton = new C4KeyBinding(keys, "GUIButtonPress", KEYSCOPE_Gui, new ControlKeyCB