www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@viewcontainer/viewcontainer.m
function h = viewcontainer(varargin) %VIEWCONTAINER Constructor for viewcontainer object % % OBJ = VIEWCONTAINER(PROP, VALUE, ...) constructs a new viewcontainer % object instance. % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin && isa(varargin{1}, 'xregGui.viewcontainer') h = varargin{1}; varargin(1) = []; else h = xregGui.viewcontainer; end if ~isempty(varargin) h.abstractcomponent(varargin{:}); else h.abstractcomponent; end % Create ui objects FrameProps = h.pGetFrameProperties; h.Panel = mbcgui.container.titlebarpanel(... 'Parent', h.Parent, ... 'Visible', h.Visible, ... 'Position', h.Position, ... 'UIContextMenu', h.UIContextMenu,... 'ButtonDownFcn', {@i_BGbuttondown, h}, ... 'BackgroundColor', h.Backgroundcolor, ... 'FocusAppearance', h.selected, ... FrameProps{:}); if ~isempty(h.Center) h.pSetCenter; end h.addPropertyListeners({ ... 'Center'; ... 'UIContextMenu'; ... 'Selected'; ... 'BackgroundColor'; ... }, ... { ... @i_setcenter; ... {@i_setuic, h.Panel}; ... {@i_setselected, h.Panel}; ... {@i_setbgcol, h.Panel}; ... }); function i_BGbuttondown(~, evt, obj) % Send ButtonDown event and fire callback send(obj, 'ButtonDown', handle.EventData(obj, 'ButtonDown')); xregcallback(obj.ButtonDownFcn, obj, evt); function i_setcenter(~, evt) evt.AffectedObject.pSetCenter; function i_setuic(~, evt, pH) set(pH, 'UIContextMenu', evt.NewValue); function i_setselected(~, evt, fH) set(fH, 'FocusAppearance', evt.NewValue); function i_setbgcol(~, evt, pH) set(pH, 'BackgroundColor', evt.NewValue);