当前位置: 首页>>代码示例>>C++>>正文


C++ UserData::setParent方法代码示例

本文整理汇总了C++中UserData::setParent方法的典型用法代码示例。如果您正苦于以下问题:C++ UserData::setParent方法的具体用法?C++ UserData::setParent怎么用?C++ UserData::setParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserData的用法示例。


在下文中一共展示了UserData::setParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: insertFileList

int Container::insertFileList(FileList *fl,UserData *parent)
{
    UserData *ud;
    UserData *first;
    int i,num_items;
    HPOINTER the_icon;
    
    num_items = fl->getNumFiles();
    
    // Build up insertion information
    RECORDINSERT ri;   
    memset(&ri,0,sizeof(RECORDINSERT));
    ri.cb = sizeof(RECORDINSERT);
    ri.zOrder = CMA_END;                    // add on top of siblings
//    ri.fInvalidateRecord = TRUE;            // re-arrange after insert
    ri.pRecordParent = (PRECORDCORE)parent; // set tree hierarchy
    ri.pRecordOrder = (RECORDCORE*)CMA_END; // add to end of list
    
    
    if (num_items > 0)
    {
        ri.cRecordsInsert = num_items;          // number of records to insert
        first = allocateRecords(num_items);
        ud = first;
        if (ud)
        {
            for (i=0; i<num_items; i++)
            {
                num_objects++;
                ud->setName(fl->getFile(i));
                the_icon = determineIcon(fl->getFile(i));
                ud->setIcons(the_icon,the_icon);
                ud->setType(TYPE_FILE);
                ud->setParent(parent);
// NEW STUFF
/*
                    char *kkk = new char[4096];
                    strcpy(kkk,fl->getBasePath());
                    strcat(kkk,fl->getFile(i));
                    
                    the_icon = WinLoadFileIcon(kkk,FALSE);
                    if (the_icon != NULL)
                    {
                        ud->setIcons(the_icon,the_icon);
                        WinSendMsg(cont,CM_INVALIDATERECORD,MPFROMP(&ud),MPFROM2SHORT(1,CMA_TEXTCHANGED|CMA_REPOSITION));
                    }
                    delete[] kkk;
*/
// ENDE NEW STUFF
                    
                PRECORDCORE pr = (PRECORDCORE)ud;
                ud = (UserData*)pr->preccNextRecord;
            }
            
            MRESULT rc = WinSendMsg(cont,CM_INSERTRECORD,MPFROMP((PRECORDCORE)first),MPFROMP(&ri));
            return 1;
        }
    }
    return 0;
}
开发者ID:OS2World,项目名称:APP-INTERNET-News-Harvest,代码行数:60,代码来源:container.cpp

示例2: insert

int Container::insert(char *name,UserData *parent,ULONG arg1,ULONG arg2)
{
    UserData *ud;
    
    ud = allocateRecords(1);
    if (ud)
    {
        last_insert = ud;
        
//        objects[num_objects] = ud;  // keep a pointer to the block
        num_objects++;
        
        // set all the stuff in our record
        ud->setName(name);
        if (arg1 == arg2 && arg1 == 7777L)
        {
            ud->setType(TYPE_GROUP);
            ud->setIcons(icon_group_o,icon_group_c);
        }
        else if (arg1 == arg2 && arg1 == 8888L)
        {
            ud->setType(TYPE_FILE);
            ud->setParent(parent);
            HPOINTER the_icon;
            if (*name)
            {
                the_icon = determineIcon(name);
//
//                if (the_icon != icon_dunno)
//                {
                    ud->setIcons(the_icon,the_icon);
//                }
//                else
//                {
//                    // TRY TO LOAD THE Shared WPS ICON
//                    the_icon = WinLoadFileIcon(name,FALSE);
//                    if (the_icon != NULL)
//                    {
//                        ud->setIcons(the_icon,the_icon);
//                        WinSendMsg(cont,CM_INVALIDATERECORD,MPFROMP(&ud),MPFROM2SHORT(1,CMA_TEXTCHANGED|CMA_REPOSITION));
//                    }
//                }
            }
            
        }
        else if (parent == NULL)
        {
            ud->setType(TYPE_SERVER);
            ud->setIcons(icon_server,icon_server);
        }
        else
        {
            ud->setType(TYPE_GROUP);
            ud->setParent(parent);
            ud->setIcons(icon_group_o,icon_group_c);
        }
        
        ud->setCull(arg1);
        ud->setStart(arg2);
        
        // Build up insertion information
        RECORDINSERT ri;   
        memset(&ri,0,sizeof(RECORDINSERT));
        ri.cb = sizeof(RECORDINSERT);
        ri.zOrder = CMA_END;                    // add on top of siblings
        if (!parent || !parent->getCollapsed())
            ri.fInvalidateRecord = TRUE;            // re-arrange after insert
        ri.pRecordParent = (PRECORDCORE)parent; // set tree hierarchy
        ri.cRecordsInsert = 1;                  // number of records to insert
        ri.pRecordOrder = (RECORDCORE*)CMA_END; // add to end of list

//        MRESULT rc = WinSendDlgItemMsg(dialog,id,CM_INSERTRECORD,MPFROMP((PRECORDCORE)ud),MPFROMP(&ri));
        MRESULT rc = WinSendMsg(cont,CM_INSERTRECORD,MPFROMP((PRECORDCORE)ud),MPFROMP(&ri));
        if (rc == 0)
            message("CM_INSERTRECORD returned %d",rc);
        
        return 1;
    }
    else
    {
        DosBeep(100,100);
        return 0;
    }
}
开发者ID:OS2World,项目名称:APP-INTERNET-News-Harvest,代码行数:84,代码来源:container.cpp


注:本文中的UserData::setParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。