%% separator with or without label
classdef RE_Separator < RE_Box
properties
Title = '';
end
methods
% CONSTRUCTOR
function obj = RE_Separator(varargin)
obj = obj@RE_Box(); set(obj, varargin{:});
hui(1) = uipanel;
if ~isempty(obj.Title), hui(2) = uicontrol('string', obj.Title, 'FontWeight', 'bold', 'Fontname', 'verdana', 'fore', 'blue', 'style', 'text', 'hori', 'left'); end
set(obj, 'Element', hui);
end
end % methods
methods (Access = protected)
%% set elements position
function setPosition(obj)
% separator line
pos = obj.Position + [obj.Padding(1), 0, -obj.Padding(1)-obj.Padding(3), 0];
pos(2) = pos(2) + floor(pos(4)/3) - 4;
pos(4) = 2;
set(obj.Handle(1), 'position', pos);
if length(obj.Handle) == 1, return; end
% separator label
ext = get(obj.Handle(2), 'extent');
pos(2) = pos(2) - floor(ext(4)/2) + 4;
pos(4) = ext(4) - 4;
pos(3) = ext(3);
set(obj.Handle(2), 'position', pos);
end
end % methods
end % classdef