I've tackled this topic maybe a dozen of times, but each time I write a GUI library, at some point I look at it and see that it's badly designed (from a programmers point of view). I've looked through many other API's, studied the implementations, however, I keep designing little things wrong, and end up doing significant rewrites.

Are there any sites, articles or books about how to design a programmer API for a GUI library? Or maybe someone could share some tips from his experience?

  • \$\begingroup\$ Good luck I've found tidbits scattered about in books but never anything comprehensive. \$\endgroup\$ – ClassicThunder Feb 1 '12 at 1:58
  • \$\begingroup\$ Why not try to copy one exactly? \$\endgroup\$ – notlesh Feb 1 '12 at 2:25
  • \$\begingroup\$ @stephelton - well apart from the obvious licencing stuff, there's also the fact that my needs are... specific to say the least. For example the same root UI classes need to support a ASCII version and GL version :P \$\endgroup\$ – Kornel Kisielewicz Feb 1 '12 at 2:32
  • \$\begingroup\$ @KornelKisielewicz: What do you mean by an "ASCII version"? Do you mean text art? In any case, CeGUI already shows how to divorce the rendering aspect of a GUI from the GUI management code, so you don't have to have different root UI classes for different rendering styles. \$\endgroup\$ – Nicol Bolas Feb 1 '12 at 3:42
  • \$\begingroup\$ @Nicol, sure it does. However, it does not divorce positioning and layout, and I need to handle positioning/layout differently depending on the output. So I can't say that no matter what this rectangle is (1,1,300,400) because in a typical 80x25 text mode that is ridiculous. Neither can I operate on percentages, because I have no guarantee that the given 20% will give me at least two lines of text output. \$\endgroup\$ – Kornel Kisielewicz Feb 1 '12 at 3:48

Browse other questions tagged or ask your own question.