AlpacaLibrary/Include/Game/Tools/Widgets.hpp

88 lines
3.2 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
*/
2018-03-18 14:38:29 +00:00
static bool IsHidden(const Internal::Widget& W);
2017-12-25 23:49:48 +00:00
/**
* @brief Returns the Box of the passed Widget
* @code
* Widget BankInventory = Widgets::GetWidget(15, 3);
* Box BankInventoryBox = Widgets::GetBox(BankInventory);
* @endcode
*/
2018-03-18 14:38:29 +00:00
static Box GetBox(const Internal::Widget& W);
2017-12-25 23:49:48 +00:00
/**
* @brief Returns the absolute X of the passed Widget
* @code
* Widget BankInventory = Widgets::GetWidget(15, 3);
* std::int32_t BankInventoryX = Widgets::GetX(BankInventory);
* @endcode
*/
2018-03-18 14:38:29 +00:00
static std::int32_t GetX(const Internal::Widget& W);
2017-12-25 23:49:48 +00:00
/**
* @brief Returns the absolute Y of the passed Widget
* @code
* Widget BankInventory = Widgets::GetWidget(15, 3);
* std::int32_t BankInventoryY = Widgets::GetX(BankInventory);
* @endcode
*/
2018-03-18 14:38:29 +00:00
static std::int32_t GetY(const Internal::Widget& W);
2018-03-09 20:10:43 +00:00
/**
* @brief (Temp) Returns the ItemIDs of the passed Widget
* @note Temporary function, this should be used over Widget.GetItemIDs()
*/
2018-03-18 14:38:29 +00:00
static std::vector<std::int32_t> GetItemIDs(const Internal::Widget& W);
2017-12-25 23:49:48 +00:00
/**
* @brief Returns a vector of All Loaded Widgets
2018-04-16 03:53:24 +00:00
* @code std::vector<std::vector<Internal::Widget>> Widgets = Widgets::GetAll(); @endcode
2017-12-25 23:49:48 +00:00
*/
2018-04-16 03:53:24 +00:00
static std::vector<std::vector<Internal::Widget>> GetAll();
2017-12-25 23:49:48 +00:00
/**
* @brief Returns the specified Widget by Parent ID
2018-04-16 03:53:24 +00:00
* @code std::vector<Internal::Widget> BankParent = Widgets::Get(15); @endcode
2017-12-25 23:49:48 +00:00
*/
2018-04-18 05:50:40 +00:00
static std::vector<Internal::Widget> GetAll(std::int32_t Parent);
2017-12-25 23:49:48 +00:00
/**
* @brief Returns the specified Widget by Parent, and Child ID
* @code Widget BankInventory = Widgets::Get(15, 3); @endcode
*/
2018-04-18 05:50:40 +00:00
static Internal::Widget Get(std::int32_t Parent, std::int32_t Child = -1);
2017-12-25 23:49:48 +00:00
/**
* @brief Returns the specified Widget by Parent, and Child, and Grandchild ID
* @code Widget BankCloseButton = Widgets::Get(12, 3, 11); @endcode
*/
2018-03-18 14:38:29 +00:00
static Internal::Widget Get(std::int32_t Parent, std::int32_t Child, std::int32_t Grandchild);
2017-12-25 23:49:48 +00:00
/**
* @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
*/
2018-04-18 05:50:40 +00:00
static std::vector<Internal::Widget> GetAll(const std::function<bool (Internal::Widget&)>& Filter);
2017-12-25 23:49:48 +00:00
};
/** @} */
#endif // WIDGETS_HPP_INCLUDED