I have an interface that holds the methods needed to invoke the events and the events itself. Is this how you generally use events?
interface MouseInput
{
void HandleMousePressed(object sender, MouseButtonEventArgs e);
void HandleMouseReleased(object sender, MouseButtonEventArgs e);
void HandleMouseMoved(object sender, MouseMoveEventArgs e);
event EventHandler OnPressed;
event EventHandler OnReleased;
event EventHandler OnHoveredEntered;
event EventHandler OnHoveredExit;
}
I then have a button class which derives from MouseInput.
Button.cs:
http://pastebin.com/QnyqxwPSIt works with no [known] bugs but it forces you to rewrite a lot of code like how the events are called. This gives flexibility on how you can use the interface but most classes deriving from the interface will want the same behavior (that I wrote in the Button class). And I really don't want to make the interface a class - most classes that would use this functionality will already being deriving from another class (like an Entity class) and I can't derive from more than two classes.