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


C++ DialogWindowRefPtr::getPreferredSize方法代码示例

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


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

示例1: actionPerformed

   virtual void actionPerformed(const ActionEventUnrecPtr e)
    {
        std::vector<std::string> inputValues;
        inputValues.push_back("0");

        DialogWindowRefPtr TheDialog;
        TheDialog = DialogWindow::createInputDialog("Move selected index to", "Please enter the index to move to", DialogWindow::INPUT_TEXT,true,inputValues);
        TheDialog->setAllwaysOnTop(true);
        TheDialog->addDialogWindowListener(this);

        Pnt2f CenteredPosition = calculateAlignment(dynamic_cast<Component*>(e->getSource())->getParentWindow()->getPosition(), dynamic_cast<Component*>(e->getSource())->getParentWindow()->getSize(), TheDialog->getPreferredSize(), 0.5f, 0.5f);
        TheDialog->setPosition(CenteredPosition);

        dynamic_cast<Component*>(e->getSource())->getParentWindow()->getDrawingSurface()->openWindow(TheDialog);
    }
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:15,代码来源:01ChangeFieldCommands.cpp

示例2: openCreateHandler

void FCPtrFieldEditor::openCreateHandler(void)
{
    const FieldContainerType* ThePtrType(getFieldContainerTypeFromPtrType(getEditingFC()->getFieldDescription(getEditingFieldId())->getFieldType().getContentType()));
    if(ThePtrType == NULL)
    {
        return;
    }

    //If the type is a node, then create a NodeCore instead
    //and then insert it as the core of a newly created node
    if(*ThePtrType == Node::getClassType())
    {
        ThePtrType = &NodeCore::getClassType();
    }

    std::vector<std::string> inputValues;
    UInt32 NumFieldContainersFound(0);
    const FieldContainerType* FoundType(NULL);
    for(UInt32 j(0) ; NumFieldContainersFound<FieldContainerFactory::the()->getNumTypes(); ++j)
    {
        FoundType = FieldContainerFactory::the()->findType(j);
        if(FoundType != NULL)
        {
            if(FoundType->isDerivedFrom(*ThePtrType)  && !FoundType->isAbstract())
            {
                inputValues.push_back(FoundType->getName());
            }
            ++NumFieldContainersFound;
        }
    }

    DialogWindowRefPtr TheDialog = DialogWindow::createInputDialog("Create Field Container",
                                                                   "Choose the type of object to create",
                                                                   DialogWindow::INPUT_COMBO,
                                                                   true,
                                                                   inputValues);
    _CreateContainerDialogClosedConnection = TheDialog->connectDialogWindowClosed(boost::bind(&FCPtrFieldEditor::handleCreateContainerDialogClosed, this, _1));

    Pnt2f CenteredPosition = calculateAlignment(Pnt2f(0.0f,0.0f), getParentWindow()->getParentDrawingSurface()->getSize(), TheDialog->getPreferredSize(), 0.5f, 0.5f);
    TheDialog->setPosition(CenteredPosition);
    TheDialog->setAllwaysOnTop(true);
    TheDialog->setModal(true);
    TheDialog->setResizable(true);

    getParentWindow()->getParentDrawingSurface()->openWindow(TheDialog);
}
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:46,代码来源:OSGFCPtrFieldEditor.cpp

示例3: openFindContainerHandler

void FCPtrFieldEditor::openFindContainerHandler(void)
{
    const FieldContainerType* ThePtrType(getFieldContainerTypeFromPtrType(getEditingFC()->getFieldDescription(getEditingFieldId())->getFieldType().getContentType()));
    if(ThePtrType == NULL)
    {
        return;
    }

    std::vector<std::string> inputValues;
    _FindFCStore->setTypeToStore(ThePtrType);
    FCPtrEditorStore::FieldContianerVector fcStore(_FindFCStore->getList());

    std::string value;
    for(UInt32 i(0) ; i<fcStore.size(); ++i)
    {
        value.clear();
        if(fcStore[i]->getType().isDerivedFrom(AttachmentContainer::getClassType()) &&
           getName(dynamic_pointer_cast<AttachmentContainer>(fcStore[i])))
        {
            value += std::string(getName(dynamic_pointer_cast<AttachmentContainer>(fcStore[i]))) + " ";
        }
        value += "[" + fcStore[i]->getType().getName() + "] " + boost::lexical_cast<std::string>(fcStore[i]->getId());
        inputValues.push_back(value);
    }

    DialogWindowRefPtr TheDialog = DialogWindow::createInputDialog("Find Field Container",
                                                                   "Choose the container to use",
                                                                   DialogWindow::INPUT_LIST,
                                                                   true,
                                                                   inputValues);
    _FindContainerDialogClosedConnection = TheDialog->connectDialogWindowClosed(boost::bind(&FCPtrFieldEditor::handleFindContainerDialogClosed, this, _1));

    Pnt2f CenteredPosition = calculateAlignment(Pnt2f(0.0f,0.0f), getParentWindow()->getParentDrawingSurface()->getSize(), TheDialog->getPreferredSize(), 0.5f, 0.5f);
    TheDialog->setPosition(CenteredPosition);
    TheDialog->setAllwaysOnTop(true);
    TheDialog->setResizable(true);

    getParentWindow()->getParentDrawingSurface()->openWindow(TheDialog);
}
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:39,代码来源:OSGFCPtrFieldEditor.cpp

示例4: insertAtIndex

void GenericMultiFieldEditor::insertAtIndex(FieldContainer* const fc,
                                            UInt32 fieldID,
                                            UInt32 index,
                                            UIDrawingSurface* const drawingSurface,
                                            CommandManager* cmdMgr)
{
    //Is this a pointer field
    GetFieldHandlePtr TheFieldHandle(fc->getField(fieldID));
    if(TheFieldHandle->isPointerField())
    {
        //Create
        const FieldContainerType* ThePtrType(getFieldContainerTypeFromPtrType(fc->getFieldDescription(fieldID)->getFieldType().getContentType()));
        if(ThePtrType == NULL)
        {
            return;
        }

        //If the type is a node, then create a NodeCore instead
        //and then insert it as the core of a newly created node
        if(*ThePtrType == Node::getClassType())
        {
            ThePtrType = &NodeCore::getClassType();
        }

        std::vector<std::string> inputValues;
        UInt32 NumFieldContainersFound(0);
        const FieldContainerType* FoundType(NULL);
        for(UInt32 j(0) ; NumFieldContainersFound<FieldContainerFactory::the()->getNumTypes(); ++j)
        {
            FoundType = FieldContainerFactory::the()->findType(j);
            if(FoundType != NULL)
            {
                if(FoundType->isDerivedFrom(*ThePtrType)  && !FoundType->isAbstract())
                {
                    inputValues.push_back(FoundType->getName());
                }
                ++NumFieldContainersFound;
            }
        }

        if(inputValues.size() == 1)
        {
            insertAtIndex(fc,fieldID,index,FieldContainerFactory::the()->findType(inputValues[0].c_str()),cmdMgr);
        }
        else
        {
            DialogWindowRefPtr TheDialog = DialogWindow::createInputDialog("Create " + fc->getFieldDescription(fieldID)->getFieldType().getContentType().getName(),
                                                                           "Choose the type of object to create",
                                                                           DialogWindow::INPUT_COMBO,
                                                                           true,
                                                                           inputValues);
            TheDialog->connectDialogWindowClosed(boost::bind(&GenericMultiFieldEditor::handleInsertFCPtrDialogClosed,
                                                             _1,
                                                             fc,
                                                             fieldID,
                                                             index,
                                                             cmdMgr));

            Pnt2f CenteredPosition = calculateAlignment(Pnt2f(0.0f,0.0f), drawingSurface->getSize(), TheDialog->getPreferredSize(), 0.5f, 0.5f);
            TheDialog->setPosition(CenteredPosition);
            TheDialog->setAllwaysOnTop(true);
            TheDialog->setModal(true);
            TheDialog->setResizable(true);

            drawingSurface->openWindow(TheDialog);
        }
    }
    else
    {
        //Insert the default
        InsertFieldElementCommandPtr InsertIndexCommand = InsertFieldElementCommand::create(fc, fieldID, "", index);

        cmdMgr->executeCommand(InsertIndexCommand);
    }
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:75,代码来源:OSGGenericMultiFieldEditor.cpp


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