Gtk2-Ex-TickerView

 view release on metacpan or  search on metacpan

lib/Gtk2/Ex/TickerView.pm  view on Meta::CPAN

C<Gtk2__Ex__TickerView> and renderers and attributes are added as children
per C<Gtk2::CellLayout>.  Here's a sample, or see F<examples/builder.pl> for
a complete program,

    <object class="Gtk2__Ex__TickerView" id="myticker">
      <property name="model">myliststore</property>
      <child>
        <object class="GtkCellRendererText" id="myrenderer">
          <property name="xpad">10</property>
        </object>
        <attributes>
          <attribute name="text">0</attribute>
        </attributes>
      </child>
    </object>

But see L<Gtk2::Ex::CellLayout::Base/BUILDABLE INTERFACE> for caveats about
widget superclass tags (like the "accessibility" settings) which end up
unavailable (as of Gtk2-Perl 1.222 at least).

=head1 OTHER NOTES

The Gtk reference documentation for C<GtkCellLayout> doesn't really describe
how C<pack_start> and C<pack_end> order the cells, but it's the same as
C<GtkBox> and a description can be found there.  Basically each cell is
noted as "start" or "end", with "starts" drawn from the left and "ends" from
the right (vice versa in RtoL mode).  In a TickerView the ends immediately
follow the starts, there's no gap in between, unlike say in a C<Gtk2::HBox>.
(Which means the "expand" parameter is ignored currently.)  See
F<examples/order.pl> for a demonstration.

When the model has no rows the TickerView's desired height from
C<size_request> is zero.  This is bad if you want a visible but blank area
when there's nothing to display.  But there's no way TickerView can work out
a height when it's got no data at all to set into the renderers.  You can
try calculating a fixed height from a sample model and C<set_size_request>
to force that, or alternately have a "no data" row displaying in the model
instead of letting it go empty, or even switch to a dummy model with a "no
data" row when the real one is empty.

=head2 Drawing

Cells are drawn into an off-screen pixmap which is copied to the window at
successively advancing X positions as the ticker scrolls across.  The aim is
to run the model fetching and cell rendering just once for each row as it
appears on screen.  This is important because the model+renderer mechanism
is generally much too slow and bloated to call at frame-rate times per
second.

The drawing for scroll movement goes through a SyncCall (see
L<Gtk2::Ex::SyncCall>) so that after drawing one frame the next doesn't go
out until hearing back from the server that it finished the previous.  This
ensures a high frame rate doesn't flood the server with more drawing than it
can keep up with, but instead dynamically caps at client+server capability.

Scroll movements are calculated from elapsed time using
C<clock_gettime(CLOCK_REALTIME)> when available or high-res system time
otherwise (see C<Time::HiRes>).  This means the display moves at the
C<speed> setting even if drawing is not keeping up with the requested
C<frame-rate>.  Slow frame rates can occur on the client side if the main
loop is busy doing other things (or momentarily blocked completely), or can
be on the X server side if it's busy with other drawing etc.

=head1 SEE ALSO

L<Gtk2::CellLayout>, L<Gtk2::TreeModel>, L<Gtk2::CellRenderer>,
L<Gtk2::Ex::CellLayout::Base>

=head1 HOME PAGE

L<http://user42.tuxfamily.org/gtk2-ex-tickerview/index.html>

=head1 COPYRIGHT

Copyright 2007, 2008, 2009, 2010, 2011, 2017, 2019 Kevin Ryde

Gtk2-Ex-TickerView is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any later
version.

Gtk2-Ex-TickerView is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
more details.

You should have received a copy of the GNU General Public License along with
Gtk2-Ex-TickerView.  If not, see L<http://www.gnu.org/licenses/>.

=cut



( run in 0.968 second using v1.01-cache-2.11-cpan-39bf76dae61 )