Gtk2-Ex-DBITableFilter

 view release on metacpan or  search on metacpan

lib/Gtk2/Ex/DBITableFilter/FilterWidget.pm  view on Meta::CPAN

	
	my $parent = $self->{parent};
	my $button = $self->_get_column_header_button($columnnumber);
	my $popupwindow = Gtk2::Ex::PopupWindow->new($button);
	$popupwindow->set_move_with_parent(TRUE);
	
	my $choices = ['before', 'after'];
	my $joiner  = [ '', 'and', 'or'];
	
	my $datelabel1 = Gtk2::Label->new;
	my $datelabelbox1 = _calendar_popup($datelabel1, $date1);
	my $combobox1 = Gtk2::ComboBox->new_text;	
	$combobox1->append_text($choices->[0]);
	$combobox1->append_text($choices->[1]);
	my $index1 = 1;
	if ($command1) {
		my $i = 0;
		$index1 = { map { $_ => $i++ } @$choices }->{$command1};
	}
	$combobox1->set_active($index1);
	
	my $datelabel2 = Gtk2::Label->new;
	my $datelabelbox2 = _calendar_popup($datelabel2, $date2);
	my $combobox2 = Gtk2::ComboBox->new_text;	
	$combobox2->append_text($choices->[0]);
	$combobox2->append_text($choices->[1]);
	my $index2 = 0;
	if ($command1) {
		my $i = 0;
		$index2 = { map { $_ => $i++ } @$choices }->{$command2};
	}
	$combobox2->set_active($index2);

lib/Gtk2/Ex/DBITableFilter/FilterWidget.pm  view on Meta::CPAN

	my $labelbox = _add_arrow($label);
	$col->set_widget ($labelbox);
	$labelbox->show_all;
	my $button = $col->get_widget; # not a button
	do {
		$button = $button->get_parent;
	} until ($button->isa ('Gtk2::Button'));
	return $button;
}

sub _calendar_popup {
	my ($datelabel, $datestr) = @_;
	my $datelabelbox = _add_button_press(_add_arrow($datelabel));
	my $datepopup = Gtk2::Ex::PopupWindow->new($datelabelbox);
	my $date = Gtk2::Calendar->new;
	if ($datestr) {
		my ($year, $mon, $day) = split '-', $datestr;
		$date->select_month($mon-1, $year);
		$date->select_day($day);
		$datelabel->set_text("$year-$mon-$day");
	}



( run in 1.054 second using v1.01-cache-2.11-cpan-39bf76dae61 )