|
@@ -67,6 +67,16 @@ void CButton::addCallback(const std::function<void()> & callback)
|
|
|
this->callback += callback;
|
|
this->callback += 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)
|
|
void ButtonBase::setTextOverlay(const std::string & Text, EFonts font, ColorRGBA color)
|
|
|
{
|
|
{
|
|
|
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
|
|
OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(255-DISPOSE);
|
|
@@ -295,6 +305,8 @@ void CButton::showPopupWindow(const Point & cursorPosition)
|
|
|
|
|
|
|
|
void CButton::hover (bool on)
|
|
void CButton::hover (bool on)
|
|
|
{
|
|
{
|
|
|
|
|
+ hoverCallback(on);
|
|
|
|
|
+
|
|
|
if(hoverable && !isBlocked())
|
|
if(hoverable && !isBlocked())
|
|
|
{
|
|
{
|
|
|
if(on)
|
|
if(on)
|
|
@@ -319,6 +331,11 @@ 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)
|
|
ButtonBase::ButtonBase(Point position, const AnimationPath & defName, EShortcut key, bool playerColoredButton)
|
|
|
: CKeyShortcut(key)
|
|
: CKeyShortcut(key)
|
|
|
, stateToIndex({0, 1, 2, 3})
|
|
, stateToIndex({0, 1, 2, 3})
|
|
@@ -351,7 +368,7 @@ CButton::CButton(Point position, const AnimationPath &defName, const std::pair<s
|
|
|
soundDisabled(false)
|
|
soundDisabled(false)
|
|
|
{
|
|
{
|
|
|
defActions = 255-DISPOSE;
|
|
defActions = 255-DISPOSE;
|
|
|
- addUsedEvents(LCLICK | SHOW_POPUP | HOVER | KEYBOARD);
|
|
|
|
|
|
|
+ addUsedEvents(LCLICK | SHOW_POPUP | HOVER | KEYBOARD | GESTURE);
|
|
|
hoverTexts[0] = help.first;
|
|
hoverTexts[0] = help.first;
|
|
|
}
|
|
}
|
|
|
|
|
|