[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: To share a dirty hack on a treeview
- From: "Kevin C. Krinke" <kckrinke opendoorsoftware com>
- To: ofey aikon <ofey aikon gmail com>
- Cc: gtk-perl-list gnome org
- Subject: Re: To share a dirty hack on a treeview
- Date: Fri, 18 Feb 2005 01:23:21 -0500
On Thu, 2005-02-17 at 21:37 -0800, ofey aikon wrote:
> I fixed all that ... and added another new gimmick (click on column-header) :)
>
> Since I ripped it a lot, attaching the whole new file instead of a patch.
Not sure if this is the best way to accomplish the desired effect but
attached is a patch to prevent the parent row from being greened at all.
--
Kevin C. Krinke <kckrinke opendoorsoftware com>
Open Door Software Inc.
--- tree_mark_cell-0.02-orig.pl 2005-02-18 00:59:48.000000000 -0500
+++ tree_mark_cell-0.02.pl 2005-02-18 01:17:40.000000000 -0500
@@ -135,6 +135,9 @@
my $model = $tree_view->get_model;
my $iter = $model->get_iter ($path);
+ my @indices = $path->get_indices();
+ return 0 if @indices == 1; # do nothing because we're the parent row?
+
# Change the background of all cells in the clicked row
my $color = undef;
@@ -187,6 +190,8 @@
sub test_color {
my ($model, $path, $iter, $user_data) = @_;
+ my @indices = $path->get_indices();
+ return 0 if @indices == 1; # keep walking the tree
my $i = $user_data->{column}->{column_number};
my $color = $model->get($iter, $i*2+1);
if ($color) { # Atleast one of the cells is colored. Stop walking the tree.
@@ -199,6 +204,8 @@
sub set_color {
my ($model, $path, $iter, $user_data) = @_;
+ my @indices = $path->get_indices();
+ return FALSE if @indices == 1; # skip parent nodes
my $i = $user_data->{column}->{column_number};
$model->set($iter, $i*2+1, $user_data->{color});
add_or_remove_from_cache($user_data->{color}, $model, $path, $i);
@@ -218,6 +225,9 @@
toggle_mark_entire_row($path);
return 0;
}
+
+ my @indices = $path->get_indices();
+ return 0 if @indices == 1; # don't green the parent row
my $iter = $model->get_iter ($path);
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]