AppItem.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef FREESHOP_GUI_APPITEM_HPP
  2. #define FREESHOP_GUI_APPITEM_HPP
  3. #include <memory>
  4. #include "../TweenObjects.hpp"
  5. #include "../AppItem.hpp"
  6. #include "NinePatch.hpp"
  7. namespace FreeShop {
  8. namespace GUI {
  9. class AppItem : public cpp3ds::Drawable, public util3ds::TweenTransformable<cpp3ds::Transformable> {
  10. public:
  11. static const int INFO_ALPHA = 11;
  12. static const int BACKGROUND_ALPHA = 12;
  13. AppItem();
  14. ~AppItem();
  15. void setAppItem(std::shared_ptr<::FreeShop::AppItem> appItem);
  16. std::shared_ptr<::FreeShop::AppItem> getAppItem() const;
  17. void setSize(float width, float height);
  18. const cpp3ds::Vector2f &getSize() const;
  19. void setVisible(bool visible);
  20. bool isVisible() const;
  21. void setFilteredOut(bool filteredOut);
  22. bool isFilteredOut() const;
  23. void setInfoVisible(bool visible);
  24. bool isInfoVisible() const;
  25. void select();
  26. void deselect();
  27. void setMatchTerm(const std::string &string);
  28. int getMatchScore() const;
  29. protected:
  30. virtual void draw(cpp3ds::RenderTarget &target, cpp3ds::RenderStates states) const;
  31. virtual void setValues(int tweenType, float *newValues);
  32. virtual int getValues(int tweenType, float *returnValues);
  33. void addRegionFlag(::FreeShop::AppItem::Region region);
  34. void setTitle(const cpp3ds::String &title);
  35. void setFilesize(cpp3ds::Uint64 filesize);
  36. private:
  37. std::shared_ptr<::FreeShop::AppItem> m_appItem;
  38. gui3ds::NinePatch m_background;
  39. cpp3ds::RectangleShape m_icon;
  40. cpp3ds::RectangleShape m_progressBar;
  41. cpp3ds::Text m_titleText;
  42. cpp3ds::Text m_filesizeText;
  43. cpp3ds::Vector2f m_size;
  44. std::vector<cpp3ds::Sprite> m_regionFlags;
  45. int m_matchScore;
  46. bool m_infoVisible;
  47. mutable bool m_visible;
  48. mutable bool m_filteredOut;
  49. };
  50. } // namespace GUI
  51. } // namespace FreeSpace
  52. #endif // FREESHOP_GUI_APPITEM_HPP