mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
code review
This commit is contained in:
parent
4528f42cdf
commit
aeb559efb8
@ -21,14 +21,14 @@
|
||||
|
||||
#include "../../lib/CGeneralTextHandler.h"
|
||||
|
||||
RadialMenuItem::RadialMenuItem(const std::string & imageName, const std::string & hoverText, const std::function<void()> & callback, bool altLayout)
|
||||
RadialMenuItem::RadialMenuItem(const std::string & imageName, const std::string & hoverText, const std::function<void()> & callback, bool alternativeLayout)
|
||||
: callback(callback)
|
||||
, hoverText(hoverText)
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
|
||||
inactiveImage = std::make_shared<CPicture>(ImagePath::builtin(altLayout ? "radialMenu/itemInactiveAlt" : "radialMenu/itemInactive"), Point(0, 0));
|
||||
selectedImage = std::make_shared<CPicture>(ImagePath::builtin(altLayout ? "radialMenu/itemEmptyAlt" : "radialMenu/itemEmpty"), Point(0, 0));
|
||||
inactiveImage = std::make_shared<CPicture>(ImagePath::builtin(alternativeLayout ? "radialMenu/itemInactiveAlt" : "radialMenu/itemInactive"), Point(0, 0));
|
||||
selectedImage = std::make_shared<CPicture>(ImagePath::builtin(alternativeLayout ? "radialMenu/itemEmptyAlt" : "radialMenu/itemEmpty"), Point(0, 0));
|
||||
|
||||
iconImage = std::make_shared<CPicture>(ImagePath::builtin("radialMenu/" + imageName), Point(0, 0));
|
||||
|
||||
@ -42,13 +42,13 @@ void RadialMenuItem::setSelected(bool selected)
|
||||
inactiveImage->setEnabled(!selected);
|
||||
}
|
||||
|
||||
RadialMenu::RadialMenu(const Point & positionToCenter, const std::vector<RadialMenuConfig> & menuConfig, bool altLayout):
|
||||
centerPosition(positionToCenter), altLayout(altLayout)
|
||||
RadialMenu::RadialMenu(const Point & positionToCenter, const std::vector<RadialMenuConfig> & menuConfig, bool alternativeLayout):
|
||||
centerPosition(positionToCenter), alternativeLayout(alternativeLayout)
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
pos += positionToCenter;
|
||||
|
||||
Point itemSize = altLayout ? Point(80, 70) : Point(70, 80);
|
||||
Point itemSize = alternativeLayout ? Point(80, 70) : Point(70, 80);
|
||||
moveBy(-itemSize / 2);
|
||||
pos.w = itemSize.x;
|
||||
pos.h = itemSize.y;
|
||||
@ -72,7 +72,7 @@ void RadialMenu::addItem(const Point & offset, bool enabled, const std::string &
|
||||
if (!enabled)
|
||||
return;
|
||||
|
||||
auto item = std::make_shared<RadialMenuItem>(path, CGI->generaltexth->translate(hoverText), callback, altLayout);
|
||||
auto item = std::make_shared<RadialMenuItem>(path, CGI->generaltexth->translate(hoverText), callback, alternativeLayout);
|
||||
|
||||
item->moveBy(offset);
|
||||
|
||||
|
@ -51,7 +51,7 @@ class RadialMenuItem : public CIntObject
|
||||
std::string hoverText;
|
||||
|
||||
public:
|
||||
RadialMenuItem(const std::string & imageName, const std::string & hoverText, const std::function<void()> & callback, bool altLayout);
|
||||
RadialMenuItem(const std::string & imageName, const std::string & hoverText, const std::function<void()> & callback, bool alternativeLayout);
|
||||
|
||||
void setSelected(bool selected);
|
||||
};
|
||||
@ -68,9 +68,9 @@ class RadialMenu : public CIntObject
|
||||
|
||||
std::shared_ptr<RadialMenuItem> findNearestItem(const Point & cursorPosition) const;
|
||||
|
||||
bool altLayout;
|
||||
bool alternativeLayout;
|
||||
public:
|
||||
RadialMenu(const Point & positionToCenter, const std::vector<RadialMenuConfig> & menuConfig, bool altLayout = false);
|
||||
RadialMenu(const Point & positionToCenter, const std::vector<RadialMenuConfig> & menuConfig, bool alternativeLayout = false);
|
||||
|
||||
void gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance) override;
|
||||
void gesture(bool on, const Point & initialPosition, const Point & finalPosition) override;
|
||||
|
Loading…
Reference in New Issue
Block a user