In my C++ program here, I have created an image button control that has an image button and hit testing function to figure out if a mouse clicked inside the video.
class ImageButton{
public:
ImageButton(int xPos, int yPos, int width, int height);
virtual void onMousePress(); //triggered internally if the mouse clicked inside the button
virtual void onMousePressOutside() //triggered internally if the mouse clicked outside the button
private:
bool hitTest(int, int); //check if is in bounds
};
Now, there's another where I have to utilitise this ImageButton
control. Since, I come from C#, I remember using the controls very easily and subscribing to their events like
btnControl.Click += new MouseClickEventHandler(Sender e, EVentArgs e)
I have just started using the Poco
library to get similar functionlaities of event subscribing here in C++ but wanted to ask how can I create such an event that can be subscribed in my second class and onMousePress
of the ImageButton
triggers the subscribed function in this second class?