function A = updatemenu(A)
%AXISTEXT/UPDATEMENU

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.4 $  $Date: 1997/12/06 00:40:14 $

menu = get(A,'UIContextMenu');

checked = {'off' 'on'};

% update size selection
fontSize = get(A,'FontSize');

sizeMenu = findall(menu,'Tag','ScribeAxistextObjSizeMenu');
submenus = allchild(sizeMenu);
set(submenus,'Checked','off');
whichMenu = findall(submenus,'Label', num2str(fontSize));
set(whichMenu,'Checked','on');


% update style selection
fontStyle = get(A,'FontAngle');
fontWeight = get(A,'FontWeight');

isBold = strcmp(fontWeight,'bold');
isItalic = strcmp(fontStyle,'italic');
isNormal = ~isBold & ~isItalic;

styleMenu = findall(menu,'Tag','ScribeAxistextObjStyleMenu');
submenus = allchild(styleMenu);

% menu order: normal, italic, bold
% menu children are listed in reverse order!

checks = {...
        checked{isBold+1}
        checked{isItalic+1}
        checked{isNormal+1}
        };

set(submenus,{'Checked'},checks);
