User`s guide

Color Palette
Just before returning, colorPalette assigns mOutputArgs the function
handle for its
getSelectedColor helper function and then assigns
mOutputArgs to varargout to return the arguments.
% Return user defined output i f it is requested
mOutputArgs{1} =@getSelectedColor;
if nargout>0
[varargout{1:nargout}] = mOutputAr gs{:};
end
The iconEditor e xecutes the colorPalette’s getSeclectedColor function
whenever it invokes the function that colorPalette returns to it.
function color = getSelectedColor
% function returns the curr ently selected colo r in this
% colorPlatt e
color = mSelectedColor;
The iconEditor GUI. The iconEditor function calls colorPalette only once
and specifies its parent to be a panel in the iconEditor.
% Host the ColorPalette in the PaletteContainer a nd keep the
% function handle for getti ng its selected col or for editing
% icon.
mGetColorFcn = colorPalette('parent', hPaletteContainer);
This call creates the colorPalette as a com ponent of the iconEditor and then
returns a function handle that
iconEditor can call to get the currently
selected color.
The iconEditor’s
localEditColor helper function calls mGetColorFcn,
the function returned by
colorPalette, to execute the colorPalette’s
getSelectedColor function.
function localE ditC olor
% helper function that chan ges the color of an icon data
% point to that of the currently selected color in
% colorPalet te
if mIsEditingIc on
pt = get(hIconEditAxes,'currentpo int');
x = ceil(pt(1,1));
15-61