#!/usr/bin/perl use strict; use warnings; package UserInterface; use base 'Tk::MainWindow'; require Tk::HList; my $MinWidth = 640; my $MinHeight = 480; sub new { my ($class) = shift; my $self = $class->SUPER::new(@_); $self->build_display; return ($self); } sub run { my $self = shift; $self->SUPER::MainLoop; } sub center { my $self = shift; $self->update; my $w = $self->width; my $h = $self->height; my $posx = int(($self->screenwidth - $w) / 2); my $posy = int(($self->screenheight - $h) / 2); $self->geometry($w . 'x' . $h . '+' . $posx . '+' . $posy); } sub datalist { $_[0]->{fl2r_datalist} = $_[1] if @_ > 1; return $_[0]->{fl2r_datalist} } sub datalist_scroll_y { $_[0]->{fl2r_datalist_scroll_y} = $_[1] if @_ > 1; return $_[0]->{fl2r_datalist_scroll_y} } sub build_display { my $self = shift; $self->title(""); $self->geometry($MinWidth .'x'. $MinHeight); $self->minsize($MinWidth, $MinHeight); $self->center; $self->build_datalist; } sub build_datalist { my $self = shift; my $hl = $self->HList( -columns => 6, -header => 1, -height => '15', -background => 'white', )->pack( -fill => 'x', ); $hl->packPropagate(0); $self->datalist($hl); $self->datalist_scroll_y( $self->datalist->Scrollbar( )->pack( -side => 'right', -fill => 'y', ) ); my $col = 0; $self->datalist->headerCreate($col++, -text => '#'); $self->datalist->headerCreate($col++, -text => 'Timestamp'); $self->datalist->headerCreate($col++, -text => 'Thread Id'); $self->datalist->headerCreate($col++, -text => 'Message'); $self->datalist->headerCreate($col++, -text => 'Fipo Start'); $self->datalist->headerCreate($col++, -text => 'Fipo End'); } 1; my $ui = new UserInterface; $ui->run;