| Wx-Perl-TreeChecker documentation | view source | Contained in the Wx-Perl-TreeChecker distribution. |
Wx::Perl::TreeChecker - Tree Control with checkbox functionality
use Wx::Perl::TreeChecker; my $tree = new Wx::Perl::TreeChecker( ... ); $tree -> allow_multiple(0); $tree -> items_only(1); # use tree like a normal treectrl my $tree = new Wx::TreeCtrl(); Wx::Perl::TreeChecker->Convert($tree, $options) my @selection = $tree->GetSelection();
Wx::Perl::TreeChecker is a tree control with check boxes so users can select parts of the tree.
A typical use would be a file-selector for backup / archive.
Exports TC_SELECTED and TC_PART_SELECTED which correspond to the status
returned by
$tree -> IsSelected($item)
TC_SEL_FULL and TC_SEL_COMPACT are also exported. See
"GetSelection(STYLE)" for more information.
You can export these constants with the ':status' import tag:
use Wx::Perl::TreeChecker ':status';
The methods listed here are only where there are syntactic differences to
Wx::TreeCtrl
Where @std_args are the regular arguments that you would pass to
Wx::TreeCtrl->new().
%treechecker is an optional hash of options that customise the way that
Wx::Perl::TreeChecker behaves. Valid keys:
allow_multiple # can multiple selections be made (default: TRUE)
containers_only # user can only select containers (default: FALSE)
items_only # user can only select items (default: FALSE)
no_recurse # no recursion when user selects node (default: FALSE)
image_list # Wx::ImageList to use for checkbox icons
# (default provided)
Converts a standard Wx::TreeCtrl into a Wx::Perl::TreeChecker
The first argument is a Wx::TreeCtrl. The seconds argument is an optional
hashref as new().
Add a root to the control. Returns root id.
As Wx::TextCtrl::AddRoot, but image indices are removed
Add an item to the control as the last child of $parent. Returns item id.
As Wx::TextCtrl::AppendItem, but image indices are removed
Add a container to the control as the last child of $parent. This does the
same as AppendItem() but marks the node as a container.
Add an item to the control as the first child of $parent. Returns item id.
Add a container to the control as the first child of $parent.
Inserts an item after a given one (previous) or before one identified by its position (before).
See InsertItem().
Returns a list of selected Wx::TreeItemIds. The behaviour can be controlled by the STYLE and the behaviour of the object (containers_only,
no_recurse, etc).
Allowed styles are;
TC_SEL_FULLThe default if GetSelection is called without a STYLE. It returns
all tree items that are checked (TC_SELECTED and TC_PART_SELECTED)
TC_SEL_COMPACTThis returns a compact list. If a Container item is TC_SELECTED, it
will be returned in place of it's child items. Containers that are
TC_PART_SELECTED are not returned.
returns the selection status of the item. See Exported flags.
returns TRUE if the item is a container
Select the item, returns TRUE if the item was selected.
Clear the selction of the item
Clear the selections on the tree
see new()
see new()
see new()
see new()
A default set of checkbox icons are included. You can override these by
supplying a Wx::ImageList to the constructor or the SetImageList method.
This class method returns the three standard icons that you can mix with your own icons.
my ($empty, $ticked, $part_selected) = Wx::Perl::TreeChecker->std_icons();
The Image list must contain 8 icons, 16 x 16 pixels:
Image number Image description
------------------------------------------------------------------------
0 The root icon
1 Selected root icon
2 Part-selected root icon
3 Container icon
4 Selected container icon
5 Part-selected container icon
6 Item icon
7 Selected item icon
See demo/treechecker.pl
Simon Flack <simonflk _AT_ cpan.org>
I can squash more bugs with your help. Please let me know if you spot something that doesn't work as expected.
You can report bugs via the CPAN RT: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Wx-Perl-TreeChecker
If possible, please provide a diff against the test files or sample script that demonstrates the bug(s).
wxWindows: wxTreeCtrl
Copyright (c) 2003, 2004, 2005 Simon Flack <simonflk _AT_ cpan.org>. All rights reserved
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
| Wx-Perl-TreeChecker documentation | view source | Contained in the Wx-Perl-TreeChecker distribution. |