UIInventory.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "UIElement.h"
  3. class UIReference;
  4. class UIInventoryElement : public UIElement
  5. {
  6. private:
  7. UIReference* reference;
  8. int rowSize;
  9. int numSlots;
  10. Framework::Text slotNameFilter;
  11. bool hasFilter;
  12. public:
  13. UIInventoryElement();
  14. ~UIInventoryElement();
  15. void setReference(UIReference* reference);
  16. UIReference* zReference() const;
  17. void setRowSize(int rowSize);
  18. int getRowSize() const;
  19. void setNumSlots(int numSlots);
  20. int getNumSlots() const;
  21. void setSlotNameFilter(const Framework::Text& slotNameFilter);
  22. const Framework::Text& getSlotNameFilter() const;
  23. bool hasSlotNameFilter() const;
  24. Framework::XML::Element* toUIML(Framework::Either<Block*, Entity*> zTarget,
  25. Entity* zActor) const override;
  26. };
  27. class UIInventoryElementFactory : public UIElementFactory<UIInventoryElement>
  28. {
  29. public:
  30. UIInventoryElementFactory();
  31. virtual JSONObjectValidationBuilder* addToValidator(
  32. JSONObjectValidationBuilder* builder) const override;
  33. UIInventoryElement* fromJson(
  34. Framework::JSON::JSONObject* zJson) const override;
  35. Framework::JSON::JSONObject* toJsonObject(
  36. UIInventoryElement* zObject) const override;
  37. UIInventoryElement* createElement(
  38. Framework::JSON::JSONObject* zJson) const override;
  39. const char* getTypeToken() const override;
  40. };