⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guihandles.c

📁 精通Matlab与C_C++混合程序设计.rar 是精通Matlab与C_C++混合程序设计 这本书的配套源码
💻 C
📖 第 1 页 / 共 3 页
字号:
     * %
     * %   f = figure;
     * %   uicontrol('Style','slider','Tag','valueSlider', ...);
     * %   uicontrol('Style','edit','Tag','valueEdit',...);
     * %
     * %   ... excerpt from the slider's callback ...
     * %
     * %   handles = guihandles(gcbo); % generate handles struct
     * %   set(handles.valueEdit, 'string',...
     * %       num2str(get(handles.valueSlider, 'value')));
     * %
     * %   ... excerpt from the edit's callback ...
     * %
     * %   handles = guihandles(gcbo);
     * %   val = str2double(get(handles.valueEdit,'String'));
     * %   if isnumeric(val) & length(val)==1 & ...
     * %      val >= get(handles.valueSlider, 'Min') & ...
     * %      val <= get(handles.valueSlider, 'Max')
     * %     % update the slider's value if the edit's value is OK:
     * %     set(handles.valueSlider, 'Value', val);
     * %   else
     * %     % flush the bad string out of the edit; replace with slider's
     * %     % current value:
     * %     set(handles.valueEdit, 'String',...
     * %       num2str(get(handles.valueSlider, 'Value')));
     * %   end
     * %
     * %   Note that in this example, the structure of handles is created
     * %   each time a callback executes.  See the GUIDATA help for an
     * %   example in which the structure is created only once, and cached
     * %   for subsequent use.
     * %
     * %  See also GUIDATA, GUIDE, OPENFIG.
     * 
     * %   Damian T. Packer 6-8-2000
     * %   Copyright 1984-2002 The MathWorks, Inc.
     * %   $Revision: 1.7 $  $Date: 2002/05/30 20:42:00 $
     * 
     * if nargin == 0 % use GCF
     */
    #line 62 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclMline(62);
    #line 62 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    if (nargin_ == 0) {
        /*
         * fig = gcf;
         */
        #line 63 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        mclMline(63);
        #line 63 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        mlfAssign(&fig, mlfGcf());
    /*
     * else % nargin == 1: obtain a figure handle from H
     */
    #line 64 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclMline(64);
    #line 64 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    } else {
        /*
         * fig = [];
         */
        #line 65 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        mclMline(65);
        #line 65 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        mlfAssign(&fig, mclCreateEmptyArray());
        /*
         * if ishandle(h) & length(h) == 1
         */
        #line 66 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        mclMline(66);
        #line 66 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        {
            #line 66 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
            mxArray * a_ = mclInitialize(mlfIshandle(mclVa(h, "h")));
            #line 66 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
            if (mlfTobool(a_) && mlfTobool(mclAnd(a_, mclBoolToArray(mclLengthInt(mclVa(h, "h")) == 1)))) {
                #line 66 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
                mxDestroyArray(a_);
                /*
                 * fig = getParentFigure(h);
                 */
                #line 67 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
                mclMline(67);
                #line 67 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
                mlfAssign(&fig, mlfGuihandles_getParentFigure(mclVa(h, "h")));
            #line 67 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
            } else {
                #line 67 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
                mxDestroyArray(a_);
            #line 67 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
            }
        /*
         * end
         */
        #line 68 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        mclMline(68);
        #line 68 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        }
        /*
         * if isempty(fig)
         */
        #line 69 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        mclMline(69);
        #line 69 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        if (mlfTobool(mlfIsempty(mclVv(fig, "fig")))) {
            /*
             * error('H must be the handle to a figure or figure descendent.');
             */
            #line 70 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
            mclMline(70);
            #line 70 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
            mlfError(mxCreateString("H must be the handle to a figure or figure descendent."), NULL);
        /*
         * end
         */
        #line 71 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        mclMline(71);
        #line 71 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        }
    /*
     * end
     */
    #line 72 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclMline(72);
    #line 72 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    }
    /*
     * 
     * % the structure creation is handled in a subfunction:
     * handles = createHandles(fig);
     */
    #line 75 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclMline(75);
    #line 75 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mlfAssign(&handles, mlfGuihandles_createHandles(mclVv(fig, "fig")));
    #line 75 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclValidateOutput(handles, 1, nargout_, "handles", "guihandles");
    #line 75 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mxDestroyArray(fig);
    #line 75 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mxDestroyArray(ans);
    #line 75 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mxDestroyArray(h);
    #line 75 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    #line 75 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclMlineFunctionReturn()
    #line 75 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    return handles;
    /*
     * 
     * 
     */
    #line 77 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclMlineExitFunctionReturn();
    #line 77 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
}

/*
 * The function "Mguihandles_getParentFigure" is the implementation version of the "guihandles/getParentFigure" M-function from file "d:\matlab6p5\toolbox\matlab\uitools\guihandles.m" (lines 78-86). It contains the actual compiled code for that M-function. It is a static function and must only be called from one of the interface functions, appearing below.
 */
/*
 * function fig = getParentFigure(fig)
 */
#line 78 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
static mxArray * Mguihandles_getParentFigure(int nargout_, mxArray * fig_in) {
    #line 78 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclMlineEnterFunction("d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m", "guihandles/getParentFigure")
    #line 78 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mexLocalFunctionTable save_local_function_table_ = mclSetCurrentLocalFunctionTable(&_local_function_table_guihandles);
    #line 78 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mxArray * fig = NULL;
    #line 78 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclCopyInputArg(&fig, fig_in);
    /*
     * % if the object is a figure or figure descendent, return the
     * % figure.  Otherwise return [].
     * while ~isempty(fig) & ~strcmp('figure', get(fig,'type'))
     */
    #line 81 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    mclMline(81);
    #line 81 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
    for (;;) {
        #line 81 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        mxArray * a_ = mclInitialize(mclNot(mlfIsempty(mclVa(fig, "fig"))));
        #line 81 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        if (mlfTobool(a_) && mlfTobool(mclAnd(a_, mclNot(mlfStrcmp(mxCreateString("figure"), mlfNGet(1, mclVa(fig, "fig"), mxCreateString("type"), NULL)))))) {
            #line 81 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
            mxDestroyArray(a_);
        #line 81 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        } else {
            #line 81 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
            mxDestroyArray(a_);
            #line 81 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
            break;
        #line 81 "d:\\matlab6p5\\toolbox\\matlab\\uitools\\guihandles.m"
        }
        /*
         * fig = get(fig,'parent');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -