I'm creating a GUI application using the MVC design pattern in C. It is meant to be a game of connect 4.
I want my controller to be able to send data to the GUI. I have a method in my GUI to draw the starting elements, e.g. the board and buttons to select which column to drop a checker in.
At the end of this method I have to call gtk_main() in order for the GUI to show on screen. I want to be able to send data between the view and controller class, but after calling this method, control is NOT given back to the controller class.
To be clear, the main method is in my controller class, and it calls the 'setup' method in my view class, the gtk_main() call is at the end of the 'setup' method.
How do I resolve this?
Also, for example, I have this method in my view:
void drop_checker(GtkWidget *widget, cairo_t *cr, gint col, gint row, int r, int g, int b)
It is easy to call this using a GTK callback, since I have access to the widget and cr variables, however I don't know how I would call this from my controller class.
Is this an error with how the application is designed or is this a technical misunderstanding?