www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/+mbcmodelview/ModelViewer.m
classdef ModelViewer < mbcgui.multiview.View %ModelViewer properties (Constant) ViewInfo= { @mbcmodelview.ModelViewer; 'Model &Definition'; xregrespath('viewCube.bmp'); 'Model definition'; 1}; end properties (SetAccess=private) hModelPane end methods function obj = ModelViewer(varargin) obj@mbcgui.multiview.View(varargin{:}); create(obj) update(obj) addMessageServiceListener(obj, 'NodeUpdated',@obj.onNodeUpdated) end function update(obj) if obj.MessageService.Status obj.hModelPane.Model = obj.MessageService.Model; else obj.hModelPane.Model = []; end end function ah = printCopy(obj, fig) %PRINTCOPY Create a printable version of the component % NEWOBJ = PRINTCOPY(H, FIG) creates and returns a handle to a new % component, NEWOBJ, parented by the specified figure, FIG. The new % object will be used for printing a copy of this component. % % Normally the printable version of a component is not a complete % copy of the object. There are often controls that should not % appear, such as popup menus, or components whose information needs % to be transformed, such as edit boxes. % % See also canPrint, print, printSize. ah = printcopy(obj.hModelPane,fig); end function OK = canPrint(obj) OK = true; end function t = gettitle(obj) t = 'Model Definition'; end end methods (Access=private) function onNodeUpdated(obj,~,~) update(obj) end function create(obj) obj.hModelPane = xregMdlGui.modelpane('parent',obj.Parent); obj.ContentHandle = obj.hModelPane; end end end