ONO::Lib::UI::Help

package ONO::Lib::UI::Help;
################################################################################
# COPYRIGHT / LICENSE #
################################################################################
#
# This file is part of the ONO Software Project.
#
# Copyright (C) 2000-2025 Jos KIRPS [ www.kirps.com | jos_AT_kirps_DOT_com ]
# and The Joopita Project [ www.joopita.org | contact_AT_joopita_DOT_com ]
#
# This file, as well as other parts of the ONO Software Project or related
# elements, are FREE SOFTWARE available under the ARTISTIC LICENSE 2.0.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# For the full license, see /ono/osr/license/LICENSE.txt, or write to
# jos_AT_kirps_DOT_com or contact_AT_joopita_DOT_com.
#
################################################################################
# END OF COPYRIGHT / LICENSE, HERE COMES THE CODE ... #
################################################################################

use strict;

use ONO::Lib::Code::RandomID;

###############################################################################
# droplist
###############################################################################

sub bulb {

my $switches = $_[2];

#: Help bulb with text.
#:
#: -b margin bottom 10
#: -T no table

my $class;

if ($switches =~ /b/) {
$class .= " mb10";
}

my $HELP = qq~<tr class="vtop">
<td><img class="block32 fr" src="/ono/osr/images/icons/crystal/32x32/ono/help.png" alt=""></td>
<td class="w100">$_[1]</td>
</tr>
~;

if ($switches !~ /T/) {
$HELP = qq~<table class="default_table$class">$HELP</table>~;
}

return $HELP;

}

###############################################################################
# tooltip
###############################################################################

sub tip {

my (
$self,
$content,
$tip,
$switches,
$STYLE,
) = @_;

#: Tooltip, will display on mouseover.
#:
#: -c center
#: -l float left
#: -r float right

if (!$STYLE) {
$STYLE = "bottom:0px";
}

my $ID = ONO::Lib::Code::RandomID->make;

my $CLASS;
if ($switches =~ /l/) {
$CLASS .= " fl";
}
if ($switches =~ /c/) {
$CLASS .= " auto";
}
if ($switches =~ /r/) {
$CLASS .= " fr";
}

return qq~<div class="rel inline$CLASS">
<div class="rel inline" onmouseover="onojs_block('tooltip_$ID');" onmouseout="onojs_hide('tooltip_$ID');">
<div id="tooltip_$ID" class="abs hide" style="$STYLE;z-index:1">
<div class="box_white abs nowrap small col6" style="bottom:39px">$tip</div>
<img class="block20 abs" src="/ono/osr/images/arrows/nuvola/white32shadow/nav_down.png" style="bottom:20px;left:10px" alt="">
</div>
<div class="rel" style="z-index:2">$content</div>
</div>
</div>
~;

}

###############################################################################
# end of script
###############################################################################

1;

__END__