function modebtns_cbs(hco,eventStruct,newmode)
%MODEBTNS_CBS Handles the callbacks executed by the mode buttons.
%
% Inputs:
%   hco - handle to current calling object (gcbo) (not used).
%   eventStruct - an empty (not used).
%   newmode  - a scalar indicating which of the 3 modes was selected.

%   Author(s): P. Pacheco
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.7 $  $Date: 2000/06/13 21:23:18 $ 

% Cache figure handle.
hFig = gcbf;

% If this was not a left-click AND not from the menu return early:
% This allows context sensitive help via right-click on the tabs.
if ~strcmp(get(hFig,'SelectionType'), 'normal') &...
        ~strcmpi(get(hco,'Type'),'uimenu'),
    return
end

% Get the user data stored in the figure.
ud = get(hFig,'Userdata');
oldmode = ud.mode.current;  % Cache old mode.

% If new parameters panel is same as previous parameters panel do nothing.
if newmode == oldmode,
    return
end

% Update userdata with the new and old modes.
ud.mode.old = oldmode;
ud.mode.current = newmode;
set(hFig,'Userdata',ud);

% Call function to update the necessary parts of the GUI base on new mode.
update_modebtns(hFig)

% [EOF] modebtns_cbs.m
