Gtk2-Ex-SearchBox

 view release on metacpan or  search on metacpan

lib/Gtk2/Ex/SearchBox.pm  view on Meta::CPAN

		);
		$treemodel->set (
			$treemodel->append,
			OR_______COLUMN, 'or',
			NAME_____COLUMN, $data->{field},
			OPERATOR_COLUMN, $data->{operator},
			MODEL____COLUMN, $combomodel,
		);
	}
}

sub _check_list_visibility {
	my ($self) = @_;
	my $treeview  = $self->{treeview};
	my $data      = $self->{datamodel};
	if ($#{@$data} >= 0) {
		$treeview->set_sensitive(TRUE);		
		#$treeview->set_no_show_all(FALSE);	
		#$treeview->show;
	} else {
		$treeview->set_sensitive(FALSE);
		#$treeview->hide;
		#$treeview->set_no_show_all(TRUE);	
		#$window->set_focus($entry);
	}
}

1;

__END__


=head1 NAME

Gtk2::Ex::SearchBox - A simple widget for specifying a search pattern (or a list of
search patterns).

=head1 DESCRIPTION

A simple widget for specifying a search pattern (or a list of
search patterns).

=head1 SYNOPSIS

	my $searchbox = Gtk2::Ex::SearchBox->new;
	$window->add($searchbox->{widget});

=head1 METHODS

=head2 new;

The constructor.

	my $searchbox = Gtk2::Ex::SearchBox->new;

If you want to allow only one pattern at a time, then you can call the constructor 
with C<'single'> as an argument.

	my $searchbox = Gtk2::Ex::SearchBox->new('single');
	
By default, the dropdown combobox contains the following choices.

	[
		'contains',
		'doesn\'t contain',
		'not equal to',
		'equals',
	]
	
But if you want to specify your own set, then you can call the constructor with 
two arguments.

	my $operatorlist = [
		'starts with',
		'ends with',
		'has in the middle'
	];
	my $searchbox = Gtk2::Ex::SearchBox->new('multiple', $operatorlist);

If you do not want even that combobox to the left, then send undef as the operatorlist.

	my $searchbox = Gtk2::Ex::SearchBox->new('single', undef);
	
Now this is just an C<$enty> with an C<$ok_button> !!	

=head2 set_model($model);

Sets the C<$model>. For example, 

	$model = [
		{'operator' => 'contains', 'field' => 'this pattern'},
		{'operator' => 'equals', 'field' => 'that exact pattern'},
	]

=head2 get_model;

Returns the C<$model>

For example, 

	$model = [
		{'operator' => 'contains', 'field' => 'this pattern'},
		{'operator' => 'equals', 'field' => 'that exact pattern'},
	]

=head2 attach_popup_to($parent);

This method returns a C<Gtk2::Ex::PopupWindow>. The popup window will contain
a C<Gtk2::Ex::SearchBox> widget.

=head2 to_sql_condition($datefieldname, $model);

Converts the C<$model> into an SQL condition so that it can be used directly in
and SQL statement. C<$fieldname> is the fieldname that will be used inside
the SQL condition.

=head2 signal_connect($signal, $callback);

See the SIGNALS section to see the supported signals.

=head1 SIGNALS

=head2 changed;

=head2 closed;

=head1 SEE ALSO

Gtk2::Ex::PopupWindow

=head1 COPYRIGHT & LICENSE

Copyright 2005 Ofey Aikon, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option) any
later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY



( run in 1.282 second using v1.01-cache-2.11-cpan-8dfa8b56332 )