| 1 | package Win32::Snarl::Message; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Win32::Snarl; | ||
| 7 | |||
| 8 | sub show { | ||
| 9 | my ($class, $title, $text, %options) = @_; | ||
| 10 | |||
| 11 | my $id; | ||
| 12 | |||
| 13 | if (exists $options{class}) { | ||
| 14 | $id = Win32::Snarl::ShowMessageEx( | ||
| 15 | $options{class}, | ||
| 16 | $title, | ||
| 17 | $text, | ||
| 18 | $options{timeout}, | ||
| 19 | $options{icon}, | ||
| 20 | $options{hwnd}, | ||
| 21 | $options{reply}, | ||
| 22 | $options{sound}, | ||
| 23 | ); | ||
| 24 | } else { | ||
| 25 | $id = Win32::Snarl::ShowMessage( | ||
| 26 | $title, | ||
| 27 | $text, | ||
| 28 | $options{timeout}, | ||
| 29 | $options{icon}, | ||
| 30 | $options{hwnd}, | ||
| 31 | $options{reply}, | ||
| 32 | ); | ||
| 33 | } | ||
| 34 | |||
| 35 | bless [$id], $class; | ||
| 36 | } | ||
| 37 | |||
| 38 | sub visible { | ||
| 39 | my ($self) = @_; | ||
| 40 | |||
| 41 | Win32::Snarl::IsMessageVisible($self->[0]); | ||
| 42 | } | ||
| 43 | |||
| 44 | sub hide { | ||
| 45 | my ($self) = @_; | ||
| 46 | |||
| 47 | Win32::Snarl::HideMessage($self->[0]); | ||
| 48 | } | ||
| 49 | |||
| 50 | sub update { | ||
| 51 | my ($self, $title, $text) = @_; | ||
| 52 | |||
| 53 | Win32::Snarl::UpdateMessage($self->[0], $title, $text); | ||
| 54 | } | ||
| 55 | |||
| 56 | 1; |