| Gtk2-Ex-Email-Compose documentation | Contained in the Gtk2-Ex-Email-Compose distribution. |
Gtk2::Ex::Email::Compose - Presents a email compose window.
Version 0.1.0
use Gtk2::Ex::Email::Compose;
use Gtk2;
use Data::Dumper;
Gtk2->init;
my $ecw=Gtk2::Ex::Email::Compose->new;
my $window=$ecw->window({title=>'some thing'});
my $addressVBox=$ecw->getAddressVBox;
my $attachmentVBox=$ecw->getAttachmentVBox;
$ecw->setAddressbookCB(sub{
use Data::Dumper;
print Dumper($_[1]);
},
{
ecw=>$ecw,
addresses=>$addressVBox,
}
);
$ecw->setCloseCB(sub{
use Data::Dumper;
print Dumper($_[1]);
},
{
ecw=>$ecw,
}
);
$ecw->setDraftCB(sub{
use Data::Dumper;
print Dumper($_[1]);
},
{
ecw=>$ecw,
addresses=>$addressVBox,
attachment=>$attachmentVBox
}
);
$ecw->setSendCB(sub{
use Data::Dumper;
print Dumper($_[1]{addresses});
},
{
ecw=>$ecw,
addresses=>$addressVBox,
attachment=>$attachmentVBox,
}
);
$ecw->setSpellcheckCB(sub{
use Data::Dumper;
print Dumper($_[1]);
},
{
ecw=>$ecw,
}
);
Gtk2->main;
This initiates the object.
my $ecw=Gtk2::Ex::Email::Compose->new;
This gets the notebook created by Gtk2::Ex::Email::AAnotebook.
my $notebook=$ecw->getAAnotebook;
This gets the Gtk2::Ex::Email::AddressVBox object created by Gtk2::Ex::Email::AAnotebook.
my $addressVBox=$ecw->getAddressVBox;
This gets the Gtk2::Ex::Email::AttachmentVBox object created by Gtk2::Ex::Email::AAnotebook.
my $attachmentVBox=$ecw->getAttachmentVBox;
This gets the body.
my $body=$ecw->getBody;
This gets the subject.
my $subject=$ecw->getSubject;
This sets the callback for when the addressbook button is clicked.
Two options are taken. The first is the callback and the second is any data to be passed to the callback.
$ecw->setAddressbookCB(sub{
use Data::Dumper;
print Dumper($_[1]);
},
{
ecw=>$ecw,
}
);
This sets the body.
One arguement is taken and that is the body to set. If it is not defined, '' will be used.
$ecw->setBody($body);
This sets the callback for when the close button is clicked.
Two options are taken. The first is the callback and the second is any data to be passed to the callback.
$ecw->setCloseCB(sub{
use Data::Dumper;
print Dumper($_[1]);
},
{
ecw=>$ecw,
}
);
This sets the callback for when the draft button is clicked.
Two options are taken. The first is the callback and the second is any data to be passed to the callback.
$ecw->setDraftCB(sub{
use Data::Dumper;
print Dumper($_[1]);
},
{
ecw=>$ecw,
}
);
This sets the callback for when the send button is clicked.
Two options are taken. The first is the callback and the second is any data to be passed to the callback.
$ecw->setSendCB(sub{
use Data::Dumper;
print Dumper($_[1]);
},
{
ecw=>$ecw,
}
);
This sets the callback for when the spell check button is clicked.
Two options are taken. The first is the callback and the second is any data to be passed to the callback.
$ecw->setSpellcheckCB(sub{
use Data::Dumper;
print Dumper($_[1]);
},
{
ecw=>$ecw,
}
);
This sets the subject.
One arguement is taken and that is the subject to set. If it is not defined, '' will be used.
my $subject=$ecw->getSubject('some subject');
This builds the compose window and returns a Gtk2::Window object.
One arguement is taken and it is a hash.
This is the hash that contains the addresses to pass to Gtk2::Ex::Email::AddressVBox->vbox.
If set to true, it displays the 'Addressbook' button.
The default is true.
If set to true, it displays the 'Close' button.
The default is true.
If set to true, it displays the 'Draft' button.
The default is true.
If set to true, it displays the 'Send' button.
The default is true.
If set to true, it displays the 'Spell Check' button.
The default is true.
This is the array that contains the files to pass to Gtk2::Ex::Email::AttachmentVBox->vbox.
If this is defined, the subject will be set to it.
The window title.
my $window=$ecm->window(\%args);
Zane C. Bowers, <vvelox at vvelox.net>
Please report any bugs or feature requests to bug-gtk2-ex-email-compose at rt.cpan.org, or through
the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Gtk2-Ex-Email-Compose. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Gtk2::Ex::Email::Compose
You can also look for information at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Gtk2-Ex-Email-Compose
Copyright 2009 Zane C. Bowers, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Gtk2-Ex-Email-Compose documentation | Contained in the Gtk2-Ex-Email-Compose distribution. |
package Gtk2::Ex::Email::Compose; use warnings; use strict; use Gtk2; use Gtk2::Ex::Email::AAnotebook;
our $VERSION = '0.1.0';
sub new{ my $self={error=>undef, perror=>undef, errorString=>undef, gui=>{}, }; bless $self; return $self; }
sub getAAnotebook{ my $self=$_[0]; return $self->{AAnotebook}; }
sub getAddressVBox{ my $self=$_[0]; return $self->{AAnotebook}->getAddressVBox; }
sub getAttachmentVBox{ my $self=$_[0]; return $self->{AAnotebook}->getAttachmentVBox; }
sub getBody{ my $self=$_[0]; return $self->{gui}{bodyBuffer}->get_text; }
sub getSubject{ my $self=$_[0]; return $self->{gui}{subject}->get_text; }
sub setAddressbookCB{ my $self=$_[0]; my $callback=$_[1]; my $data=$_[2]; $self->{gui}{close}->signal_connect(clicked=>$callback, $data); }
sub setBody{ my $self=$_[0]; my $text=$_[1]; if (!defined($text)) { $text=''; } return $self->{gui}{bodyBuffer}->set_text($text); }
sub setCloseCB{ my $self=$_[0]; my $callback=$_[1]; my $data=$_[2]; $self->{gui}{close}->signal_connect(clicked=>$callback, $data); }
sub setDraftCB{ my $self=$_[0]; my $callback=$_[1]; my $data=$_[2]; $self->{gui}{draft}->signal_connect(clicked=>$callback, $data); }
sub setSendCB{ my $self=$_[0]; my $callback=$_[1]; my $data=$_[2]; $self->{gui}{send}->signal_connect(clicked=>$callback, $data); }
sub setSpellcheckCB{ my $self=$_[0]; my $callback=$_[1]; my $data=$_[2]; $self->{gui}{spellcheck}->signal_connect(clicked=>$callback, $data); }
sub setSubject{ my $self=$_[0]; my $text=$_[1]; if (!defined($text)) { $text=''; } $self->{gui}{subject}->set_text($text); return 1; }
sub window{ my $self=$_[0]; my %args; if(defined($_[1])){ %args= %{$_[1]}; } #sets the defaults if (!defined($args{displaySend})) { $args{displaySend}=1; } if (!defined($args{displayDraft})) { $args{displayDraft}=1; } if (!defined($args{displayClose})) { $args{displayClose}=1; } if (!defined($args{displayAddressbook})) { $args{displayAddressbook}=1; } if (!defined($args{displaySpellcheck})) { $args{displaySpellcheck}=1; } #the the window that will contain it all $self->{gui}{window}=Gtk2::Window->new; $self->{gui}{window}->set_default_size(750, 450); $self->{gui}{window}->show; if (defined($args{title})) { $self->{gui}{window}->set_title($args{title}); } #this will hold everything in the window $self->{gui}{vbox}=Gtk2::VBox->new; $self->{gui}{vbox}->show; $self->{gui}{window}->add( $self->{gui}{vbox} ); #this will hold the buttons $self->{gui}{buttonHB}=Gtk2::HBox->new; $self->{gui}{buttonHB}->show; $self->{gui}{vbox}->pack_start( $self->{gui}{buttonHB}, 0, 1, 1 ); #set up the send button if ($args{displaySend}) { $self->{gui}{send}=Gtk2::Button->new; $self->{gui}{send}->show; $self->{gui}{sendLabel}=Gtk2::Label->new('Send'); $self->{gui}{sendLabel}->show; $self->{gui}{send}->add($self->{gui}{sendLabel}); $self->{gui}{buttonHB}->pack_start($self->{gui}{send}, 0, 1, 1); } #set up the send button if ($args{displayClose}) { $self->{gui}{close}=Gtk2::Button->new; $self->{gui}{close}->show; $self->{gui}{closeLabel}=Gtk2::Label->new('Close'); $self->{gui}{closeLabel}->show; $self->{gui}{close}->add($self->{gui}{closeLabel}); $self->{gui}{buttonHB}->pack_start($self->{gui}{close}, 0, 1, 1); } #set up the draft button if ($args{displayDraft}) { $self->{gui}{draft}=Gtk2::Button->new; $self->{gui}{draft}->show; $self->{gui}{draftLabel}=Gtk2::Label->new('Draft'); $self->{gui}{draftLabel}->show; $self->{gui}{draft}->add($self->{gui}{draftLabel}); $self->{gui}{buttonHB}->pack_start($self->{gui}{draft}, 0, 1, 1); } #set up the draft button if ($args{displayAddressbook}) { $self->{gui}{addressbook}=Gtk2::Button->new; $self->{gui}{addressbook}->show; $self->{gui}{addressbookLabel}=Gtk2::Label->new('Addressbook'); $self->{gui}{addressbookLabel}->show; $self->{gui}{addressbook}->add($self->{gui}{addressbookLabel}); $self->{gui}{buttonHB}->pack_start($self->{gui}{addressbook}, 0, 1, 1); } #set up the send button if ($args{displaySpellcheck}) { $self->{gui}{spellcheck}=Gtk2::Button->new; $self->{gui}{spellcheck}->show; $self->{gui}{spellcheckLabel}=Gtk2::Label->new('Spell Check'); $self->{gui}{spellcheckLabel}->show; $self->{gui}{spellcheck}->add($self->{gui}{spellcheckLabel}); $self->{gui}{buttonHB}->pack_start($self->{gui}{spellcheck}, 0, 1, 1); } #the paned seperating the notebook and entry $self->{gui}{vpaned}=Gtk2::VPaned->new; $self->{gui}{vpaned}->show; $self->{gui}{vpaned}->set_position(150); $self->{gui}{vbox}->pack_start( $self->{gui}{vpaned}, 1, 1, 1 ); #AA notebook $self->{AAnotebook}=Gtk2::Ex::Email::AAnotebook->new(); $self->{gui}{AAnotebook}=$self->{AAnotebook}->notebook( $args{addresses}, $args{files} ); $self->{gui}{vpaned}->add1($self->{gui}{AAnotebook}); #this vbox holds the stuff for the bottom paned $self->{gui}{bottomHPanedVB}=Gtk2::VBox->new; $self->{gui}{bottomHPanedVB}->show; $self->{gui}{vpaned}->add2( $self->{gui}{bottomHPanedVB} ); #the subject $self->{gui}{subjectHB}=Gtk2::HBox->new; $self->{gui}{subjectHB}->show; $self->{gui}{subjectLabel}=Gtk2::Label->new('Subject:'); $self->{gui}{subjectLabel}->show; $self->{gui}{subjectHB}->pack_start($self->{gui}{subjectLabel}, 0, 1, 1); $self->{gui}{subject}=Gtk2::Entry->new; $self->{gui}{subject}->show; $self->{gui}{subjectHB}->pack_start($self->{gui}{subject}, 1, 1, 1); if (defined($args{subject})) { $self->{gui}{subject}->set_text($args{text}); } $self->{gui}{bottomHPanedVB}->pack_start( $self->{gui}{subjectHB}, 0, 1, 1 ); #the final part $self->{gui}{body}=Gtk2::TextView->new; $self->{gui}{body}->show; $self->{gui}{bodyBuffer}=Gtk2::TextBuffer->new; $self->{gui}{body}->set_buffer($self->{gui}{bodyBuffer}); $self->{gui}{bottomHPanedVB}->pack_start( $self->{gui}{body}, 1, 1, 1 ); return $self->{gui}{window}; }
1; # End of Gtk2::Ex::Email::Compose