mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-13 11:40:38 +02:00
Wipe unused ClickableArea
This commit is contained in:
parent
2b916189f6
commit
f11c54b5e9
@ -24,39 +24,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ClickableArea::ClickableArea(CIntObject * object, CFunctionList<void()> callback):
|
|
||||||
callback(callback),
|
|
||||||
area(nullptr)
|
|
||||||
{
|
|
||||||
if (object)
|
|
||||||
pos = object->pos;
|
|
||||||
setArea(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClickableArea::addCallback(std::function<void()> callback)
|
|
||||||
{
|
|
||||||
this->callback += callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClickableArea::setArea(CIntObject * object)
|
|
||||||
{
|
|
||||||
delete area;
|
|
||||||
area = object;
|
|
||||||
addChild(area);
|
|
||||||
pos.w = object->pos.w;
|
|
||||||
pos.h = object->pos.h;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClickableArea::onClick()
|
|
||||||
{
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClickableArea::clickLeft(tribool down, bool previousState)
|
|
||||||
{
|
|
||||||
if (down)
|
|
||||||
onClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CButton::update()
|
void CButton::update()
|
||||||
{
|
{
|
||||||
|
@ -26,24 +26,6 @@ namespace config
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ClickableArea : public CIntObject //TODO: derive from LRCLickableArea? Or somehow use its right-click/hover data?
|
|
||||||
{
|
|
||||||
CFunctionList<void()> callback;
|
|
||||||
|
|
||||||
CIntObject * area;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void onClick();
|
|
||||||
|
|
||||||
public:
|
|
||||||
ClickableArea(CIntObject * object, CFunctionList<void()> callback);
|
|
||||||
|
|
||||||
void addCallback(std::function<void()> callback);
|
|
||||||
void setArea(CIntObject * object);
|
|
||||||
|
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Typical Heroes 3 button which can be inactive or active and can
|
/// Typical Heroes 3 button which can be inactive or active and can
|
||||||
/// hold further information if you right-click it
|
/// hold further information if you right-click it
|
||||||
class CButton : public CKeyShortcut
|
class CButton : public CKeyShortcut
|
||||||
@ -151,13 +133,6 @@ public:
|
|||||||
void addCallback(std::function<void(bool)> callback);
|
void addCallback(std::function<void(bool)> callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClickableToggle : public ClickableArea, public CToggleBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ClickableToggle(CIntObject * object, CFunctionList<void()> selectFun, CFunctionList<void()> deselectFun);
|
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// A button which can be selected/deselected, checkbox
|
/// A button which can be selected/deselected, checkbox
|
||||||
class CToggleButton : public CButton, public CToggleBase
|
class CToggleButton : public CButton, public CToggleBase
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user