I’m pretty new with c++ programming and especially with the JUCE framework.
Everything went pretty smooth and intuitive until concepts such as virtual functions, listeners and all that interaction between classes came along, and I now I’m highly confused.
I’ll just describe my situation. In my project I made a class named “EventDraw”, inherited from the Component class, and contains a number of ShapeButton objects members. The class is inherited as well from the Button::Listener class, and thus able to respond to each of it’s ShapeButton objects.
Now I made another class inherited from Component named “SequencerDraw” as a parent Component of “EventDraw”. It’s role is to paint a number of "EventDraw"s components on the screen, according to the state of each “EventDraw” component - So basically I need “SequencerDraw” to be able to listen to each “EventDraw” component and react upon it.
I suppose it’s a fairly basic concept, but I wonder what’s the best way to achieve it. should I make a customised Listener for “EventDraw” and how? or should I make “SequencerDraw” listen to Button::Listener as well and receive messages from the buttons within each EventDraw?
I would truly appreciate if anyone would help me with this, and maybe even further with understanding what kind of relationship is necessary for one class to be able to listen to another class.
Thank you very much!