# milkbone - conversation window package Milkbone::ConvoTL; use Milkbone; use Milkbone::Convo; our $VERSION = '1.0'; use Tk(Ev); use base qw(Tk::Toplevel); use strict; use warnings; Construct Tk::Widget 'MBConvoTL'; sub ClassInit { my ($class, $mw) = @_; $class->SUPER::ClassInit($mw); } sub Populate { my ($self, $args) = @_; $self->SUPER::Populate($args); $self->withdraw(); $self->ConfigSpecs('DEFAULT' => ['SELF']); } sub on_destroy { my ($self) = @_; hook("remove_convo", -user => shift->{buddy}); hook("protocol_set_typing_status", -user => $self->{buddy}, -status => 0); } sub init { my ($self, $mw, $buddy) = @_; $self->{buddy} = $buddy; $self->title("$buddy - Conversation"); $self->update; # WIDGET CREATION BEGIN $self->{menu} = $self->Menu; $self->{menu_file} = $self->{menu}->cascade(-label => "File", -tearoff => 0); $self->{menu_file}->command(-label => "Close", -command => [$self, "destroy"]); $self->configure(-menu => $self->{menu}); $self->{convo} = $self->MBConvo->pack(-expand => 1, -fill => 'both'); $self->bind("", [$self, "destroy"]); $self->{convo}->init($mw, $buddy); $self->update; $self->geometry("480x320"); $self->deiconify; hook("tk_seticon", -wnd => $self); $self->OnDestroy([$self, "on_destroy"]); } 1;