www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcmultiview/@MultiViewPanel/pCreateViewListActions.m
function AG = pCreateViewListActions(obj, ActionType) %PCREATEVIEWLISTACTIONS Create an ActionGroup for View creation % % AG = PCREATEVIEWLISTACTIONS(OBJ, ACTIONTYPE) creates and returns an % action group that contains an action for creating each of the available % views. ACTIONTYPE defines the type of creation that will occur: % 'change' means that the actions will change the current view and 'split' % means that the actions will split the current view. % Copyright 2005-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin<2 ActionType = 'change'; end switch ActionType case 'change' objfun = @mbcmultiview.ToggleAction; cb = @i_changeview; lbl = '&Current View'; groupcb = @i_checkviewers; case 'split' objfun = @mbcmultiview.StatefulAction; cb = @i_splitview; lbl = '&Split View'; groupcb = @i_checkviewers; otherwise error(message('mbc:mbcmultiview:MultiViewPanel:InvalidArgument')); end VL = obj.ViewList; A = mbcutils.handleArray(1, VL.numViews); for n = 1:length(A) A(n) = objfun({cb, obj, n}, VL.Labels{n}, VL.Descriptions{n}, VL.IconFiles{n}); end AG = mbcmultiview.ActionGroup({groupcb, obj}, lbl); set(AG, 'Actions', A, 'MenuType', 'submenu'); function i_splitview(src, evt, obj, viewnum) obj.splitView([], viewnum); function i_changeview(src, evt, obj, viewnum) obj.changeView(viewnum); function i_checkviewers(AG, evt, obj) obj.updateAvailableViews;