No BSD License  

Highlights from
Yet Another Layout Manager

  • resize_example 1. This layout manager is based on MATLAB Central File Exchange entry "Resizable
  • RE_Axis custom axis
  • RE_Box elementary layout building block, positions matrix of elements
  • RE_Button checkboxes/radiobuttons/togglebuttons column
  • RE_Layout Class which defines figure and has many factory methods for ui components
  • RE_Panel custom axis
  • RE_Separator separator with or without label
  • RE_Tabpane tab pane implementation using java element
  • View all files
image thumbnail
from Yet Another Layout Manager by amilcar chaudhary
Easily align gui elements and quickly build resizable gui

RE_Panel
%% custom axis
classdef RE_Panel < RE_Box
    
    properties
        YOffset = 6;
        Title = '';
        Pane = [];
    end

    methods

        % CONSTRUCTOR
        function obj = RE_Panel(pane, varargin)

            obj = obj@RE_Box(); set(obj, varargin{:});
            hui = uipanel('HighlightColor', [.5,.5,.5], 'borderwidth', 1, 'bordertype', 'line');
            if ~isempty(obj.Title), hui(2) = uicontrol('parent', hui, 'string', sprintf( ' %s ', obj.Title ), 'FontWeight', 'bold', 'Fontname', 'verdana', 'fore', 'blue', 'style', 'text', 'hori', 'left'); end
            
            set(obj, 'Pane', pane, 'Element', hui);
            if isempty( pane ), return; end

            set(pane.Children, 'Parent', hui(1));
        end
    end % methods

    methods (Access = protected)

        %% set elements position
        function setPosition(obj)
            
            % uipanel
            pd = obj.Padding;
            pos = obj.Position(:) + [pd(1); pd(2); -pd(1)-pd(3); -pd(2)-pd(4)];
            set(obj.Handle(1), 'Position', pos);

            % pane
            pos([1,2]) = 0;
            pos(4) = pos(4) - obj.YOffset;
            set(obj.Pane, 'Position', pos);

            if length(obj.Handle) == 1, return; end
            
            % separator label
            ext = get(obj.Handle(2), 'extent');
            pos(1) = 10;
            pos(2) = pos(4) + obj.YOffset - floor(ext(4)/2);
            pos(4) = ext(4) - 4;
            pos(3) = ext(3);
            set(obj.Handle(2), 'position', pos);
        end

        %% calculate object extent
        function extent = getExtent(obj)
            pd = obj.Padding;
            extent = obj.Pane.Extent + [pd(1)+pd(3), pd(2)+pd(4)+obj.YOffset];
        end
    end % methods
end % classdef

Contact us at files@mathworks.com