The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gtk2::PathButtonBar - Creates a bar for path manipulation.

VERSION

Version 0.1.2

SYNOPSIS

This creates a collection of buttons and a entry widget to help with browsing a path or etc.

It is composed of two lines. The first line contains a set of buttons. The first button is a button that blanks the current path. This is the 'goRoot' button and displays what ever the user has decided the root is by setting the 'root' key when invoking the new funtions. The buttons after that are ones that correspond to a chunk of the path, broken up by what ever the delimiter is set to. When any of these are pressed, the entry text is changed as well to relfect it. The 'goRoot' button clears the path to ''.

The second line starts with a label. The label is the same as on the 'goRoot' button and is what ever the root is set as. After that there is a single line text entry widget. This allows the path to be set by typing it in. After the text entry widget, there is a button labeled 'Go'. When this button is pressed, it updates the button bar with what is in text entry widget.

Any time the path is updated, '$self->{exec}' is ran through eval.

    use Gtk2;
    use Gtk2::PathButtonBar;
    
    Gtk2->init;
    
    my $window = Gtk2::Window->new();
    
    my $pbb=Gtk2::PathButtonBar->new({exec=>'print "path=".${$myself}->{path}."\na=".${$myself}->{vars}{a}."\n";',
                                    vars=>{a=>1},
                                    });
    
    print $pbb->{vbox}."\n";
    
    $window->add($pbb->{vbox});
    
    $window->show;

FUNCTIONS

new

This initiates this widget. This takes it's arguements in the form of a hash. The accepted keys can be found below.

delimiter

This is what will be considered a delimiter between directories or whatever. The default is '/'.

exec

This is a string that will be executed any time any change is done. Change the text in the string entry box does not constitute a change till the 'Go' button is pressed.

For example, setting it to the following, would cause it to print the current path followed a new line and then a 'a=' what ever '$self->{vars}{a}' is set to.

    exec=>'print "path=".${$myself}->{path}."\na=".${$myself}->{vars}{a}."\n:;

If you wish to pass any sort of variables to this, it is strongly suggested you do it by using the 'vars' key in the hash passed to the new function.

Upon a failure to execute the code in exec, it will issue a warning.

root

This is what will be displayed as being the root. This wills how up in the 'goRoot' button and in the label before the entry box.

If it is not defined, it defaults to what ever the delimiter is. If the delimiter is not set, that means this will display '/', which works nicely for most unix FS stuff.

path

This is the path that the it will originally be set to.

vars

This is meant to contain variables that will be used with '$self->{exec}'.

go

This is called when a new path is set by pressing the go button.

There is no reason to ever call this from '$self->{exec}'.

goRoot

This is called when a new path is set by pressing the root button.

If you wish to call this from '$self->{exec}', do it as below.

    ${$myself}->goRoot;

makeButtons

This is a internal function that rebuilds the button bar.

If you wish to call this from '$self->{exec}', do it as below.

    ${$myself}->makeButtons;

setPath

This changes the current path.

One arguement is accepted and that is the path.

    $pbb->setPath($somepath);
    if($self->{error}){
        print "Error!\n";
    }

errorblank

This blanks the error storage and is only meant for internal usage.

It does the following.

    $self->{error}=undef;
    $self->{errorString}="";

ERROR CODES

1

No path specified.

AUTHOR

Zane C. Bowers, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-gtk2-pathbuttonbar at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Gtk2-PathButtonBar. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Gtk2::PathButtonBar

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2008 Zane C. Bowers, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.