Пример #1
0
GLMotif::PopupWindow* DotSpreaderOptionsDialog::createDialog()
{
   WidgetFactory factory;

   // create popup-shell
   GLMotif::PopupWindow* parameterDialogPopup=factory.createPopupWindow("ParameterDialogPopup", "Dot Spreader Options");

   // create the main layout
   GLMotif::RowColumn* parameterDialog=factory.createRowColumn("ParameterDialog", 3);
   factory.setLayout(parameterDialog);

   factory.createLabel("", "NumberOfParticles");

   // create text field
   numberOfParticlesValue=factory.createTextField("NumberOfParticlesTextField", 10);
   numberOfParticlesValue->setString("10000");

   // create and initialize slider object
   numberOfParticlesSlider=factory.createSlider("NumberOfParticlesSlider", 15.0);
   numberOfParticlesSlider->setValueRange(1000.0, 250000.0, 1000.0);
   numberOfParticlesSlider->setValue(10000.0);

   // set the slider callback
   numberOfParticlesSlider->getValueChangedCallbacks().add(this, &DotSpreaderOptionsDialog::sliderCallback);

   factory.createLabel("ParticleSizeLabel", "Particle Size");

   pointSizeValue=factory.createTextField("PointSizeTextField", 10);
   pointSizeValue->setString("0.05");

   pointSizeSlider=factory.createSlider("PointSizeSlider", 15.0);
   pointSizeSlider->setValueRange(0.01, 1.0, 0.05);
   pointSizeSlider->setValue(0.05);

   pointSizeSlider->getValueChangedCallbacks().add(this, &DotSpreaderOptionsDialog::sliderCallback);

   // create distribution check boxes
   GLMotif::ToggleButton* surfaceDistributionToggle=factory.createCheckBox("SurfaceDistributionToggle", "Surface", true);
   GLMotif::ToggleButton* volumeDistributionToggle=factory.createCheckBox("VolumeDistributionToggle", "Volume");

   // set callbacks for toggle buttons (check boxes)
   surfaceDistributionToggle->getValueChangedCallbacks().add(this, &DotSpreaderOptionsDialog::distributionTogglesCallback);
   volumeDistributionToggle->getValueChangedCallbacks().add(this, &DotSpreaderOptionsDialog::distributionTogglesCallback);

   // add toggle buttons to array for radio-button behavior
   distributionToggles.push_back(surfaceDistributionToggle);
   distributionToggles.push_back(volumeDistributionToggle);

   // create push buttons
   clearParticles = factory.createButton("ClearParticles", "Clear Particles");

   // assign callbacks for buttons
   clearParticles->getSelectCallbacks().add(this, &DotSpreaderOptionsDialog::buttonCallback);

   parameterDialog->manageChild();

   return parameterDialogPopup;
}
GLMotif::PopupWindow* CartesianGrid3DParameterDialog::createDialog()
{
  WidgetFactory factory;
  GLMotif::PopupWindow* parameterDialogPopup=factory.createPopupWindow("ParameterDialogPopup", "CartesianGrid3D Parameters");

  GLMotif::RowColumn* parameterDialog=factory.createRowColumn("ParameterDialog", 3);
  factory.setLayout(parameterDialog);
   
  openFileButton = factory.createButton("OpenFileButton", "Load Data");
  openFileStatusA = factory.createLabel("OpenFileStatusA", "");
  openFileStatusB = factory.createLabel("OpenFileStatusB", "");
  openFileButton->getSelectCallbacks().add(this, &CartesianGrid3DParameterDialog::openFileCallback);

  char cwd[512];
  getcwd(cwd, 512);
  std::string dataDirectory(cwd);
  IO::DirectoryPtr dirptr = IO::openDirectory(dataDirectory.c_str());

  fileDialog = new GLMotif::FileSelectionDialog(Vrui::getWidgetManager(), "Open file...", dirptr, ".grid");
  // Need to modify FileSelectionDialog to accept filterDescriptions. For ex: "Simple Grid (.grid)"
  //  fileDialog->addFileNameFilters("Numpy Array (.npy)");
  fileDialog->getOKCallbacks().add(this, &CartesianGrid3DParameterDialog::fileOpenAction);
  fileDialog->getCancelCallbacks().add(this, &CartesianGrid3DParameterDialog::fileCancelAction);

/*  factory.createLabel("Dummy3", "");
  openFileStatusC = factory.createLabel("OpenFileStatusC", "");
  factory.createLabel("Dummy4", "");
*/

  factory.createLabel("Dummy3b", "");
  shapeLabel = factory.createLabel("ShapeLabel", "");
  shapeValue = factory.createLabel("ShapeValue", "");

  factory.createLabel("Dummy5", "");
  factory.createLabel("Dummy6", "");
  factory.createLabel("Dummy7", "");

  factory.createLabel("StepSizeLabel", "step size");
  stepSizeValue=factory.createTextField("StepSizeValue", 10);
  double step_size = IntegrationStepSize::instance()->getSavedValue("CartesianGrid3D");
  if (step_size > 0.0) stepSizeValue->setString(toString(step_size).c_str());
  else stepSizeValue->setString("0.01");
  stepSizeSlider=factory.createSlider("StepSizeSlider", 15.0);
  stepSizeSlider->setValueRange(0.0001, 0.05, 0.0001);
  if (step_size > 0.0) stepSizeSlider->setValue(step_size);
  else stepSizeSlider->setValue(0.01);
  stepSizeSlider->getValueChangedCallbacks().add(this, &CartesianGrid3DParameterDialog::sliderCallback);

  parameterDialog->manageChild();
  return parameterDialogPopup;
}
Пример #3
0
GLMotif::PopupMenu* Viewer::createMainMenu()
{
   WidgetFactory factory;

   // create the top-level shell
   GLMotif::PopupMenu* mainMenuPopup=factory.createPopupMenu("MainPopupMenu", "Viewer Options");

   // create button array inside top-level shell
   GLMotif::Menu* mainMenu=factory.createMenu("MainMenu");

   // add buttons and assign callbacks

   // create a cascade button for selecting the dynamical system
   GLMotif::CascadeButton* dynamicsTogglesCascade=factory.createCascadeButton("DynamicsTogglesCascade", "Experiments");
   dynamicsTogglesCascade->setPopup(createDynamicsTogglesMenu());

   // create a cascade button for selecting the dynamical analysis tool
   GLMotif::CascadeButton* toolsTogglesCascade=factory.createCascadeButton("ToolTogglesCascade", "Tools");
   toolsTogglesCascade->setPopup(createToolsTogglesMenu());

   // create a toggle button for showing/hiding the frame rate dialog
   GLMotif::ToggleButton* showFrameRateDialog=factory.createToggleButton("ShowFrameRateDialogToggle", "Show Frame Rate Dialog");
   showFrameRateDialog->getSelectCallbacks().add(this, &Viewer::mainMenuTogglesCallback);

   // create a toggle button for showing/hiding the position dialog
   GLMotif::ToggleButton* showPositionDialog=factory.createToggleButton("ShowPositionDialog", "Show Position Dialog");
   showPositionDialog->getSelectCallbacks().add(this, &Viewer::mainMenuTogglesCallback);

   // create a toggle button for showing/hiding the dynamical parameter interface dialog
   showParameterDialogToggle=factory.createToggleButton("ShowParameterDialogToggle", "Show Experiment Options");
   showParameterDialogToggle->getSelectCallbacks().add(this, &Viewer::mainMenuTogglesCallback);

   // create a toggle for showing/hiding the tool option dialogs
   GLMotif::ToggleButton* showOptionsDialogs=factory.createToggleButton("ShowOptionsDialogsToggle", "Show Tool Options");

   showOptionsDialogs->getSelectCallbacks().add(this, &Viewer::mainMenuTogglesCallback);

   // create a push button for reseting the view
   GLMotif::Button* resetNavigationButton=factory.createButton("ResetNavigationButton", "Reset Navigation");
   resetNavigationButton->getSelectCallbacks().add(this, &Viewer::resetNavigationCallback);

   mainMenu->manageChild();

   return mainMenuPopup;
}
Пример #4
0
Button* Button::create(Container* container)
{
	WidgetFactory* wf = UiModule::instance()->getWidgetFactory();
	Button* btn = wf->createButton(sButtonNameGenerator.generate(), container);
	return btn;
}
Пример #5
0
GLMotif::PopupWindow* DynamicSolverOptionsDialog::createDialog()
{
   WidgetFactory factory;

   // create the popup-shell
   GLMotif::PopupWindow* parameterDialogPopup=factory.createPopupWindow("ParameterDialogPopup", " Dynamic Solver Options");

   // create the main layout
   GLMotif::RowColumn* parameterDialog=factory.createRowColumn("ParameterDialog", 1);
   factory.setLayout(parameterDialog);

   // create a layout for check boxes (toggle buttons)
   GLMotif::RowColumn* checkBoxLayout=factory.createRowColumn("CheckBoxLayout", 4);
   factory.setLayout(checkBoxLayout);

   // create line style toggle buttons (check boxes)
   factory.createLabel("", "Line Style");
   GLMotif::ToggleButton* noneLineToggle=
         factory.createCheckBox("NoneLineToggle", "None");
   GLMotif::ToggleButton* basicLineToggle=
         factory.createCheckBox("BasicLineToggle", "2D");
   GLMotif::ToggleButton* polyLineToggle=
         factory.createCheckBox("PolyLineToggle", "3D", true);

   // assign callbacks for line style toggle buttons
   noneLineToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::lineStyleTogglesCallback);
   basicLineToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::lineStyleTogglesCallback);
   polyLineToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::lineStyleTogglesCallback);

   // add line style toggles to array for radio-button behavior
   lineStyleToggles.push_back(noneLineToggle);
   lineStyleToggles.push_back(basicLineToggle);
   lineStyleToggles.push_back(polyLineToggle);

   // create head style toggle buttons (check boxes)
   factory.createLabel("", "Head Style");
   GLMotif::ToggleButton* noneHeadToggle=factory.createCheckBox("NoneHeadToggle", "None");
   GLMotif::ToggleButton* pointHeadToggle=factory.createCheckBox("PointHeadToggle", "Point", true);
   GLMotif::ToggleButton* sphereHeadToggle=factory.createCheckBox("SphereHeadToggle", "Sphere");

   // assign callbacks for head style toggle buttons
   noneHeadToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::headStyleTogglesCallback);
   pointHeadToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::headStyleTogglesCallback);
   sphereHeadToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::headStyleTogglesCallback);

   // add head style toggles to array for radio-button behavior
   headStyleToggles.push_back(noneHeadToggle);
   headStyleToggles.push_back(pointHeadToggle);
   headStyleToggles.push_back(sphereHeadToggle);

   // create color style toggle buttons (check boxes)
   factory.createLabel("", "Color Map");
   GLMotif::ToggleButton* solidColorToggle=factory.createCheckBox("SolidColorToggle", "Solid", true);
   GLMotif::ToggleButton* gradientColorToggle=factory.createCheckBox("GradientColorToggle", "Gradient");

   // assign callbacks for color style toggle buttons
   solidColorToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::colorStyleTogglesCallback);
   gradientColorToggle->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::colorStyleTogglesCallback);

   // add color style toggles to array for radio-button behavior
   colorMapToggles.push_back(solidColorToggle);
   colorMapToggles.push_back(gradientColorToggle);

   // create spacer (newline)
   factory.createLabel("Spacer", "");

   checkBoxLayout->manageChild();

   factory.setLayout(parameterDialog);

   // create layout for sliders
   GLMotif::RowColumn* sliderLayout=factory.createRowColumn("SliderLayout", 3);
   factory.setLayout(sliderLayout);

   factory.createLabel("ReleaseSizeLabel", "Number of Particles");

   releaseSizeValue=factory.createTextField("ReleaseSizeTextField", 10);
   releaseSizeValue->setString("1");

   releaseSizeSlider=factory.createSlider("ReleaseSizeSlider", 15.0);
   releaseSizeSlider->setValueRange(1, 250, 1);
   releaseSizeSlider->setValue(1);

   releaseSizeSlider->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::sliderCallback);

   factory.createLabel("ParticleSizeLabel", "Particle Size");

   pointSizeValue=factory.createTextField("PointSizeTextField", 10);
   pointSizeValue->setString("0.25");

   pointSizeSlider=factory.createSlider("PointSizeSlider", 15.0);
   pointSizeSlider->setValueRange(0.01, 0.25, 0.01);
   pointSizeSlider->setValue(0.25);

   pointSizeSlider->getValueChangedCallbacks().add(this, &DynamicSolverOptionsDialog::sliderCallback);

   // create a push button for clearing particles and assign callback
   GLMotif::Button* clearButton=factory.createButton("ClearButton", "Clear");
   clearButton->getSelectCallbacks().add(this, &DynamicSolverOptionsDialog::clearPointsCallback);

   sliderLayout->manageChild();

   parameterDialog->manageChild();

   return parameterDialogPopup;
}
Пример #6
0
MenuItem::MenuItem(Type type, Menu* owner):
    myMenu(owner),
    myType(type),
    myListener(NULL),
    myButton(NULL),
    myCommand(NULL),
    myWidget(NULL),
    myUserData(NULL),
    mySubMenu(NULL)
{
    UiModule* ui = owner->getManager()->getUiModule();
    WidgetFactory* wf = ui->getWidgetFactory();

    if(type == MenuItem::SubMenu)
    {
        myButton = wf->createButton("subMenu_button", myMenu->myContainer);
        myButton->setText("Button");
        myWidget = myButton;
        myWidget->setUIEventHandler(this);

        mySubMenu = myMenu->getManager()->createMenu("Submenu");
    }
    else if(type == MenuItem::Button)
    {
        myButton = wf->createButton("button", myMenu->myContainer);
        myButton->setText("Button");
        myWidget = myButton;
    }
    else if(type == MenuItem::Slider)
    {
        mySlider = wf->createSlider("slider", myMenu->myContainer);
        myWidget = mySlider;
    }
    else if(type == MenuItem::Checkbox)
    {
        myButton = wf->createButton("button", myMenu->myContainer);
        myButton->setText("Checkbox");
        myButton->setCheckable(true);
        myWidget = myButton;
    }
    else if(type == MenuItem::Label)
    {
        myLabel = wf->createLabel("label", myMenu->myContainer);
        myLabel->setText("Label");
        myWidget = myLabel;
    }
    else if(type == MenuItem::Image)
    {
        myImage = wf->createImage("img", myMenu->myContainer);
        myWidget = myImage;
    }
    else if(type == MenuItem::Container)
    {
        myContainer = wf->createContainer("container", myMenu->myContainer);
        myWidget = myContainer;
    }

    //myWidget->setStyleValue("fill", "#00000090");

    myWidget->setAutosize(true);
}