The Character struct will be extended by two fields:
Control - the top level IControl that produced this character
Position - a local position of the Control from which the character was produced
Some interactive controls (like a Button) will be able to override the Control and Position fields of characters they are passing through
The ConsoleManager will be extended with a method that returns a Control and Position values of a specific "pixel".
A new IMouseListener interface will be added (the list of methods to be decided, but probably OnMuseDown(Position local), OnMouseMove(Position local), OnMoseUp(Position local))
Whenever an external library detects a mouse input, the user should get the Control and its local Position at the specified global position, check if that control is in fact an instance of the IMouseListener, and call the proper callback.
The rest is up to the internal implementation of the control
That should keep the interface simple and make it possible to hook up the mouse using one of the already existing projects.
So I've spent some time thinking about how may I implement the mouse support for this library and this it the proposal:
Character
struct will be extended by two fields:Control
- the top levelIControl
that produced this characterPosition
- a local position of theControl
from which the character was producedButton
) will be able to override theControl
andPosition
fields of characters they are passing throughConsoleManager
will be extended with a method that returns aControl
andPosition
values of a specific "pixel".IMouseListener
interface will be added (the list of methods to be decided, but probablyOnMuseDown(Position local)
,OnMouseMove(Position local)
,OnMoseUp(Position local)
)Control
and its localPosition
at the specified global position, check if that control is in fact an instance of the IMouseListener, and call the proper callback.That should keep the interface simple and make it possible to hook up the mouse using one of the already existing projects.