AlpacaLibrary/Include/Game/Tools/Widgets.hpp

88 lines
3.1 KiB
C++

#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(const Internal::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(const Internal::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(const Internal::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(const Internal::Widget& W);
/**
* @brief (Temp) Returns the ItemIDs of the passed Widget
* @note Temporary function, this should be used over Widget.GetItemIDs()
*/
static std::vector<std::int32_t> GetItemIDs(const Internal::Widget& W);
/**
* @brief Returns a vector of All Loaded Widgets
* @code std::vector<Widget> Widgets = Widgets::GetAll(); @endcode
*/
static std::vector<Internal::Widget> GetAll();
/**
* @brief Returns the specified Widget by Parent ID
* @code Widget BankParent = Widgets::Get(15); @endcode
*/
static Internal::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 Internal::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 Internal::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<Internal::Widget> Get(const std::function<bool (Internal::Widget&)>& Filter);
};
/** @} */
#endif // WIDGETS_HPP_INCLUDED