0
  )   ˆZƒ›Ù«{‹„„-i[D<†ªo_’I|¥‰ÓMjqØ‚¦ð¬÷ÂÁ  Ú    ‹      mÎ1nÃ0Ð«9€„nEàzéÒtèhP6]	PM…¤*$§í&[G’ÿï3‰°Á"Áœ2Azÿ‹â•gÃ±f®êé[¸?f^È•X:z:×$¤{5ñòZÁéíŒÉ¶×Õ÷qÈižÝ“ScX£iQÃœi‚pÙ4
º‰¸ ±8xŸáÂPèß ”L¨UÿîBš_Ñ¬½o­¹»Âüãsó‡þ!½+¿Òeê<öU“´dñáC[î ÞÒ+        ˆl–ß=¿Jå2ÛR‚ œP¸Ë·ú˜´oÄ0ÃÂ  "   ˆl–ß=¿Jå2ÛR‚ œP ¸®61hßÅƒh¹ÄÃ      0
  G   	ˆl–ß=¿J *n-j
€À;q§ÔÅ£Æ„­<ÿ_‹uÐb&=LV[(a–ß=¿Jå2ÛR‚ œP¸Ë·1hßÆ ?÷     	# ----------------------------------------------------------------------
# Curses::UI::Buttonbox
#
# (c) 2001-2002 by Maurice Makaay. All rights reserved.
# This file is part of Curses::UI. Curses::UI is free software.
# You can redistribute it and/or modify it under the same terms
# as perl itself.
#
# Currently maintained by Marcus Thiesen
# e-mail: marcus@cpan.thiesenweb.de
# ----------------------------------------------------------------------

package Curses::UI::Buttonbox;

use strict;
use Curses;
use Curses::UI::Widget;
use Curses::UI::Common;

use vars qw(
    $VERSION 
    @ISA 
);

$VERSION = '1.10';

@ISA = qw(
    Curses::UI::Widget
    Curses::UI::Common
);

# Definition of the most common buttons.
my %buttondef = (
    'ok'    => {
                -label    => '< OK >',
                -value    => 1,
                -onpress  => undef,
                -shortcut => 'o',
            },
    'cancel'=> {
                -label    => '< Cancel >',
                -value    => 0,
                -onpress  => undef,
                -shortcut => 'c',
            }, 
    'yes'   => {
                -label    => '< yes >',
                -value    => 1,
                -onpress  => undef,
                -shortcut => 'y',
            },
    'no'    => {
                -label    => '< No >',
                -value    => 0,
                -onpress  => undef,
                -shortcut => 'n',
            }, 
    
);

# The default button to use if no buttons were defined.
my $default_btn = [ 'ok' ];

my %routines = (
    'press-button' => \&press_button,
    'loose-focus'  => \&loose_focus,
    'next'         => \&next_button,
    'previous'     => \&previous_button,
    'shortcut'     => \&shortcut,  
    'focus-shift'  => \&focus_shift,
    'mouse-button1'=> \&mouse_button1,
);

my %bindings = (
    CUI_TAB()      => 'focus-shift',
    KEY_BTAB()     => 'focus-shift',
    KEY_ENTER()    => 'press-button',
    CUI_SPACE()    => 'press-button',
    KEY_UP()       => 'previous',
    "k"            => 'previous',
    KEY_DOWN()     => 'next',
    "j"            => 'next',
    KEY_LEFT()     => 'previous',
    'h'            => 'previous',
    KEY_RIGHT()    => 'next', 
    'l'            => 'next',
    ''             => 'shortcut',
);

sub new ()
{
    my $class = shift;

    my %userargs = @_;
    keys_to_lowercase(\%userargs);
    
    my %args = (
        -parent          => undef,        # the parent window
        -buttons         => $default_btn, # buttons (arrayref)
        -buttonalignment => undef,        # left / middle / right
        -selected        => 0,            # which selected
        -width           => undef,        # the width of the buttons widget
        -x               => 0,            # the horizontal pos rel. to parent
        -y               => 0,            # the vertical pos rel. to parent
	-bg              => -1,
        -fg              => -1,

        %userargs,

        -routines        => {%routines},
        -bindings        => {%bindings},

        -focus           => 0,            # init value
        -nocursor        => 1,            # this widget does not use a cursor
    );

    # The windowscr height should be 1.
    my $height = $args{-vertical} ? scalar @{$args{-buttons}} : 1;
    $args{-height} = height_by_windowscrheight($height ,%args);
 
    # Create the widget.
    my $this = $class->SUPER::new( %args );
    
    # Process button definitions.
    $this->process_buttondefs;

    $this->layout();

    if ($Curses::UI::ncurses_mouse) {
        $this->set_mouse_binding('mouse-button1', BUTTON1_CLICKED());
    }

   