本文整理汇总了C++中DialogWindowRefPtr类的典型用法代码示例。如果您正苦于以下问题:C++ DialogWindowRefPtr类的具体用法?C++ DialogWindowRefPtr怎么用?C++ DialogWindowRefPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DialogWindowRefPtr类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
void TravMaskCommand::handleChooseMatchStringDialogClosed(DialogWindowEventDetails* const details,
UIDrawingSurface* const DrawingSurface,
Node* const RootNode)
{
if(details->getOption() == DialogWindowEventDetails::DIALOG_OPTION_OK)
{
//Get the Search string returned
std::string SearchRegex = details->getInput();
std::string MaskStrValue;
try
{
MaskStrValue = boost::lexical_cast<std::string>(MainApplication::the()->getSettings().get<UInt32>("player.debugger.trav_mask_graph_op.applied_trav_mask"));
}
catch(boost::bad_lexical_cast & ex)
{
SWARNING << "Bad lexical cast: " << ex.what() << std::endl;
return;
}
//Open Dialog for setting the traversal mask
DialogWindowRefPtr TravMaskDialog =
DialogWindow::createTextInputDialog("Traversal Mask",
"Enter the traversal mask you would like to be applied",
true,
std::vector<std::string>(1, MaskStrValue));
TravMaskDialog->connectDialogWindowClosed(boost::bind(&TravMaskCommand::handleChooseTravMaskDialogClosed, _1, SearchRegex, RootNode));
TravMaskDialog->setModal(true);
DrawingSurface->openWindow(TravMaskDialog);
}
}
示例2: 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);
}
示例3: execute
void TravMaskCommand::execute(void)
{
if(_RootNode != NULL)
{
DialogWindowRefPtr SearchStrDialog =
DialogWindow::createTextInputDialog("Search string ...",
"Enter the text you would like to match.",
true,
std::vector<std::string>(1, MainApplication::the()->getSettings().get<std::string>("player.debugger.trav_mask_graph_op.search_regex")));
SearchStrDialog->connectDialogWindowClosed(boost::bind(&TravMaskCommand::handleChooseMatchStringDialogClosed, _1, _DrawingSurface.get(), _RootNode.get()));
SearchStrDialog->setModal(true);
_DrawingSurface->openWindow(SearchStrDialog);
}
}
示例4: ThePtrType
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);
}
示例5: createFCEditorDialog
OSG_BEGIN_NAMESPACE
DialogWindowTransitPtr createFCEditorDialog(FieldContainer* fc,
CommandManagerPtr CmdManager,
const std::string& editorName)
{
DialogWindowRefPtr TheDialog = DialogWindow::create();
//Create the FieldEditorComponent
FieldContainerEditorComponentRefPtr TheEditor = FieldContainerEditorFactory::the()->createDefaultEditor(fc, CmdManager);
ScrollPanelRefPtr EditorScrollPanel = ScrollPanel::create();
EditorScrollPanel->setPreferredSize(Vec2f(300,400));
EditorScrollPanel->setViewComponent(TheEditor);
//Ok button
ButtonRefPtr ConfirmButton = Button::create();
ConfirmButton->setText("Ok");
ConfirmButton->connectActionPerformed(boost::bind(&DialogWindow::handleConfirmButtonAction, TheDialog.get(), _1));
SpringLayoutRefPtr DialogLayout = OSG::SpringLayout::create();
//EditorScrollPanel
DialogLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, EditorScrollPanel, 2, SpringLayoutConstraints::NORTH_EDGE, TheDialog);
DialogLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, EditorScrollPanel, -15, SpringLayoutConstraints::NORTH_EDGE, ConfirmButton);
DialogLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, EditorScrollPanel, 1, SpringLayoutConstraints::EAST_EDGE, TheDialog);
DialogLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, EditorScrollPanel, 2, SpringLayoutConstraints::WEST_EDGE, TheDialog);
//ConfirmButton
DialogLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, ConfirmButton, -15, SpringLayoutConstraints::SOUTH_EDGE, TheDialog);
DialogLayout->putConstraint(SpringLayoutConstraints::HORIZONTAL_CENTER_EDGE, ConfirmButton, 0, SpringLayoutConstraints::HORIZONTAL_CENTER_EDGE, TheDialog);
TheDialog->setLayout(DialogLayout);
TheDialog->setPreferredSize(Vec2f(330.0f, 475.0f));
TheDialog->pushToChildren(EditorScrollPanel);
TheDialog->pushToChildren(ConfirmButton);
return DialogWindowTransitPtr(TheDialog);
}
示例6: createTransparentTextArea
DialogWindowUnrecPtr DialogWindow::createMessageDialog(const std::string& Title, const std::string& Message, const int& Type, const bool& showCancel, const std::string& ConfirmBtnText, const std::string& CancelBtnText)
{
ImageComponentRefPtr TheIcon = ImageComponent::create();
LineBorderRefPtr TempIconBorder = OSG::LineBorder::create();
TheIcon->setPreferredSize(Vec2f(45,45));
TheIcon->setBorders(TempIconBorder);
ButtonRefPtr ConfirmationButton = OSG::Button::create();
ButtonRefPtr CancelButton;
//Confirm Button
ConfirmationButton->setText(ConfirmBtnText);
ConfirmationButton->setMinSize(ConfirmationButton->getPreferredSize());
ConfirmationButton->setPreferredSize(ConfirmationButton->getRequestedSize());
if(showCancel)
{
//Cancel Button
CancelButton = OSG::Button::create();
CancelButton->setText(CancelBtnText);
CancelButton->setMinSize(CancelButton->getPreferredSize());
CancelButton->setPreferredSize(CancelButton->getRequestedSize());
}
// Create Panel for top half of SplitPanel
TextAreaRefPtr MessagePanelText = createTransparentTextArea(Message);
// Create Panel for bottom half of SplitPanel
PanelRefPtr MessageButtonPanel = OSG::Panel::createEmpty();
FlowLayoutRefPtr MessagePanelBottomLayout = OSG::FlowLayout::create();
MessageButtonPanel->pushToChildren(ConfirmationButton);
if(showCancel)
MessageButtonPanel->pushToChildren(CancelButton);
MessageButtonPanel->setLayout(MessagePanelBottomLayout);
MessageButtonPanel->setPreferredSize(Vec2f(450,75));
// Create SplitPanel itself
PanelRefPtr MessagePanel = OSG::Panel::createEmpty();
SpringLayoutRefPtr MessagePanelLayout = SpringLayout::create();
MessagePanel->pushToChildren(MessagePanelText);
MessagePanel->pushToChildren(TheIcon);
MessagePanel->pushToChildren(MessageButtonPanel);
MessagePanel->setLayout(MessagePanelLayout);
//MessagePanelLayout
//Icon
MessagePanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, TheIcon, 10, SpringLayoutConstraints::NORTH_EDGE, MessagePanel);
MessagePanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, TheIcon, LayoutSpring::width(TheIcon));
MessagePanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, TheIcon, 10, SpringLayoutConstraints::WEST_EDGE, MessagePanel);
MessagePanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, TheIcon, LayoutSpring::height(TheIcon));
//Message
MessagePanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, MessagePanelText, 5, SpringLayoutConstraints::NORTH_EDGE, MessagePanel);
MessagePanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, MessagePanelText, -5, SpringLayoutConstraints::EAST_EDGE, MessagePanel);
MessagePanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, MessagePanelText, 10, SpringLayoutConstraints::EAST_EDGE, TheIcon);
MessagePanelLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, MessagePanelText, -30, SpringLayoutConstraints::SOUTH_EDGE, MessagePanel);
//Button Panel
MessagePanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, MessageButtonPanel, 0, SpringLayoutConstraints::WEST_EDGE, MessagePanel);
MessagePanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, MessageButtonPanel, 0, SpringLayoutConstraints::EAST_EDGE, MessagePanel);
MessagePanelLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, MessageButtonPanel, 20, SpringLayoutConstraints::SOUTH_EDGE, MessagePanel);
//Internals Layout and constraints
BorderLayoutConstraintsRefPtr MessagePanelConstraints = BorderLayoutConstraints::create();
MessagePanelConstraints->setRegion(BorderLayoutConstraints::BORDER_CENTER);
MessagePanel->setConstraints(MessagePanelConstraints);
BorderLayoutRefPtr DialogLayout = BorderLayout::create();
//Create the Dialog box
DialogWindowRefPtr TheDialog = DialogWindow::create();
TheDialog->setLayout(DialogLayout);
TheDialog->setPreferredSize(Vec2f(350,150));
TheDialog->pushToChildren(MessagePanel);
TheDialog->setTitle(Title);
//Attach listener to the Confirm button
ConfirmationButton->addActionListener(&TheDialog->_ConfirmButtonListener);
if(showCancel)
{
//Attach listener to the Cancel button
CancelButton->addActionListener(&TheDialog->_CancelButtonListener);
}
return TheDialog;
}
示例7: createInputDialog
DialogWindowUnrecPtr DialogWindow::createInputDialog(const std::string& Title, const std::string& Message, const int& Type, const bool& showCancel, const std::vector<std::string>& InputValues, const std::string& ConfirmBtnText, const std::string& CancelBtnText)
{
int DialogHeight = 175;
DialogWindowRefPtr TheDialog = DialogWindow::create();
ImageComponentRefPtr TheIcon = ImageComponent::create();
LineBorderRefPtr TempIconBorder = OSG::LineBorder::create();
TheIcon->setPreferredSize(Vec2f(45,45));
TheIcon->setBorders(TempIconBorder);
// Create Panel for input
PanelRefPtr InputPanel = OSG::Panel::createEmpty();
FlowLayoutRefPtr InputPanelLayout = OSG::FlowLayout::create();
InputPanel->setLayout(InputPanelLayout);
InputPanel->setPreferredSize(Vec2f(450,75));
ButtonRefPtr InputButton;
switch (Type) {
case INPUT_TEXT:
TheDialog->_InputTextField = OSG::TextField::create();
TheDialog->_InputTextField->setText(InputValues[0]);
TheDialog->_InputTextField->setPreferredSize(Vec2f(200,25));
InputPanel->pushToChildren(TheDialog->_InputTextField);
break;
case INPUT_BTNS:
DialogHeight = 150;
for (std::vector<std::string>::const_iterator it = InputValues.begin(); it!=InputValues.end(); ++it)
{
InputButton = OSG::Button::create();
InputButton->setText(*it);
InputButton->setMinSize(InputButton->getPreferredSize());
InputButton->setPreferredSize(InputButton->getRequestedSize());
InputButton->addActionListener(&TheDialog->_InputButtonListener);
InputPanel->pushToChildren(InputButton);
}
break;
case INPUT_COMBO:
default:
TheDialog->_InputComboBox = OSG::ComboBox::create();
DefaultMutableComboBoxModelRefPtr _InputComboBoxModel;
_InputComboBoxModel = DefaultMutableComboBoxModel::create();
for (std::vector<std::string>::const_iterator it = InputValues.begin(); it!=InputValues.end(); ++it)
{
_InputComboBoxModel->addElement(boost::any(std::string(*it)));
}
TheDialog->_InputComboBox->setPreferredSize(Vec2f(150, 23));
TheDialog->_InputComboBox->setModel(_InputComboBoxModel);
TheDialog->_InputComboBox->setSelectedIndex(0);
InputPanel->pushToChildren(TheDialog->_InputComboBox);
break;
}
FlowLayoutRefPtr MessagePanelBottomLayout;
PanelRefPtr MessageButtonPanel;
ButtonRefPtr ConfirmationButton;
ButtonRefPtr CancelButton;
if(Type != INPUT_BTNS)
{
ConfirmationButton = OSG::Button::create();
//Confirm Button
ConfirmationButton->setText(ConfirmBtnText);
ConfirmationButton->setMinSize(ConfirmationButton->getPreferredSize());
ConfirmationButton->setPreferredSize(ConfirmationButton->getRequestedSize());
if(Type == INPUT_TEXT)
{
ConfirmationButton->addActionListener(&TheDialog->_TextButtonListener);
}
else
{
ConfirmationButton->addActionListener(&TheDialog->_ComboButtonListener);
}
}
if(showCancel)
{
CancelButton = OSG::Button::create();
//Cancel Button
CancelButton->setText(CancelBtnText);
CancelButton->setMinSize(CancelButton->getPreferredSize());
CancelButton->setPreferredSize(CancelButton->getRequestedSize());
//Attach listener to the Cancel button
CancelButton->addActionListener(&TheDialog->_CancelButtonListener);
}
// Create Panel for top half of SplitPanel
TextAreaRefPtr MessagePanelText = createTransparentTextArea(Message);
//If the type of input is buttons and showCancel is true, just push the cancel button onto the input panel
if(Type == INPUT_BTNS && showCancel)
{
InputPanel->pushToChildren(CancelButton);
}
else if(Type != INPUT_BTNS)
//.........这里部分代码省略.........
示例8: DialogWindowTransitPtr
DialogWindowTransitPtr createFCTreeEditorDialog (FieldContainer* fc,
CommandManagerPtr CmdManager,
const std::string& editorName)
{
DialogWindowRefPtr TheDialog = DialogWindow::create();
//Create the FieldEditorComponent
FieldContainerEditorComponentRefPtr TheEditor = FieldContainerEditorFactory::the()->createDefaultEditor(fc, CmdManager);
ScrollPanelRefPtr EditorScrollPanel = ScrollPanel::create();
EditorScrollPanel->setViewComponent(TheEditor);
//Field Container Tree Model
FieldContainerTreeModelRefPtr TheTreeModel = FieldContainerTreeModel::create();
TheTreeModel->setRoot(fc);
TheTreeModel->setShowInternalFields(true);
TheTreeModel->setShowPtrFields(true);
TheTreeModel->setShowDataFields(false);
TheTreeModel->setShowParentPtrFields(false);
TheTreeModel->setShowChildPtrFields(true);
TheTreeModel->setShowAttachments(true);
TheTreeModel->setShowCallbackFunctors(false);
//Field Container Tree Component Generator
FieldContainerFieldPathComponentGeneratorRefPtr TheTreeComponentGenerator = FieldContainerFieldPathComponentGenerator::create();
//Create the PopupMenu for the tree
MenuItemRecPtr ExportMenuItem = MenuItem::create();
ExportMenuItem->setText("Export ...");
MenuItemRecPtr ImportMenuItem = MenuItem::create();
ImportMenuItem->setText("Import ...");
PopupMenuRecPtr TreePopupMenu = PopupMenu::create();
TreePopupMenu->addItem(ExportMenuItem);
TreePopupMenu->addItem(ImportMenuItem);
//Create the Field Container Tree
TreeRefPtr TheTree = Tree::create();
TheTree->setPreferredSize(Vec2f(100, 500));
TheTree->setRootVisible(true);
TheTree->setModel(TheTreeModel);
TheTree->setCellGenerator(TheTreeComponentGenerator);
TheTree->setPopupMenu(TreePopupMenu);
TheTree->getSelectionModel()->connectSelectionAdded(boost::bind(&handleFCSelectionAdded, _1,
TheTree.get(),
EditorScrollPanel.get()));
ExportMenuItem->connectActionPerformed(boost::bind(&handleTreeNodeExport,
_1,
TheTree.get()));
ImportMenuItem->connectActionPerformed(boost::bind(&handleTreeNodeImport,
_1,
TheTree.get()));
//TheDialog->addTransientObject(boost::any(TheTreeEditorSelectionListener));
ScrollPanelRefPtr TreeScrollPanel = ScrollPanel::create();
TreeScrollPanel->setViewComponent(TheTree);
//Ok button
ButtonRefPtr ConfirmButton = Button::create();
ConfirmButton->setText("Ok");
ConfirmButton->connectActionPerformed(boost::bind(&DialogWindow::handleConfirmButtonAction, TheDialog.get(), _1));
SpringLayoutRefPtr DialogLayout = OSG::SpringLayout::create();
//SplitPanel
SplitPanelRefPtr TheSplitPanel = SplitPanel::create();
TheSplitPanel->setOrientation(SplitPanel::HORIZONTAL_ORIENTATION);
TheSplitPanel->setDividerPosition(0.4f);
TheSplitPanel->setDividerSize(5.0f);
TheSplitPanel->setMaxDividerPosition(0.8f);
TheSplitPanel->setMinDividerPosition(0.2f);
TheSplitPanel->setMinComponent(TreeScrollPanel);
TheSplitPanel->setMaxComponent(EditorScrollPanel);
//TreeScrollPanel
DialogLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, TheSplitPanel, 2, SpringLayoutConstraints::NORTH_EDGE, TheDialog);
DialogLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, TheSplitPanel, -15, SpringLayoutConstraints::NORTH_EDGE, ConfirmButton);
DialogLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, TheSplitPanel, -2, SpringLayoutConstraints::EAST_EDGE, TheDialog);
DialogLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, TheSplitPanel, 2, SpringLayoutConstraints::WEST_EDGE, TheDialog);
//ConfirmButton
DialogLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, ConfirmButton, -15, SpringLayoutConstraints::SOUTH_EDGE, TheDialog);
DialogLayout->putConstraint(SpringLayoutConstraints::HORIZONTAL_CENTER_EDGE, ConfirmButton, 0, SpringLayoutConstraints::HORIZONTAL_CENTER_EDGE, TheDialog);
TheDialog->setLayout(DialogLayout);
TheDialog->setPreferredSize(Vec2f(750.0f, 600.0f));
TheDialog->pushToChildren(TheSplitPanel);
TheDialog->pushToChildren(ConfirmButton);
return DialogWindowTransitPtr(TheDialog);
}
示例9: TheFieldHandle
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);
}
}