AlpacaLibrary/Include/Game/Tools/Widgets.hpp

82 lines
2.8 KiB
C++
Raw Normal View History

2017-12-25 23:49:48 +00:00
#ifndef WIDGETS_HPP_INCLUDED
#define WIDGETS_HPP_INCLUDED
#include "../../Core/Types/Box.hpp"
#include "../../Core/Classes/Widget.hpp"
#include <functional>
#include <cstdint>
#include <vector>
/** @addtogroup Tools
* @{ */
class Widgets
{
public:
/**
* @brief Returns true if the Widget, or it's Parent, is Hidden
* @code
* Widget Inventory = Widgets::GetWidget(149, 0);
* bool InventoryHidden = Widgets::IsHidden(Inventory);
* @endcode
*/
static bool IsHidden(Widget W);
/**
* @brief Returns the Box of the passed Widget
* @code
* Widget BankInventory = Widgets::GetWidget(15, 3);
* Box BankInventoryBox = Widgets::GetBox(BankInventory);
* @endcode
*/
static Box GetBox(Widget W);
/**
* @brief Returns the absolute X of the passed Widget
* @code
* Widget BankInventory = Widgets::GetWidget(15, 3);
* std::int32_t BankInventoryX = Widgets::GetX(BankInventory);
* @endcode
*/
static std::int32_t GetX(Widget W);
/**
* @brief Returns the absolute Y of the passed Widget
* @code
* Widget BankInventory = Widgets::GetWidget(15, 3);
* std::int32_t BankInventoryY = Widgets::GetX(BankInventory);
* @endcode
*/
static std::int32_t GetY(Widget W);
/**
* @brief Returns a vector of All Loaded Widgets
* @code std::vector<Widget> Widgets = Widgets::GetAll(); @endcode
*/
static std::vector<Widget> GetAll();
/**
* @brief Returns the specified Widget by Parent ID
* @code Widget BankParent = Widgets::Get(15); @endcode
*/
static Widget Get(std::int32_t Parent);
/**
* @brief Returns the specified Widget by Parent, and Child ID
* @code Widget BankInventory = Widgets::Get(15, 3); @endcode
*/
static Widget Get(std::int32_t Parent, std::int32_t Child);
/**
* @brief Returns the specified Widget by Parent, and Child, and Grandchild ID
* @code Widget BankCloseButton = Widgets::Get(12, 3, 11); @endcode
*/
static Widget Get(std::int32_t Parent, std::int32_t Child, std::int32_t Grandchild);
/**
* @brief Returns a vector of all Widgets that pass the specified Filter @see LibraryFilterLambdas
* @code
* auto const WTextEquals = [](const Widget& W){ return W.GetText() == "Enter Amount"; };
* std::vector<Widget> Widgets = Widgets::Get(WTextEquals); @endcode
* Will return all Widgets whose Text equals Enter Amount
*/
static std::vector<Widget> Get(const std::function<bool (Widget&)>& Filter);
};
/** @} */
#endif // WIDGETS_HPP_INCLUDED