[Tickit-dev] Window->print span objects
Paul LeoNerd Evans
leonerd at leonerd.org.uk
Fri Oct 12 18:31:58 BST 2012
Hi all,
A while since I last wrote. Thought I'd throw together a quick note with
an idea I've had.
I've been trying to work out ways to make better mouse/keyboard/area
interaction with widgets. One thing I've been thinking on is using the
render method to somehow remember where parts of the widget actually are
onscreen, so that mouse/etc.. events can be associated with them. For
example, the Tickit::Widget::Tabbed::Ribbon when it prints the list of
tab names could do with remembering what is where, so it can easily
handle click events.
Last update of Tickit created
http://search.cpan.org/~pevans/Tickit-0.21/lib/Tickit/Window.pm#$pos_=_$win->print(_$text,_$pen_)
to return a Tickit::StringPos object, so the caller can know the width
of text that was printed.
I'm wondering on having it return something fancier; a span object that
knows not only its size but also its position, and somehow persists if
it is stored somewhere(?), and could have a mouse event handler, or
other things, associated with it.
It would need to be mergeable though, so that multiple adjacent calls
would be combined.
my $span = $win->print( "[" ) +
$win->print( $name, $different_pen ) +
$win->print( "]" );
$span->set_on_mouse( sub { ... } );
Or perhaps, if that was deemed a bit expensive or not right, a window
could maintain a context;
$win->start_span;
$win->print( "[" );
$win->print( $name, $different_pen );
$win->print( "]" );
my $span = $win->end_span;
$span->...
--
Paul "LeoNerd" Evans
leonerd at leonerd.org.uk
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mail.leonerd.org.uk/pipermail/tickit-dev/attachments/20121012/ad0fdc51/attachment.sig>
More information about the Tickit-dev
mailing list