man Gtk2::Ex::PathBar () - A button path bar widget

NAME

Gtk2::Ex::PathBar - A button path bar widget

SYNOPSIS

        use Gtk2;
        use Gtk2::Ex::PathBar;
        use File::Spec;

        my $pathbar = Gtk2::Ex::PathBar->new(spacing => 3);
        $pathbar->show;

        # show a path
        my $name = '/foo/bar/baz';
        my ($vol, $dir, $file) = File::Spec->splitpath($name);
        my @path = (($vol || '/'), File::Spec->splitdir($dir), $file);
        $pathbar->set_path(grep length($_), @path);
        $pathbar->signal_connect(path_clicked => \&load_dir);

        # or show a history
        my @hist = qw(/foo/bar /tmp/baz /home/pardus);
        $pathbar->set_path(map [basename($_), $_], @hist);
        $pathbar->signal_connect(path_clicked => \&load_dir);

        sub load_dir {
                my ($button, @path) = @_;
                # ...
        }

DESCRIPTION

This widget is intended as a look-a-like for the button path bar used in the gtk file dialog. Each part of the path is represented by a button. If the button row gets to long sliders are shown left and right to scroll the bar.

It can be used to display a path to a file or directory or to display similar data like a history (trace) or a namespace.

HIERARCHY

  Glib::Object
  +----Gtk2::Object
        +----Gtk2::Widget
              +----Gtk2::Container
                   +----Gtk2::Box
                        +----Gtk2::Ex::PathBar

METHODS

Simple constructor, takes pairs of properties. Start continuous scrolling. DIRECTION can be either 'left' or 'right'. Stop continuous scrolling. By default the sliders are made insensitive if you are displaying multiple items but you scrolled to one end of the list. After setting this method sliders are hidden instead of showing insensitive. Scrolls the path bar one or more items to the left. Scrolls the path bar one or more items to the right. This method fills the path bar with a button for each part of the path. When one of theses buttons is clicked the 'path_clicked' signal is emitted with as argument an array reference holding the path elements to that button. You can also use array references instead of strings for the parts of the path. In this case the first element of these arrays is the string to display on the button. All other parts of the array are passed as a array reference to the 'path_clicked' signal. This can be used if the data you want to display is not really a path. Low level method used by CWset_path() to fill the path bar with buttons. You can use this method to fill the path bar with your own buttons or other widgets. Of course widgets added with this method will not automaticly trigger the CWpath_clicked signal. Returns a list of widgets coresponding to the items in the path bar. Notice that this differs from CWget_children() which will also give you the widgets for the sliders. Removes all buttons from the path bar. Selects the button associated with path part number INDEX in the array given to CWset_path() or CWset_items(). This will have the same visual effect as when the user clicked the button in question. If you used CWset_items() to add your own widgets you can also use an object ref instead of INDEX here.

SIGNALS

Emitted when one of the buttons in the path is clicked. PATH is an array reference containing the path coresponding to the button clicked. INDEX is the list index of the button in the path.

AUTHOR

Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>

Copyright (c) 2005 Jaap G Karssenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.