www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/+cgcalsetup/WizardPage.m

    classdef WizardPage < handle
    %WIZARDPAGE abstract wizard page class
    %
    % cgcalsetup.WizardPage properties:
    %   Layout - layout object for page
    %   Data - data object for wizard
    %   nextFcn - callback function on clicking next
    %   finishFcn -  callback function on finishing wizard
    %
    % cgcalsetup.WizardPage methods:
    %   nextPage  - actions on clicking next
    %   finishWizard -  actions on clicking finish
    %   updatePage - update wizard page with data (Abstract)
    %   updateData - update data from wizard page (Abstract)
    %   createLayout - create layout for wizard (Abstract,protected)
    %   createPage - create page for wizard (Abstract,Static)
    %   getNextPage - function handle for next page
    
    %  Copyright 2009-2015 The MathWorks, Inc. and Ford Global Technologies, Inc.
    
    properties
        %LAYOUT layout object for page
        Layout
        %DATA data object for wizard
        Data
        %NEXTFCN callback function on clicking next
        nextFcn = @nextPage;
        %PREVFCN callback function on clicking previous
        prevFcn = @previousPage;
        %FINISHWIZARD callback function on finishing wizard
        finishFcn = @finishWizard;
        %hInfoPane
        hInfoPane
    end
    
    methods
        
        function set.Layout(W,Layout)
            %setting data in userdata of layout is required by xregwizard
            set(Layout,'UserData',W);
            W.Layout =  Layout;
        end
        
        function [nextCardID,C] = nextPage(M, ~)
            %NEXTPAGE actions on clicking next
            %
            % [nextCardID,C] = nextPage(M, iFace)
            
            % process any gui actions on completion of page
            updateData(M);
            % function handle to next page in wizard
            nextCardID = getNextPage(M);
            C = M.Data;
        end
        
        function previousPage(M, ~)
            %PREVIOUSPAGE actions on clicking previous
            %
            % previousPage(M, iFace)
            
            % process any gui actions on completion of page
            updateData(M);
        end
        
        function finishWizard(M,~)
            %FINISHWIZARD actions on clicking finish
            %
            % finishWizard(M,iFace)
            
            % process any gui actions on completion of page
            updateData(M);
        end
        
        function MainLyt = addInfoPane(M,fh,Title,InnerLayout)
            M.hInfoPane = mbcgui.container.InfoPane('Parent', fh, ...
                'InfoHeight', 35, ...
                'Title',Title,...
                'Center', InnerLayout);
            MainLyt = xreglayerlayout(fh,'Elements', {M.hInfoPane});

        end
    end
    
    methods (Abstract)
        updatePage(W,Data)
        %UPDATEPAGE update wizard page with wizard data
        updateData(W)
        %UPDATEDATA update wizard data from wizard page
    end
    methods (Abstract,Access=protected)
        layout = createLayout(W,fh,iFace)
        %CREATELAYOUT create main layout for wizard page
        %
        % layout = createLayout(W,fh,iFace)
        %   The wizard page object must be stored in the userdata of the
        %   layout.
    end
    
    methods (Access=protected)
        function f= getNextPage(W)
            %GETNEXTPAGE function handle to next wizard page
            %
            % f= getNextPage(W)
            f = '';
        end
    end
    
    methods (Static,Abstract)
        layout = createPage(varargin)
        %CREATEPAGE static factory function for wizard page
    end
end