GUI Design Question (Seeking an opinion)
In my spare time I've been constructing a cross platform API in my basement. Not that I expect anyone to use it, there's certainly better options available, its just been a heck of a challenge and forced me to learn many things I may not have looked into otherwise.
Anyway, I'm to the point where I'm building GUI controls. The basic label/static controls, buttons, text boxes, etc. I'm torn on how the event callbacks should work and how to set the control properties.
Since all of my controls will be class based I can use virtual functions to give the events to the users. However, that means all events need individual functions. Sometimes thats a bit of a pain and using a single callback function would be nicer.
So if you were dealing with a GUI API what would you rather deal with? Essentially C callback functions which can be used for one or more events, or virtual functions that would deal with a single event.
I suppose I could permit both, but how do you determine which one the user wants to use? Particularly if the user attempts to set both.
The next question I had was how to handle the properties for all the windows and controls. I liked the VB style where you just set a value and that was it. Obviously you can't do that in C, so whats the next best choice?
I had though about using a generic SetProperty() function that accepted a property name and a variant style value to set the property. The problem I have with that is getting properties that use multiple values. Like the position has an X and Y value/coordinate; and background or foreground colors have three values the red, blue, and green components. The only way to do that would be to have specific function calls for those particular properties.
I don't much like the look of the extra overhead in supporting both methods of setting the properties. Particularly if most people would use one type almost exclusively, so once again were you dealing with a GUI API which would rather use?
Thanks in advance for any thoughts on these.