www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@toGVRowHeader/pSwitchDisplay.m

    function pSwitchDisplay(obj)
%PSWITCHDISPLAY Private method that effects the switching from axis<->label
%
%  PSWITCHDISPLAY(OBJ) changes the object between its two different looks:
%  using and axis or just using a label.

%  Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc.


grid = get(obj.hBorder, 'LayoutComponent');
if obj.ShowAxis
    if isempty(obj.hSharedAxis) || ~ishandle(obj.hSharedAxis)
        % Destroy label
        if ~isempty(obj.hLabel)
            delete(obj.hLabel);
            obj.hLabel = [];
        end
        
        % Create the axis
        obj.hSharedAxis = xregGui.axisslider(...
            'parent', obj.hBorder, ...
            'orientation', 'vertical');
        
        el = get(grid, 'elements');
        el{3} = obj.hSharedAxis;
        cs = get(grid, 'colsizes');
        cs(2) = 45;
        set(grid, 'colsizes', cs, 'elements', el);
    end
else
    if isempty(obj.hLabel)
        if ~isempty(obj.hSharedAxis) && ishandle(obj.hSharedAxis)
            delete(obj.hSharedAxis);
            obj.hSharedAxis = [];
        end
        
        obj.hLabel = axestext(obj.hBorder, ...
            'Rotation', 90, ...
            'HorizontalAlignment', 'center', ...
            'VerticalAlignment', 'middle');
        
        el = get(grid, 'elements');
        el{3} = obj.hLabel;
        cs = get(grid, 'colsizes');
        cs(2) = 15;
        set(grid, 'colsizes', cs, 'elements', el);
    end
end