NAME

Xacobeo::DomModel - The DOM model used for the TreeView.

SYNOPSIS

use Xacobeo::Document;
use Xacobeo::UI;
use Gtk2;

# Create the view
my $treeview = Gtk2::TreeView->new();

# Create the model and link it with the view
Xacobeo::DomModel::create_model_with_view(
	$treeview,
	sub {
		my ($node) = @_;
		print "Selected node ", $node->toString(), "\n";
	},
);

DESCRIPTION

This package provides a way for creating and populating a standard Gtk2::TreeStore. Take note that this package is not a Gtk2::TreeStore, it only provides helper functions in order to manipulate one.

FUNCTIONS

The package defines the following functions:

create_model_with_view

Creates a new TreeModel and links it with the given TreeView. The view will have the columns of the data types added and the row-activated callback set with a wrapper that will invoque the callback $on_click.

The user provided callback $on_click will be invoked each time that a node is double clicked. This callback takes a single argument the XML::LibXML::Node that has been selected.

Parameters:

  • $treeview

    A reference to the Gtk2::TreeView that will be linked with the Gtk2::TreeStore.

  • $on_click

    A callback that will invoked each time that a node is selected. The callback is in the fashion:

    sub callback {
    	my ($xpath) = @_;
    }

AUTHORS

Emmanuel Rodriguez <potyl@cpan.org>.

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Emmanuel Rodriguez.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.