auto
  "   ˆl–Ým_J¥2ÛR‚ œPB¸Ð.2Ê˜´oÁƒh¹À¿      auto
  0   ˆl–Ãa¾” ”ÜZÔíÆž¸TÅ£Â„m–_s_‹uÐb&=LV[(ÂÁ ?÷     # ----------------------------------------------------------------------
# Curses::UI::Widget
#
# (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::Widget;

use strict;
use Carp qw(confess);
use Term::ReadKey;
use Curses;
use Curses::UI::Common;
require Exporter;

use vars qw(
    $VERSION 
    @ISA 
    @EXPORT
);

$VERSION = '1.12';

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

@EXPORT = qw(
    height_by_windowscrheight
    width_by_windowscrwidth
    process_padding
    loose_focus
    lose_focus
);

sub new ()
{
    my $class = shift;

    my %userargs = @_;
    keys_to_lowercase(\%userargs);

    my %args = ( 
        -parent         => undef,    # the parent object
        -x              => 0,        # horizontal position (rel. to -parent)
        -y              => 0,        # vertical position (rel. to -parent)
        -width          => undef,    # horizontal size 
        -height         => undef,    # vertical size
        -border         => 0,        # add a border?
        -sbborder       => 0,        # add square bracket border?
        -nocursor       => 0,        # Show a cursor?
        -titlefullwidth => 0,        # full width for title?
        -titlereverse   => 1,        # reverse chars for title? 
        -title          => undef,    # A title to add to the widget (only for 
                                     # -border = 1)
        # padding outside widget
        -pad            => undef,    # all over padding
        -padright       => undef,    # free space on the right side
        -padleft        => undef,    # free space on the left side
        -padtop         => undef,    # free space above
        -padbottom      => undef,    # free space below

        # padding inside widget
        -ipad           => undef,    # all over padding
        -ipadright      => undef,    # free space on the right side
        -ipadleft       => undef,    # free space on the left side
        -ipadtop        => undef,    # free space above
        -ipadbottom     => undef,    # free space below

        # scrollbars
        -vscrollbar     => 0,        # vert. scrollbar (top/bottom)
        -vscrolllen     => 0,        # total number of rows
        -vscrollpos     => 0,        # current row position
        -hscrollbar     => 0,        # hor. scrollbar (left/right)
        -hscrolllen     => 0,        # total number of columns
        -hscrollpos     => 0,        # current column position 

        -onfocus        => undef,    # onFocus event handler
        -onblur         => undef,    # onBlur event handler
        -intellidraw    => 1,        # Support intellidraw()?
        -focusable      => 1,        # This widget can get focus
        -htmltext       => 1,        # Recognize HTML tags in drawn text

	#user data
	-userdata	=> undef,    #user internal data

	#color
		 # Border
        -bfg             => -1,
        -bbg             => -1,
		 # Scrollbar
	-sfg             => -1,
        -sbg             => -1,
		 # Titlebar
	-tfg             => -1,
        -tbg             => -1,

        %userargs,
    
        -focus          => 0,        # has the widget focus?    
    );

    # Allow the value -1 for using the full width and/or
    # height for the widget.
    $args{-width} = undef 
        if defined $args{-width} and $args{-width} == -1;
    $args{-height} = undef 
        if defined $args{-height} and $args{-height} == -1;

    &Curses::UI::fatalerror(
        "Missing or illegal parameter: -parent\n" 
      . "while creating " . caller() . "object"
    ) unless defined $args{-parent} and ref $args{-parent};
    
    # Allow a square bracket bor