| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # Copyright 2007, 2008, 2009, 2010 Kevin Ryde | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | # This file is part of Chart. | 
| 4 |  |  |  |  |  |  | # | 
| 5 |  |  |  |  |  |  | # Chart is free software; you can redistribute it and/or modify it under the | 
| 6 |  |  |  |  |  |  | # terms of the GNU General Public License as published by the Free Software | 
| 7 |  |  |  |  |  |  | # Foundation; either version 3, or (at your option) any later version. | 
| 8 |  |  |  |  |  |  | # | 
| 9 |  |  |  |  |  |  | # Chart is distributed in the hope that it will be useful, but WITHOUT ANY | 
| 10 |  |  |  |  |  |  | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 
| 11 |  |  |  |  |  |  | # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more | 
| 12 |  |  |  |  |  |  | # details. | 
| 13 |  |  |  |  |  |  | # | 
| 14 |  |  |  |  |  |  | # You should have received a copy of the GNU General Public License along | 
| 15 |  |  |  |  |  |  | # with Chart.  If not, see <http://www.gnu.org/licenses/>. | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | package App::Chart::Gtk2::Ex::WidgetBits; | 
| 18 | 1 |  |  | 1 |  | 340 | use 5.010; | 
|  | 1 |  |  |  |  | 3 |  | 
| 19 | 1 |  |  | 1 |  | 4 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 17 |  | 
| 20 | 1 |  |  | 1 |  | 3 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 125 |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | # allowing gtk pre-2.12... | 
| 23 |  |  |  |  |  |  | # | 
| 24 |  |  |  |  |  |  | sub error_bell { | 
| 25 | 0 |  |  | 0 | 0 |  | my ($widget) = @_; | 
| 26 | 0 |  |  |  |  |  | my $display; | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 0 | 0 |  |  |  |  | if (! Gtk2::Widget->can('get_screen')) { | 
| 29 | 0 |  |  |  |  |  | return; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | # actually the 2.12 one doesn't beep if the widget has no display | 
| 33 | 0 | 0 | 0 |  |  |  | if ($widget && $widget->has_screen) { | 
| 34 | 0 | 0 |  |  |  |  | if ($widget->can('error_bell')) { | 
| 35 | 0 |  |  |  |  |  | $widget->error_bell; | 
| 36 | 0 |  |  |  |  |  | return; | 
| 37 |  |  |  |  |  |  | } | 
| 38 | 0 | 0 |  |  |  |  | if ($widget->can('get_display')) { | 
| 39 | 0 |  |  |  |  |  | $display->beep; | 
| 40 | 0 |  |  |  |  |  | return; | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  | } | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | # Gtk 2.0.x or widget without a screen | 
| 45 | 0 |  |  |  |  |  | Gtk2::Gdk->beep; | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | 1; | 
| 49 |  |  |  |  |  |  | __END__ |