// =========================================================================== // method definitions // =========================================================================== GUIParameterTableWindow::GUIParameterTableWindow(GUIMainWindow& app, GUIGlObject& o, int noRows) : FXMainWindow(app.getApp(), (o.getFullName() + " Parameter").c_str(), NULL, NULL, DECOR_ALL, 20, 20, 500, (FXint)((noRows + numParams(&o)) * 20 + 60)), myObject(&o), myApplication(&app), myCurrentPos(0) { noRows += numParams(&o); myTable = new FXTable(this, this, MID_TABLE, TABLE_COL_SIZABLE | TABLE_ROW_SIZABLE | LAYOUT_FILL_X | LAYOUT_FILL_Y); myTable->setVisibleRows((FXint)(noRows + 1)); myTable->setVisibleColumns(3); myTable->setTableSize((FXint)(noRows + 1), 3); myTable->setBackColor(FXRGB(255, 255, 255)); myTable->setColumnText(0, "Name"); myTable->setColumnText(1, "Value"); myTable->setColumnText(2, "Dynamic"); myTable->getRowHeader()->setWidth(0); FXHeader* header = myTable->getColumnHeader(); header->setItemJustify(0, JUSTIFY_CENTER_X); header->setItemSize(0, 240); header->setItemJustify(1, JUSTIFY_CENTER_X); header->setItemSize(1, 120); header->setItemJustify(2, JUSTIFY_CENTER_X); header->setItemSize(2, 60); setIcon(GUIIconSubSys::getIcon(ICON_APP_TABLE)); myLock.lock(); myObject->addParameterTable(this); myLock.unlock(); AbstractMutex::ScopedLocker locker(myGlobalContainerLock); myContainer.push_back(this); // Table cannot be editable myTable->setEditable(FALSE); }
void GNEFrame::openHelpAttributesDialog(SumoXMLTag elementTag) const { FXDialogBox *attributesHelpDialog = new FXDialogBox(myScrollWindowsContents, ("Parameters of " + toString(elementTag)).c_str(), GUIDesignDialogBoxResizable, 0, 0, 0, 0, 10, 10, 10, 38, 4, 4); // Create FXTable FXTable* myTable = new FXTable(attributesHelpDialog, attributesHelpDialog, MID_TABLE, GUIDesignTableNotEditable); attributesHelpDialog->setIcon(GUIIconSubSys::getIcon(ICON_MODEINSPECT)); const auto &attrs = GNEAttributeCarrier::getTagProperties(elementTag); int sizeColumnDescription = 0; int sizeColumnDefinitions = 0; myTable->setVisibleRows((FXint)(attrs.getNumberOfAttributes())); myTable->setVisibleColumns(3); myTable->setTableSize((FXint)(attrs.getNumberOfAttributes()), 3); myTable->setBackColor(FXRGB(255, 255, 255)); myTable->setColumnText(0, "Attribute"); myTable->setColumnText(1, "Description"); myTable->setColumnText(2, "Definition"); myTable->getRowHeader()->setWidth(0); // Iterate over vector of additional parameters int itemIndex = 0; for (auto i : attrs) { // Set attribute FXTableItem* attribute = new FXTableItem(toString(i.first).c_str()); attribute->setJustify(FXTableItem::CENTER_X); myTable->setItem(itemIndex, 0, attribute); // Set description of element FXTableItem* type = new FXTableItem(""); type->setText(i.second.getDescription().c_str()); sizeColumnDescription = MAX2(sizeColumnDescription, (int)i.second.getDescription().size()); type->setJustify(FXTableItem::CENTER_X); myTable->setItem(itemIndex, 1, type); // Set definition FXTableItem* definition = new FXTableItem(i.second.getDefinition().c_str()); definition->setJustify(FXTableItem::LEFT); myTable->setItem(itemIndex, 2, definition); sizeColumnDefinitions = MAX2(sizeColumnDefinitions, (int)i.second.getDefinition().size()); itemIndex++; } // set header FXHeader* header = myTable->getColumnHeader(); header->setItemJustify(0, JUSTIFY_CENTER_X); header->setItemSize(0, 120); header->setItemJustify(1, JUSTIFY_CENTER_X); header->setItemSize(1, sizeColumnDescription * 7); header->setItemJustify(2, JUSTIFY_CENTER_X); header->setItemSize(2, sizeColumnDefinitions * 6); // Create horizontal separator new FXHorizontalSeparator(attributesHelpDialog, GUIDesignHorizontalSeparator); // Create frame for OK Button FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(attributesHelpDialog, GUIDesignAuxiliarHorizontalFrame); // Create Button Close (And two more horizontal frames to center it) new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame); new FXButton(myHorizontalFrameOKButton, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), attributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK); new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame); // Write Warning in console if we're in testing mode if (OptionsCont::getOptions().getBool("gui-testing-debug")) { WRITE_WARNING("Opening HelpAttributes dialog for tag '" + toString(elementTag) + "' showing " + toString(attrs.getNumberOfAttributes()) + " attributes"); } // create Dialog attributesHelpDialog->create(); // show in the given position attributesHelpDialog->show(PLACEMENT_CURSOR); // refresh APP getApp()->refresh(); // open as modal dialog (will block all windows until stop() or stopModal() is called) getApp()->runModalFor(attributesHelpDialog); // Write Warning in console if we're in testing mode if (OptionsCont::getOptions().getBool("gui-testing-debug")) { WRITE_WARNING("Closing HelpAttributes dialog for tag '" + toString(elementTag) + "'"); } }