Code covered by the BSD License  

Highlights from
Graphical Wrappers

from Graphical Wrappers by Benoit Charles
Wrappers improve Matlab graphical components.

AxesWrapper
% AXESWRAPPER is an object wrappering an axes.
%
%	The internal axes handle can be access by the property haxes.
%
%	The properties Title, XLabel, YLabel or ZLabel can be directly strings.
%
%	The callbacks are replaced by events:
%		ButtonDownFcn	->	ButtonDownEvent
%		DeleteFcn		->	DeleteEvent
% 
%	See also: GraphicalHandleWrapper.
%

classdef AxesWrapper < GraphicalHandleWrapper
	
	%% Axes handle
	
	properties( Dependent, SetAccess = private )
		haxes
	end
	
	methods
		
		function hc = get.haxes( this )
			hc = this.internalHandle;
		end
		
	end
	
	%% Public fields
	
	properties( Dependent, SetObservable, GetObservable )
		ActivePositionProperty
		ALim
		ALimMode
		AmbientLightColor
		Box
		CameraPosition
		CameraPositionMode
		CameraTarget
		CameraTargetMode
		CameraUpVector
		CameraUpVectorMode
		CameraViewAngle
		CameraViewAngleMode
		CLim
		CLimMode
		Color
		CurrentPoint
		ColorOrder
		DataAspectRatio
		DataAspectRatioMode
		DrawMode
		FontAngle
		FontName
		FontSize
		FontUnits
		FontWeight
		GridLineStyle
		Layer
		LineStyleOrder
		LineWidth
		MinorGridLineStyle
		NextPlot
		OuterPosition
		PlotBoxAspectRatio
		PlotBoxAspectRatioMode
		Projection
		Position
		TickLength
		TickDir
		TickDirMode
		TightInset
		Title
		Units
		View
		XColor
		XDir
		XGrid
		XLabel
		XAxisLocation
		XLim
		XLimMode
		XMinorGrid
		XMinorTick
		XScale
		XTick
		XTickLabel
		XTickLabelMode
		XTickMode
		YColor
		YDir
		YGrid
		YLabel
		YAxisLocation
		YLim
		YLimMode
		YMinorGrid
		YMinorTick
		YScale
		YTick
		YTickLabel
		YTickLabelMode
		YTickMode
		ZColor
		ZDir
		ZGrid
		ZLabel
		ZLim
		ZLimMode
		ZMinorGrid
		ZMinorTick
		ZScale
		ZTick
		ZTickLabel
		ZTickLabelMode
		ZTickMode
		
		BeingDeleted
		Children
		Clipping
		BusyAction
		HandleVisibility
		HitTest
		Interruptible
		Parent
		Selected
		SelectionHighlight
		Tag
		Type
		UIContextMenu
		UserData
		Visible
	end
	
	%% Get / Set
	
	methods
		
		% ActivePositionProperty
		function set.ActivePositionProperty( this, val )
			this.set( 'ActivePositionProperty', val );
		end
		function val = get.ActivePositionProperty( this )
			val = this.get( 'ActivePositionProperty' );
		end
		
		% ALim
		function set.ALim( this, val )
			this.set( 'ALim', val );
		end
		function val = get.ALim( this )
			val = this.get( 'ALim' );
		end
		
		% ALimMode
		function set.ALimMode( this, val )
			this.set( 'ALimMode', val );
		end
		function val = get.ALimMode( this )
			val = this.get( 'ALimMode' );
		end
		
		% AmbientLightColor
		function set.AmbientLightColor( this, val )
			this.set( 'AmbientLightColor', val );
		end
		function val = get.AmbientLightColor( this )
			val = this.get( 'AmbientLightColor' );
		end
		
		% Box
		function set.Box( this, val )
			this.set( 'Box', val );
		end
		function val = get.Box( this )
			val = this.get( 'Box' );
		end
		
		% CameraPosition
		function set.CameraPosition( this, val )
			this.set( 'CameraPosition', val );
		end
		function val = get.CameraPosition( this )
			val = this.get( 'CameraPosition' );
		end
		
		% CameraPositionMode
		function set.CameraPositionMode( this, val )
			this.set( 'CameraPositionMode', val );
		end
		function val = get.CameraPositionMode( this )
			val = this.get( 'CameraPositionMode' );
		end
		
		% CameraTarget
		function set.CameraTarget( this, val )
			this.set( 'CameraTarget', val );
		end
		function val = get.CameraTarget( this )
			val = this.get( 'CameraTarget' );
		end
		
		% CameraTargetMode
		function set.CameraTargetMode( this, val )
			this.set( 'CameraTargetMode', val );
		end
		function val = get.CameraTargetMode( this )
			val = this.get( 'CameraTargetMode' );
		end
		
		% CameraUpVector
		function set.CameraUpVector( this, val )
			this.set( 'CameraUpVector', val );
		end
		function val = get.CameraUpVector( this )
			val = this.get( 'CameraUpVector' );
		end
		
		% CameraUpVectorMode
		function set.CameraUpVectorMode( this, val )
			this.set( 'CameraUpVectorMode', val );
		end
		function val = get.CameraUpVectorMode( this )
			val = this.get( 'CameraUpVectorMode' );
		end
		
		% CameraViewAngle
		function set.CameraViewAngle( this, val )
			this.set( 'CameraViewAngle', val );
		end
		function val = get.CameraViewAngle( this )
			val = this.get( 'CameraViewAngle' );
		end
		
		% CameraViewAngleMode
		function set.CameraViewAngleMode( this, val )
			this.set( 'CameraViewAngleMode', val );
		end
		function val = get.CameraViewAngleMode( this )
			val = this.get( 'CameraViewAngleMode' );
		end
		
		% CLim
		function set.CLim( this, val )
			this.set( 'CLim', val );
		end
		function val = get.CLim( this )
			val = this.get( 'CLim' );
		end
		
		% CLimMode
		function set.CLimMode( this, val )
			this.set( 'CLimMode', val );
		end
		function val = get.CLimMode( this )
			val = this.get( 'CLimMode' );
		end
		
		% Color
		function set.Color( this, val )
			this.set( 'Color', val );
		end
		function val = get.Color( this )
			val = this.get( 'Color' );
		end
		
		% CurrentPoint
		function set.CurrentPoint( this, val )
			this.set( 'CurrentPoint', val );
		end
		function val = get.CurrentPoint( this )
			val = this.get( 'CurrentPoint' );
		end
		
		% ColorOrder
		function set.ColorOrder( this, val )
			this.set( 'ColorOrder', val );
		end
		function val = get.ColorOrder( this )
			val = this.get( 'ColorOrder' );
		end
		
		% DataAspectRatio
		function set.DataAspectRatio( this, val )
			this.set( 'DataAspectRatio', val );
		end
		function val = get.DataAspectRatio( this )
			val = this.get( 'DataAspectRatio' );
		end
		
		% DataAspectRatioMode
		function set.DataAspectRatioMode( this, val )
			this.set( 'DataAspectRatioMode', val );
		end
		function val = get.DataAspectRatioMode( this )
			val = this.get( 'DataAspectRatioMode' );
		end
		
		% DrawMode
		function set.DrawMode( this, val )
			this.set( 'DrawMode', val );
		end
		function val = get.DrawMode( this )
			val = this.get( 'DrawMode' );
		end
		
		% FontAngle
		function set.FontAngle( this, val )
			this.set( 'FontAngle', val );
		end
		function val = get.FontAngle( this )
			val = this.get( 'FontAngle' );
		end
		
		% FontName
		function set.FontName( this, val )
			this.set( 'FontName', val );
		end
		function val = get.FontName( this )
			val = this.get( 'FontName' );
		end
		
		% FontSize
		function set.FontSize( this, val )
			this.set( 'FontSize', val );
		end
		function val = get.FontSize( this )
			val = this.get( 'FontSize' );
		end
		
		% FontUnits
		function set.FontUnits( this, val )
			this.set( 'FontUnits', val );
		end
		function val = get.FontUnits( this )
			val = this.get( 'FontUnits' );
		end
		
		% FontWeight
		function set.FontWeight( this, val )
			this.set( 'FontWeight', val );
		end
		function val = get.FontWeight( this )
			val = this.get( 'FontWeight' );
		end
		
		% GridLineStyle
		function set.GridLineStyle( this, val )
			this.set( 'GridLineStyle', val );
		end
		function val = get.GridLineStyle( this )
			val = this.get( 'GridLineStyle' );
		end
		
		% Layer
		function set.Layer( this, val )
			this.set( 'Layer', val );
		end
		function val = get.Layer( this )
			val = this.get( 'Layer' );
		end
		
		% LineStyleOrder
		function set.LineStyleOrder( this, val )
			this.set( 'LineStyleOrder', val );
		end
		function val = get.LineStyleOrder( this )
			val = this.get( 'LineStyleOrder' );
		end
		
		% LineWidth
		function set.LineWidth( this, val )
			this.set( 'LineWidth', val );
		end
		function val = get.LineWidth( this )
			val = this.get( 'LineWidth' );
		end
		
		% MinorGridLineStyle
		function set.MinorGridLineStyle( this, val )
			this.set( 'MinorGridLineStyle', val );
		end
		function val = get.MinorGridLineStyle( this )
			val = this.get( 'MinorGridLineStyle' );
		end
		
		% NextPlot
		function set.NextPlot( this, val )
			this.set( 'NextPlot', val );
		end
		function val = get.NextPlot( this )
			val = this.get( 'NextPlot' );
		end
		
		% OuterPosition
		function set.OuterPosition( this, val )
			this.set( 'OuterPosition', val );
		end
		function val = get.OuterPosition( this )
			val = this.get( 'OuterPosition' );
		end
		
		% PlotBoxAspectRatio
		function set.PlotBoxAspectRatio( this, val )
			this.set( 'PlotBoxAspectRatio', val );
		end
		function val = get.PlotBoxAspectRatio( this )
			val = this.get( 'PlotBoxAspectRatio' );
		end
		
		% PlotBoxAspectRatioMode
		function set.PlotBoxAspectRatioMode( this, val )
			this.set( 'PlotBoxAspectRatioMode', val );
		end
		function val = get.PlotBoxAspectRatioMode( this )
			val = this.get( 'PlotBoxAspectRatioMode' );
		end
		
		% Projection
		function set.Projection( this, val )
			this.set( 'Projection', val );
		end
		function val = get.Projection( this )
			val = this.get( 'Projection' );
		end
		
		% Position
		function set.Position( this, val )
			this.set( 'Position', val );
		end
		function val = get.Position( this )
			val = this.get( 'Position' );
		end
		
		% TickLength
		function set.TickLength( this, val )
			this.set( 'TickLength', val );
		end
		function val = get.TickLength( this )
			val = this.get( 'TickLength' );
		end
		
		% TickDir
		function set.TickDir( this, val )
			this.set( 'TickDir', val );
		end
		function val = get.TickDir( this )
			val = this.get( 'TickDir' );
		end
		
		% TickDirMode
		function set.TickDirMode( this, val )
			this.set( 'TickDirMode', val );
		end
		function val = get.TickDirMode( this )
			val = this.get( 'TickDirMode' );
		end
		
		% TightInset
		function set.TightInset( this, val )
			this.set( 'TightInset', val );
		end
		function val = get.TightInset( this )
			val = this.get( 'TightInset' );
		end
		
		% Title
		function set.Title( this, val )
			this.set( 'Title', val );
		end
		function val = get.Title( this )
			val = this.get( 'Title' );
		end
		
		% Units
		function set.Units( this, val )
			this.set( 'Units', val );
		end
		function val = get.Units( this )
			val = this.get( 'Units' );
		end
		
		% View
		function set.View( this, val )
			this.set( 'View', val );
		end
		function val = get.View( this )
			val = this.get( 'View' );
		end
		
		% XColor
		function set.XColor( this, val )
			this.set( 'XColor', val );
		end
		function val = get.XColor( this )
			val = this.get( 'XColor' );
		end
		
		% XDir
		function set.XDir( this, val )
			this.set( 'XDir', val );
		end
		function val = get.XDir( this )
			val = this.get( 'XDir' );
		end
		
		% XGrid
		function set.XGrid( this, val )
			this.set( 'XGrid', val );
		end
		function val = get.XGrid( this )
			val = this.get( 'XGrid' );
		end
		
		% XLabel
		function set.XLabel( this, val )
			this.set( 'XLabel', val );
		end
		function val = get.XLabel( this )
			val = this.get( 'XLabel' );
		end
		
		% XAxisLocation
		function set.XAxisLocation( this, val )
			this.set( 'XAxisLocation', val );
		end
		function val = get.XAxisLocation( this )
			val = this.get( 'XAxisLocation' );
		end
		
		% XLim
		function set.XLim( this, val )
			this.set( 'XLim', val );
		end
		function val = get.XLim( this )
			val = this.get( 'XLim' );
		end
		
		% XLimMode
		function set.XLimMode( this, val )
			this.set( 'XLimMode', val );
		end
		function val = get.XLimMode( this )
			val = this.get( 'XLimMode' );
		end
		
		% XMinorGrid
		function set.XMinorGrid( this, val )
			this.set( 'XMinorGrid', val );
		end
		function val = get.XMinorGrid( this )
			val = this.get( 'XMinorGrid' );
		end
		
		% XMinorTick
		function set.XMinorTick( this, val )
			this.set( 'XMinorTick', val );
		end
		function val = get.XMinorTick( this )
			val = this.get( 'XMinorTick' );
		end
		
		% XScale
		function set.XScale( this, val )
			this.set( 'XScale', val );
		end
		function val = get.XScale( this )
			val = this.get( 'XScale' );
		end
		
		% XTick
		function set.XTick( this, val )
			this.set( 'XTick', val );
		end
		function val = get.XTick( this )
			val = this.get( 'XTick' );
		end
		
		% XTickLabel
		function set.XTickLabel( this, val )
			this.set( 'XTickLabel', val );
		end
		function val = get.XTickLabel( this )
			val = this.get( 'XTickLabel' );
		end
		
		% XTickLabelMode
		function set.XTickLabelMode( this, val )
			this.set( 'XTickLabelMode', val );
		end
		function val = get.XTickLabelMode( this )
			val = this.get( 'XTickLabelMode' );
		end
		
		% XTickMode
		function set.XTickMode( this, val )
			this.set( 'XTickMode', val );
		end
		function val = get.XTickMode( this )
			val = this.get( 'XTickMode' );
		end
		
		% YColor
		function set.YColor( this, val )
			this.set( 'YColor', val );
		end
		function val = get.YColor( this )
			val = this.get( 'YColor' );
		end
		
		% YDir
		function set.YDir( this, val )
			this.set( 'YDir', val );
		end
		function val = get.YDir( this )
			val = this.get( 'YDir' );
		end
		
		% YGrid
		function set.YGrid( this, val )
			this.set( 'YGrid', val );
		end
		function val = get.YGrid( this )
			val = this.get( 'YGrid' );
		end
		
		% YLabel
		function set.YLabel( this, val )
			this.set( 'YLabel', val );
		end
		function val = get.YLabel( this )
			val = this.get( 'YLabel' );
		end
		
		% YAxisLocation
		function set.YAxisLocation( this, val )
			this.set( 'YAxisLocation', val );
		end
		function val = get.YAxisLocation( this )
			val = this.get( 'YAxisLocation' );
		end
		
		% YLim
		function set.YLim( this, val )
			this.set( 'YLim', val );
		end
		function val = get.YLim( this )
			val = this.get( 'YLim' );
		end
		
		% YLimMode
		function set.YLimMode( this, val )
			this.set( 'YLimMode', val );
		end
		function val = get.YLimMode( this )
			val = this.get( 'YLimMode' );
		end
		
		% YMinorGrid
		function set.YMinorGrid( this, val )
			this.set( 'YMinorGrid', val );
		end
		function val = get.YMinorGrid( this )
			val = this.get( 'YMinorGrid' );
		end
		
		% YMinorTick
		function set.YMinorTick( this, val )
			this.set( 'YMinorTick', val );
		end
		function val = get.YMinorTick( this )
			val = this.get( 'YMinorTick' );
		end
		
		% YScale
		function set.YScale( this, val )
			this.set( 'YScale', val );
		end
		function val = get.YScale( this )
			val = this.get( 'YScale' );
		end
		
		% YTick
		function set.YTick( this, val )
			this.set( 'YTick', val );
		end
		function val = get.YTick( this )
			val = this.get( 'YTick' );
		end
		
		% YTickLabel
		function set.YTickLabel( this, val )
			this.set( 'YTickLabel', val );
		end
		function val = get.YTickLabel( this )
			val = this.get( 'YTickLabel' );
		end
		
		% YTickLabelMode
		function set.YTickLabelMode( this, val )
			this.set( 'YTickLabelMode', val );
		end
		function val = get.YTickLabelMode( this )
			val = this.get( 'YTickLabelMode' );
		end
		
		% YTickMode
		function set.YTickMode( this, val )
			this.set( 'YTickMode', val );
		end
		function val = get.YTickMode( this )
			val = this.get( 'YTickMode' );
		end
		
		% ZColor
		function set.ZColor( this, val )
			this.set( 'ZColor', val );
		end
		function val = get.ZColor( this )
			val = this.get( 'ZColor' );
		end
		
		% ZDir
		function set.ZDir( this, val )
			this.set( 'ZDir', val );
		end
		function val = get.ZDir( this )
			val = this.get( 'ZDir' );
		end
		
		% ZGrid
		function set.ZGrid( this, val )
			this.set( 'ZGrid', val );
		end
		function val = get.ZGrid( this )
			val = this.get( 'ZGrid' );
		end
		
		% ZLabel
		function set.ZLabel( this, val )
			this.set( 'ZLabel', val );
		end
		function val = get.ZLabel( this )
			val = this.get( 'ZLabel' );
		end
		
		% ZLim
		function set.ZLim( this, val )
			this.set( 'ZLim', val );
		end
		function val = get.ZLim( this )
			val = this.get( 'ZLim' );
		end
		
		% ZLimMode
		function set.ZLimMode( this, val )
			this.set( 'ZLimMode', val );
		end
		function val = get.ZLimMode( this )
			val = this.get( 'ZLimMode' );
		end
		
		% ZMinorGrid
		function set.ZMinorGrid( this, val )
			this.set( 'ZMinorGrid', val );
		end
		function val = get.ZMinorGrid( this )
			val = this.get( 'ZMinorGrid' );
		end
		
		% ZMinorTick
		function set.ZMinorTick( this, val )
			this.set( 'ZMinorTick', val );
		end
		function val = get.ZMinorTick( this )
			val = this.get( 'ZMinorTick' );
		end
		
		% ZScale
		function set.ZScale( this, val )
			this.set( 'ZScale', val );
		end
		function val = get.ZScale( this )
			val = this.get( 'ZScale' );
		end
		
		% ZTick
		function set.ZTick( this, val )
			this.set( 'ZTick', val );
		end
		function val = get.ZTick( this )
			val = this.get( 'ZTick' );
		end
		
		% ZTickLabel
		function set.ZTickLabel( this, val )
			this.set( 'ZTickLabel', val );
		end
		function val = get.ZTickLabel( this )
			val = this.get( 'ZTickLabel' );
		end
		
		% ZTickLabelMode
		function set.ZTickLabelMode( this, val )
			this.set( 'ZTickLabelMode', val );
		end
		function val = get.ZTickLabelMode( this )
			val = this.get( 'ZTickLabelMode' );
		end
		
		% ZTickMode
		function set.ZTickMode( this, val )
			this.set( 'ZTickMode', val );
		end
		function val = get.ZTickMode( this )
			val = this.get( 'ZTickMode' );
		end
		
		% BeingDeleted
		function set.BeingDeleted( this, val )
			this.set( 'BeingDeleted', val );
		end
		function val = get.BeingDeleted( this )
			val = this.get( 'BeingDeleted' );
		end
		
		% Children
		function set.Children( this, val )
			this.set( 'Children', val );
		end
		function val = get.Children( this )
			val = this.get( 'Children' );
		end
		
		% Clipping
		function set.Clipping( this, val )
			this.set( 'Clipping', val );
		end
		function val = get.Clipping( this )
			val = this.get( 'Clipping' );
		end
		
		% BusyAction
		function set.BusyAction( this, val )
			this.set( 'BusyAction', val );
		end
		function val = get.BusyAction( this )
			val = this.get( 'BusyAction' );
		end
		
		% HandleVisibility
		function set.HandleVisibility( this, val )
			this.set( 'HandleVisibility', val );
		end
		function val = get.HandleVisibility( this )
			val = this.get( 'HandleVisibility' );
		end
		
		% HitTest
		function set.HitTest( this, val )
			this.set( 'HitTest', val );
		end
		function val = get.HitTest( this )
			val = this.get( 'HitTest' );
		end
		
		% Interruptible
		function set.Interruptible( this, val )
			this.set( 'Interruptible', val );
		end
		function val = get.Interruptible( this )
			val = this.get( 'Interruptible' );
		end
		
		% Parent
		function set.Parent( this, val )
			this.set( 'Parent', val );
		end
		function val = get.Parent( this )
			val = this.get( 'Parent' );
		end
		
		% Selected
		function set.Selected( this, val )
			this.set( 'Selected', val );
		end
		function val = get.Selected( this )
			val = this.get( 'Selected' );
		end
		
		% SelectionHighlight
		function set.SelectionHighlight( this, val )
			this.set( 'SelectionHighlight', val );
		end
		function val = get.SelectionHighlight( this )
			val = this.get( 'SelectionHighlight' );
		end
		
		% Tag
		function set.Tag( this, val )
			this.set( 'Tag', val );
		end
		function val = get.Tag( this )
			val = this.get( 'Tag' );
		end
		
		% Type
		function set.Type( this, val )
			this.set( 'Type', val );
		end
		function val = get.Type( this )
			val = this.get( 'Type' );
		end
		
		% UIContextMenu
		function set.UIContextMenu( this, val )
			this.set( 'UIContextMenu', val );
		end
		function val = get.UIContextMenu( this )
			val = this.get( 'UIContextMenu' );
		end
		
		% UserData
		function set.UserData( this, val )
			this.set( 'UserData', val );
		end
		function val = get.UserData( this )
			val = this.get( 'UserData' );
		end
		
		% Visible
		function set.Visible( this, val )
			this.set( 'Visible', val );
		end
		function val = get.Visible( this )
			val = this.get( 'Visible' );
		end
		
	end
	
	%% Events
	
	events
		ButtonDownEvent
		DeleteEvent
	end
	
	methods
		
		function ButtonDownFcn( this, EVENT )
			notify( this, 'ButtonDownEvent', WrapperEvent( EVENT ) );
		end
		
		function DeleteFcn( this, EVENT )
			notify( this, 'DeleteEvent', WrapperEvent( EVENT ) );
			if isvalid( this )
				delete( this );
			end
		end
		
	end
	
	%% Constructor
	
	methods
		
		function this = AxesWrapper( varargin )
			
			this.createInternalHandle( ...
				varargin, ...
				'axes', ...
				@(varargin)axes( varargin{:} ), ...
				'ButtonDownFcn', @(HANDLE, EVENT) this.ButtonDownFcn( EVENT ), ...
				'DeleteFcn', @(HANDLE, EVENT) this.DeleteFcn( EVENT ) );
			
		end
		
	end
	
	%% Internal set
	
	methods( Access = protected )
		
		function finalSet( this, varargin )
			
			handles = this.internalHandle;
			props = reshape( varargin, 2, [] );
			
			preset( 'Parent', @double );
			preset( 'Title', @cast2text );
			preset( 'XLabel', @cast2text );
			preset( 'YLabel', @cast2text );
			preset( 'ZLabel', @cast2text );
			
			set( handles, props{:} );
			
			function preset( name, func )
				index = strcmpi( props(1,:), name );
				if any( index )
					for ii = find( index )
						props{2,ii} = func( props{2,ii} );
					end
				end
			end
			
			function value = cast2text( value )
				
				if isempty( value ) && ~iscell( value )
					value = text( 'String', '', 'Parent', handles{1} );
				elseif numel( value ) == 1 && ishandle( value ) && strcmp( get( value, 'Type' ), 'text' )
					set( value, 'Parent', handles{1} );
				elseif ischar( value ) || ( iscell(value) && all( cellfun( @ischar, value ) ) )
					value = text( 'String', value, 'Parent', handles{1} );
				end
				
			end
			
		end
		
	end
	
end

Contact us