www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@listCentricUI/pMakeToolbar.m
function pMakeToolbar(obj) %PMAKETOOLBAR Create toolbar for GUI % % PMAKETOOLBAR(OBJ) constructs a toolbar for the GUI and saves its handle % in the Toolbar field of the object. % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. tb = obj.Browser.createToolbar(); tb.Visible = obj.Visible; obj.Toolbar = tb; cmdStruct = obj.pGetCommands; xregGui.uipushtool(tb, ... 'TransparentColor', [0 255 0], ... 'ImageFile', 'toffapplyfill.bmp', ... 'TooltipString', 'Apply table filling values', ... 'ClickedCallback', {cmdStruct.ApplyFillAndSave, obj}); findbut(1) = xregGui.uipushtool(tb, ... 'TransparentColor', [0 255 0], ... 'Separator', 'on', ... 'ImageFile', 'tofffindmin.bmp', ... 'TooltipString', 'Find minimum of output', ... 'ClickedCallback', {cmdStruct.MinimizeInput, obj}, ... 'Enable', 'off'); findbut(2) = xregGui.uipushtool(tb, ... 'TransparentColor', [0 255 0], ... 'ImageFile', 'tofffindmax.bmp', ... 'TooltipString', 'Find maximum of output', ... 'ClickedCallback', {cmdStruct.MaximizeInput, obj}, ... 'Enable', 'off'); findbut(3) = xregGui.uipushtool(tb, ... 'TransparentColor', [0 255 0], ... 'ImageFile', 'tofffindturn.bmp', ... 'TooltipString', 'Find turning point of output', ... 'ClickedCallback', {cmdStruct.TurningOfInput, obj}, ... 'Enable', 'off'); xregGui.uipushtool(tb, ... 'TransparentColor', [0 255 0], ... 'ImageFile', 'toffresetvalues.bmp', ... 'TooltipString', 'Reset inputs to last saved values', ... 'ClickedCallback', {cmdStruct.ResetInputs, obj}); xregGui.uipushtool(tb, ... 'TransparentColor', [0 255 0], ... 'Separator', 'on', ... 'ImageFile', 'toffautomated.bmp', ... 'TooltipString', 'Automated tradeoff', ... 'ClickedCallback', {cmdStruct.AutoTradeoff, obj}); obj.hGraphSelChangeList_TB = ... handle.listener(obj.GraphsView, 'SelectionChange', {@i_inputfinderenable, findbut}); function i_inputfinderenable(src, evt, hButtons) if ~isempty(evt.data.Row) && evt.data.Row>0 set(hButtons, 'Enable', 'on'); else set(hButtons, 'Enable', 'off'); end