Games-Axmud
view release on metacpan or search on metacpan
lib/Games/Axmud/Obj/Desktop.pm view on Meta::CPAN
$theming
.= " font-family: $font;\n"
. " font-size: ${fontSize}px;\n"
. "}";
} else {
$theming
.= " font-family: $font, monospace;\n"
. " font-size: ${fontSize}pt;\n"
. "}";
}
$provider->load_from_data ([map ord, split //, $theming]);
foreach my $textView (@tvList) {
if (defined $textView) {
my $context = $textView->get_style_context();
$context->add_provider($provider, 600);
}
}
return 1;
}
sub restrictWidgets {
# Many menu bar and toolbar items can be sensitised, or desensitised, depending on
# conditions
# This function can be called by anything, any time one of those conditions changes, so that
# menu bar/toolbar items in all 'internal' windows can be sensitised or desensitised with
# a single function call
#
# Expected arguments
# (none besides $self)
#
# Return values
# 'undef' on improper arguments
# 1 otherwise
my ($self, $check) = @_;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->restrictWidgets', @_);
}
foreach my $winObj ($self->ivValues('gridWinHash')) {
if (
$winObj->winType eq 'main'
|| $winObj->winType eq 'protocol'
|| $winObj->winType eq 'custom'
) {
# Update menu bars in all 'internal' windows
$winObj->restrictMenuBars();
# Update toolbars in all 'internal' windows
$winObj->restrictToolbars();
}
}
return 1;
}
# 'grid' windows
sub swapGridWin {
# Called by GA::Cmd::SwapWindow->do or by any other function
# Swaps the size and position, exactly, of two 'grid' windows, first checking that each is
# allowed into the other's zone
#
# Expected arguments
# $winObj1 - Blessed reference to the first window object (inheriting from
# GA::Generic::GridWin)
# $winObj2 - Blessed reference to the second window object
#
# Return values
# 'undef' on improper arguments or if the windows can't be swapped
# 1 if the swapping operation succeeds
my ($self, $winObj1, $winObj2, $check) = @_;
# Local variables
my ($zoneObj1, $zoneObj2, $holder);
# Check for improper arguments
if (! defined $winObj1 || ! defined $winObj2 || defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->swapGridWin', @_);
}
# Check that each window is a 'grid' window
if (
$winObj1->winCategory ne 'grid'
|| ! $self->ivExists('gridWinHash', $winObj1->number)
|| ! $winObj1->areaObj
|| ! $winObj1->areaObj->zoneObj
) {
return $self->writeError(
'Can\'t swap windows - 1st window is not a \'grid\' window',
$self->_objClass . '->swapGridWin',
);
} else {
$zoneObj1 = $winObj1->areaObj->zoneObj;
}
if (
$winObj2->winCategory ne 'grid'
|| ! $self->ivExists('gridWinHash', $winObj2->number)
|| ! $winObj2->areaObj
|| ! $winObj2->areaObj->zoneObj
) {
return $self->writeError(
( run in 0.730 second using v1.01-cache-2.11-cpan-39bf76dae61 )