Remove virtual inheritance from the codebase, refs 6b51d71c85, e21ebb37f5 e326ebae46.

Remove workaround in 3d07327837 / D2136, the pointer from IGUIObject to
IGUITextOwner that avoided the dynamic_cast.
Have the GUIObject implementing class take responsibility of calling the
virtual methods in the base classes.
Leaves the code in a clean state that can serve as an example for new
GUI object classes, such as D1346, refs #4683.

Differential Revision: https://code.wildfiregames.com/D2325
Comments By: Vladislav on IRC 2019-07-30, 2019-08-22, 2019-09-20-23
Tested on: clang 8.0.1, Jenkins

This was SVN commit r23020.
This commit is contained in:
elexis
2019-09-30 14:08:14 +00:00
parent 1679510bb8
commit 8190293f8b
31 changed files with 293 additions and 250 deletions
+12 -9
View File
@@ -35,10 +35,12 @@ class CGUISpriteInstance;
* Can be used with multiple inheritance alongside
* IGUISettingsObject and such.
*/
class IGUIButtonBehavior : virtual public IGUIObject
class IGUIButtonBehavior
{
NONCOPYABLE(IGUIButtonBehavior);
public:
IGUIButtonBehavior(CGUI& pGUI);
IGUIButtonBehavior(IGUIObject& pObject);
virtual ~IGUIButtonBehavior();
/**
@@ -61,13 +63,7 @@ protected:
/**
* @see IGUIObject#ResetStates()
*/
virtual void ResetStates()
{
// Notify the gui that we aren't hovered anymore
UpdateMouseOver(nullptr);
m_Pressed = false;
m_PressedRight = false;
}
virtual void ResetStates();
/**
* Everybody knows how a button works, you don't simply press it,
@@ -85,6 +81,13 @@ protected:
CStrW m_SoundLeave;
CStrW m_SoundPressed;
CStrW m_SoundReleased;
private:
/**
* Reference to the IGUIObject.
* Private, because we don't want to inherit it in multiple classes.
*/
IGUIObject& m_pObject;
};
#endif // INCLUDED_IGUIBUTTONBEHAVIOR