Monday, August 30, 2010

gnocl::pointer etc...

With the half an hour dedicated to Gnocl today I've completed the code to get a pixbuf of the pointer. Here's the test code...

set pb1 [gnocl::pixBuf get pointer $win1]

I've gathered the necessary lib funcs together to implement the pointer set command now. The syntax for this will look something along the lines of:

gnocl::pointer set -widget $but1 -image "%/qwerty.png"

Those users who browse the source code might note that there is an undocumented -cursor option for the gnocl::window widget. The chances are that no one has spotted this and built the feature into their scripts. In fact using it as an option at creation is a problem as because the widget is not drawn to screen, it actually has no gdk window assigned to it and will, therefore, throw up an error and terminate the script. It would have made more sense to have cursor sub-command. But, seeing as cursors belong to gdk windows and not gtk windows this is somewhat pointless. In fact, all widgets then should have a -cursor option. So, seeing as this, like -tooltips, would require additions to all widget code, it makes sense to simplify the whole process by adding a single coverall command as shown above.

The '%' prefix does, of course, imply that widgets will be either "#/" (disk images) or "%?" pixbufs. I don't think that stock items would make useful cursors, but, what the heck, I might just add the "%#" option for the fun of it!

No comments: