|
|
|
@ -50,18 +50,18 @@ INCLUDE_ITEM_DATA |
|
|
|
|
|
|
|
|
|
class MenuItemItemButton:public MenuIconButton{ |
|
|
|
|
private: |
|
|
|
|
std::reference_wrapper<Item>itemRef; |
|
|
|
|
std::reference_wrapper<const Item>itemRef; |
|
|
|
|
std::string itemNameLabelName; |
|
|
|
|
std::string itemDescriptionLabelName; |
|
|
|
|
bool hideQty=false; |
|
|
|
|
CompactText compact=COMPACT; |
|
|
|
|
public: |
|
|
|
|
inline MenuItemItemButton(geom2d::rect<float>rect,Item&itemRef,MenuType menuDest,MenuFunc onClick,std::string itemNameLabelName,std::string itemDescriptionLabelName,IconButtonAttr attributes=IconButtonAttr::SELECTABLE) |
|
|
|
|
inline MenuItemItemButton(geom2d::rect<float>rect,const Item&itemRef,MenuType menuDest,MenuFunc onClick,std::string itemNameLabelName,std::string itemDescriptionLabelName,IconButtonAttr attributes=IconButtonAttr::SELECTABLE) |
|
|
|
|
:MenuIconButton(rect,(!itemRef.IsBlank())?const_cast<Decal*>(itemRef.Decal()):nullptr,menuDest,onClick,attributes),itemRef(itemRef),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){ |
|
|
|
|
draggable=false; |
|
|
|
|
valid=!itemRef.IsBlank(); |
|
|
|
|
} |
|
|
|
|
inline MenuItemItemButton(geom2d::rect<float>rect,Item&itemRef,MenuType menuDest,MenuFunc onClick,MenuFunc onHover,MenuFunc onMouseOut,std::string itemNameLabelName="",std::string itemDescriptionLabelName="",IconButtonAttr attributes=IconButtonAttr::SELECTABLE) |
|
|
|
|
inline MenuItemItemButton(geom2d::rect<float>rect,const Item&itemRef,MenuType menuDest,MenuFunc onClick,MenuFunc onHover,MenuFunc onMouseOut,std::string itemNameLabelName="",std::string itemDescriptionLabelName="",IconButtonAttr attributes=IconButtonAttr::SELECTABLE) |
|
|
|
|
:MenuIconButton(rect,(!itemRef.IsBlank())?const_cast<Decal*>(itemRef.Decal()):nullptr,menuDest,onClick,attributes),itemRef(itemRef),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){ |
|
|
|
|
runHoverFunctions=true; |
|
|
|
|
draggable=false; |
|
|
|
@ -69,11 +69,11 @@ public: |
|
|
|
|
SetHoverFunc(onHover); |
|
|
|
|
SetMouseOutFunc(onMouseOut); |
|
|
|
|
} |
|
|
|
|
inline Item&GetItem(){ |
|
|
|
|
inline const Item&GetItem(){ |
|
|
|
|
return itemRef.get(); |
|
|
|
|
} |
|
|
|
|
inline Item&SetItem(Item&newItem){ |
|
|
|
|
return itemRef=std::reference_wrapper<Item>(newItem); |
|
|
|
|
inline const Item&SetItem(const Item&newItem){ |
|
|
|
|
return itemRef=std::reference_wrapper<const Item>(newItem); |
|
|
|
|
} |
|
|
|
|
inline void SetShowQuantity(bool show){ |
|
|
|
|
this->hideQty=!show; |
|
|
|
|