www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/+mbcgui/+actions/DynamicActionGroup.m

    classdef DynamicActionGroup < mbcgui.actions.ActionGroup
    %mbcgui.actions.DynamicActionGroup class
    %   mbcgui.actions.DynamicActionGroup extends mbcgui.actions.ActionGroup.
    %
    %    mbcgui.actions.DynamicActionGroup properties:
    %       Command - Property is of type 'MATLAB callback'
    %       Label - Property is of type 'string'
    %       Description - Property is of type 'string'
    %       IconFile - Property is of type 'string'
    %       Visible - Property is of type 'bool'
    %       Enabled - Property is of type 'bool'
    %       Actions - Property is of type 'handle vector'
    %       MenuType - Property is of type 'string'
    %
    %    mbcgui.actions.DynamicActionGroup methods:
    %       createMenuItem - Create a menu item for the action
    
    %  Copyright 2005-2014 The MathWorks, Inc. and Ford Global Technologies, Inc.
    
    methods  % constructor block
        function obj = DynamicActionGroup(varargin)
        %DYNAMICACTIONGROUP Create a new DynamicActionGroup object
        %
        %  OBJ = DYNAMICACTIONGROUP(COMMAND, LABEL, DESCRIPTION, ICONFILE) creates a new
        %  DynamicActionGroup object.  This is a variant of ActionGroup where you
        %  can change the contained action list and see any menus dynamically
        %  update as you do it.  At present this dynamic support is limited to
        %  menus.
        
        obj@mbcgui.actions.ActionGroup(varargin{ : }); % converted super class constructor call
        end  % DynamicActionGroup
        
    end  % constructor block
    
    methods  % public methods
        %----------------------------------------
        function hMenu = createMenuItem(obj, hParent)
        %CREATEMENUITEM Create a menu item for the action
        %
        %  HMENU = CREATEMENUITEM(OBJ, HPARENT) creates a new uimenu object with
        %  HPARENT as a parent.  When the menu item is selected it will execute the
        %  action.  DynamicActionGroup creates a menu placeholder that will add or
        %  remove menu items when the Actions list in the group is altered.
        
        PH = mbcgui.actions.ActionMenuPlaceHolder(hParent);
        PH.ActionGroup = obj;
        hMenu = [];
        
        end  % createMenuItem
        
    end  % public methods
    
end  % classdef