1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
This commit is contained in:
Laserlicht 2024-07-17 01:02:11 +02:00
parent 0a98169bcf
commit d23d4b32c7
2 changed files with 1 additions and 23 deletions

View File

@ -72,16 +72,6 @@ void CButton::addPopupCallback(const std::function<void()> & callback)
this->callbackPopup += callback;
}
void CButton::addHoverCallback(const std::function<void(bool)> & callback)
{
this->hoverCallback += callback;
}
void CButton::addPanningCallback(const std::function<void(const Point &, const Point &, const Point &)> & callback)
{
this->panningCallback += callback;
}
void ButtonBase::setTextOverlay(const std::string & Text, EFonts font, ColorRGBA color)
{
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
@ -312,8 +302,6 @@ void CButton::showPopupWindow(const Point & cursorPosition)
void CButton::hover (bool on)
{
hoverCallback(on);
if(hoverable && !isBlocked())
{
if(on)
@ -338,11 +326,6 @@ void CButton::hover (bool on)
}
}
void CButton::gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance)
{
panningCallback(initialPosition, currentPosition, lastUpdateDistance);
}
ButtonBase::ButtonBase(Point position, const AnimationPath & defName, EShortcut key, bool playerColoredButton)
: CKeyShortcut(key)
, stateToIndex({0, 1, 2, 3})
@ -375,7 +358,7 @@ CButton::CButton(Point position, const AnimationPath &defName, const std::pair<s
soundDisabled(false)
{
defActions = 255-DISPOSE;
addUsedEvents(LCLICK | SHOW_POPUP | HOVER | KEYBOARD | GESTURE);
addUsedEvents(LCLICK | SHOW_POPUP | HOVER | KEYBOARD);
hoverTexts[0] = help.first;
}

View File

@ -70,8 +70,6 @@ class CButton : public ButtonBase
{
CFunctionList<void()> callback;
CFunctionList<void()> callbackPopup;
CFunctionList<void(bool)> hoverCallback;
CFunctionList<void(const Point &, const Point &, const Point &)> panningCallback;
std::array<std::string, 4> hoverTexts; //texts for statusbar, if empty - first entry will be used
std::optional<ColorRGBA> borderColor; // mapping of button state to border color
@ -94,8 +92,6 @@ public:
/// adds one more callback to on-click actions
void addCallback(const std::function<void()> & callback);
void addPopupCallback(const std::function<void()> & callback);
void addHoverCallback(const std::function<void(bool)> & callback);
void addPanningCallback(const std::function<void(const Point &, const Point &, const Point &)> & callback);
void addHoverText(EButtonState state, const std::string & text);
@ -120,7 +116,6 @@ public:
void clickReleased(const Point & cursorPosition) override;
void clickCancel(const Point & cursorPosition) override;
void hover (bool on) override;
void gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance) override;
void showAll(Canvas & to) override;
/// generates tooltip that can be passed into constructor