@ -53,7 +53,7 @@ enum class ComponentAttr{
BACKGROUND = 0 b1000 , //Renders the background of the menu theme for this component.
} ;
class MenuComponent : IAttributable {
class MenuComponent : public IAttributable {
friend class Menu ;
friend class MenuItemButton ;
friend class ScrollableWindowComponent ;
@ -63,6 +63,12 @@ class MenuComponent:IAttributable{
private :
virtual bool GetHoverState ( Crawler * game ) ;
std : : pair < MenuType , std : : string > memoryLeakInfo ; //Used to identify memory leak hints for this component.
virtual void BeforeUpdate ( Crawler * game ) ;
void _Update ( Crawler * game ) ;
void _Draw ( Crawler * game ) ;
void _Draw ( Crawler * game , vf2d parentPos ) ;
void _DrawDecal ( Crawler * game , bool focused ) ;
void _DrawDecal ( Crawler * game , vf2d parentPos , bool focused ) ;
protected :
float hoverEffect = 0 ;
std : : string name = " " ;
@ -73,8 +79,6 @@ protected:
bool background = true ;
bool showDefaultLabel = true ;
MenuFunc onClick ;
MenuType parentMenu = MenuType : : ENUM_END ;
MenuComponent * parentComponent = nullptr ;
bool hovered = false ;
bool selectable = true ;
bool selectableViaKeyboard = true ;
@ -89,14 +93,11 @@ protected:
//CALL THIS FOR A PARENT to check a child's DrawDecal validity!
virtual bool PointWithinParent ( MenuComponent * child , vi2d drawPos ) ;
public :
MenuType parentMenu = MenuType : : ENUM_END ;
MenuComponent * parentComponent = nullptr ;
MenuComponent ( MenuType parent , geom2d : : rect < float > rect , std : : string label , MenuFunc onClick , ButtonAttr attributes = ButtonAttr : : NONE ) ;
MenuComponent ( MenuType parent , geom2d : : rect < float > rect , std : : string label , MenuType menuDest , MenuFunc onClick , ButtonAttr attributes = ButtonAttr : : NONE ) ;
virtual ~ MenuComponent ( ) ;
void _Update ( Crawler * game ) ;
void _Draw ( Crawler * game ) ;
void _Draw ( Crawler * game , vf2d parentPos ) ;
void _DrawDecal ( Crawler * game , bool focused ) ;
void _DrawDecal ( Crawler * game , vf2d parentPos , bool focused ) ;
vf2d GetPos ( ) ;
//We picked up a draggable component, we should make a copy and return it here. If a nullptr is returned here, the pickup is not allowed.
//WARNING!!! This allocates a brand new component when successful!!! Be prepared to clear it!