function h_actionbtn = render_actionbtn(hFig,h_adjFrame)
% RENDER_ACTIONBTN Renders the frame and action button.
%
% Input:
%   hFig       - handle to fdatool's figure.
%   h_adjFrame - handle to adjacent frame (Filter Order frame).
% 
% Output:
%   h_actionbtn - handles to the action button and frame.

%   Author(s): P. Pacheco
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.3 $  $Date: 2000/06/13 21:23:21 $ 

% Cache figure's position.
figPos = get(hFig,'Position');

% Uicontrol sizes and spaces.
sz = gui_sizes;

% Render frame. 
adjFrPos = get(h_adjFrame,'Position');
x = sz.ffs;
w = figPos(3)-2*sz.ffs;
h = sz.bh;
y = adjFrPos(2)-(sz.uh+sz.ffs);
bgColor = get(hFig,'Color'); %[1 1 1]*.75;
% framewlabel returns a two element vector containing 
% the handles to the frame and its label.
h_frame = framewlabel(hFig,[x y w h],'','actionbtn',bgColor);
set(h_frame(1),'ForegroundColor',bgColor,'visible','off');%[1 1 1]*.6);

% Render button... return handle to the button.
h_btn = action_btn(h_frame);

h_actionbtn.frame = h_frame;
h_actionbtn.btn = h_btn;

%----------------------------------------------------------------------
function h_btn = action_btn(h_frame)

% Cache frame position
frPos = get(h_frame,'Position');

% Uicontrol sizes and spaces.
sz = gui_sizes;

% Determine the largest UI extend based on all possible strings.
btnStrs = {'Design Filter','Import Filter','Apply'};
tagStrs = {'design_params','import_params','quantize_params'};
uiWidth = largestuiwidth(btnStrs)+10*sz.pixf;

% Properties common to all buttons.
btnProps = {'Style','pushbutton','Tag','actionbtn'};

pos = [(frPos(3)-uiWidth)/2 frPos(2) uiWidth sz.bh];
for btns = 1:length(btnStrs),
    h_btn(btns) = uicontrol(btnProps{:},...
        'Position',pos,...
        'String',btnStrs{btns},...
        'Tag',tagStrs{btns},...
        'Callback',@actionbtns_cbs);
end

% [EOF] render_actionbtn.m
