www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@axisslider/axisslider.m

    function h = axisslider( varargin)
%AXISSLIDER Constructor for axisslider object
%
%  H = AXISSLIDER(prop1, val1 ,...)
%
% e.g.
% h = xregGui.axisslider('min',0,'max',10,'Orientation','horizontal',...
%                        'DragMode','on','MajorTicks',[1 3 5 7 9],...
%                        'Position',[30 100 200 15],...
%                        'String','Hello','MarkerSize',15)

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


h = xregGui.axisslider;
if nargin
    set(h, varargin{:});
end

if isempty(h.Parent)
    h.Parent=gcf;
end

% Create HG objects
lims = [h.Min h.Max];
h.Axes = axes('Parent', h.Parent, ...
    'HitTest', 'off', ...
    'Visible', 'off', ...
    'Color', 'none', ...
    'XColor', h.AxisColor, ...
    'YColor', h.AxisColor, ...
    'TickDir', 'out', ...
    'Units', 'pixels', ...
    'FontSize', 8, ...
    'XLim', lims, ...
    'YLim', lims);
LabelSettings = {'Interpreter', 'none', 'HitTest', 'off'};
if h.Selected
    LabelSettings = [LabelSettings, {'FontWeight', 'bold'}];
    set(h.Axes, 'LineWidth', 1.5, 'FontWeight', 'bold');
end

mbcxlabel(h.Axes, '', LabelSettings{:});
mbcylabel(h.Axes, '', LabelSettings{:});

h.Marker = patch('Parent', h.Axes, ...
    'HitTest', 'off', ...
    'Clipping','off', ...
    'EdgeColor','none', ...
    'FaceColor', h.MarkerColor);

h.doTickStatus;
h.doPosition;
h.doDrawMarker;
h.doSetDragMode;
h.doString;
h.ASList = [handle.listener(h, h.findprop('Visible'), 'PropertyPostSet', {h.ASCBfcns{1}, h.Axes, h.Marker}); ...
    handle.listener(h, h.findprop('Position'), 'PropertyPostSet', h.ASCBfcns{2}); ...
    handle.listener(h, h.findprop('MajorTicks'), 'PropertyPostSet', h.ASCBfcns{3}); ...
    handle.listener(h, h.findprop('MinorTicks'), 'PropertyPostSet', h.ASCBfcns{3}); ...
    handle.listener(h, h.findprop('TickLabels'), 'PropertyPostSet', h.ASCBfcns{3}); ...
    handle.listener(h, h.findprop('AxisColor'), 'PropertyPostSet', {h.ASCBfcns{4}, h.Axes}); ...
    handle.listener(h, h.findprop('MarkerColor'), 'PropertyPostSet', {h.ASCBfcns{5}, h.Marker}); ...
    handle.listener(h, h.findprop('Orientation'), 'PropertyPostSet', {h.ASCBfcns{6}, h.Axes}); ...
    handle.listener(h, h.findprop('Parent'), 'PropertyPostSet', {h.ASCBfcns{7}, h.Axes}); ...
    handle.listener(h, h.findprop('Min'), 'PropertyPostSet', {h.ASCBfcns{8}, h.Axes}); ...
    handle.listener(h, h.findprop('Max'), 'PropertyPostSet', {h.ASCBfcns{8}, h.Axes}); ...
    handle.listener(h, h.findprop('Value'), 'PropertyPostSet', h.ASCBfcns{9}); ...
    handle.listener(h, 'ObjectBeingDestroyed', {h.ASCBfcns{10}, h.Axes}); ...
    handle.listener(h, h.findprop('String'), 'PropertyPostSet', {h.ASCBfcns{11}, h.Axes}); ...
    handle.listener(h, h.findprop('Selected'), 'PropertyPostSet', {h.ASCBfcns{12}, h.Axes}); ...
    handle.listener(h, h.findprop('DragMode'), 'PropertyPostSet', h.ASCBfcns{13}); ...
    handle.listener(h, h.findprop('MarkerSize'), 'PropertyPostSet', h.ASCBfcns{14}); ...
    ];

h.connect(xregfigurehook(h.Parent),'up');

set(h.Axes, 'Visible', h.Visible);