Am 12.02.16 um 01:49 schrieb Mr Flibble:
> How to subscribe to a button press event in my C++ GUI lib, "neogfx":
>
>
> button1.pressed([]() { /* do stuff */ }); // simplicity
>
nice, but still there are three sets of parenthesis that look gibberish.
Compare with Tcl/Tk
button .b1 -command { puts "You pressed me" }
which creates a button and associates the command with it. This is one
of the times where a preprocessor macro wouldn't be too bad.
Unfortunately CPP is a really stupid one.
In fact, a fully functional program in Tcl/Tk is three lines:
package require Tk
button .b -text "Press me" -command { tk_messageBox -message "You
pressed me!" }
pack .b
I have yet to see another GUI library/language that can beat (or come
close to) this conciseness.
>
https://github.com/FlibbleMr/neogfx/
>
Another general comment. It is impressive what you have achieved so far.
I don't wnt to discourage you, but for a full fledged cross-platform
widget set which I would consider in a GUI project, there is still a
long way to go. One thing is platform integration. You seem to draw the
widget elements completely on your own using OpenGL. This works now, but
soon your widgets will look old-fashioned, because the design of
computer interfaces follows fashion. Just run anything from before Win7
and you'll immediately understand. For this reason, the established
widget sets use the native widgets under Windows and Mac OSX. Of course
this requires many compromises, because not every option is supported
everywhere and a big pile of work is required to achieve a common API
for all supported systems. There is a somewhat intermediate solution by
drawing your own widgets, but calling APIs which darw parts of teh
native elements upon request. QT works this way, for instance, and ttk
(the themable version of Tk).
On Linux (or X11) it is even worse, there is no native widget set
available. You'll have to constantly rewrite your library in order not
to fall out of fashion, though the fashion is not so strong as on the
other OSes. on OSX, in particular, if it doesn't look native (read: like
any recent app from Apple) noone will buy it.
That's just my 2 sausages.
Christian