No BSD License  

Highlights from
Source code (M-files) for Graphic User Object (GUO) Toolbox

image thumbnail

Source code (M-files) for Graphic User Object (GUO) Toolbox

by

 

15 Sep 2005 (Updated )

Programming tool for creating reusable Graphic User Interface (GUI) components.

PlaybackButtons(varargin);
function PB = PlaybackButtons(varargin);

% function PB = PlaybackButtons(varargin);
% 
% Class constructor for PlaybackButtons (inherited from graphicuserobject).
% Creates 4 PushButton objects with Tags:  First, Previous, Next and Last.
% See the graphicuserobject class constructor for a description
% of the argument list varargin.
%
% Copyright (c) SINUS Messtechnik GmbH 2002
% www.sinusmess.de - Sound & Vibration Instrumentation
%                  - PCB Services
%                  - Electronic Design & Production

if nargin == 1 & isa(varargin(1), 'PlaybackButtons')
   T = varargin(1);
else  
   GUO = graphicuserobject(varargin{:});
   PB = class(struct([]), 'PlaybackButtons', GUO);
   Arrow =  [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1; ...
             1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1; ...
             1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1; ...
             1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1; ...
             1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1; ...
             1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1; ...
             1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1; ...
             1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1; ...
             1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1; ...
             1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1; ...
             1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1; ...
             1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1; ...
             1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1; ...
             1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1; ...
             1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1];
   EndBar = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1; ...
             1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1];
   BackColour = get(PB, 'Color');
   if ischar(BackColour) & strcmpi(BackColour, 'none')
      BackColour = get(get(PB, 'Parent'), 'Color');
   end
   BC1 = BackColour(1); BC2 = BackColour(2); BC3 = BackColour(3);
   Arrow3 = cat(3, BC1*Arrow, BC2*Arrow, BC3*Arrow);
   EndBar3 = cat(3, EndBar, EndBar, EndBar);
   ArrowBar3 = Arrow3 .* EndBar3;
   PB = uicontrol(PB, 'Style', 'pushbutton', 'Tag', 'First', ...
                  'Position', [0 0 0.25 1], 'CData', ArrowBar3);
   PB = uicontrol(PB, 'Style', 'pushbutton', 'Tag', 'Previous', ...
                  'Position', [0.25 0 0.25 1], 'CData', Arrow3);
   PB = uicontrol(PB, 'Style', 'pushbutton', 'Tag', 'Next', ...
                  'Position', [0.5 0 0.25 1], 'CData', flipdim(Arrow3,2));
   PB = uicontrol(PB, 'Style', 'pushbutton', 'Tag', 'Last', ...
                  'Position', [0.75 0 0.25 1], 'CData', flipdim(ArrowBar3,2));
end

Contact us