Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MFXUtils Class Reference

Some helper functions for FOX. More...

#include <MFXUtils.h>

Static Public Member Functions

static FXString assureExtension (const FXString &filename, const FXString &defaultExtension)
 Corrects missing extension.
 
static void deleteChildren (FXWindow *w)
 Deletes all children of the given window.
 
static FXString getDocumentName (const FXString &filename)
 Returns the document name.
 
static FXString getFilename2Write (FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString &currentFolder)
 Returns the file name to write.
 
static FXColor getFXColor (const RGBColor &col)
 converts FXColor to RGBColor
 
static RGBColor getRGBColor (FXColor col)
 converts FXColor to RGBColor
 
static FXString getTitleText (const FXString &appname, FXString filename="")
 Returns the title text in dependence to an optional file name.
 
static FXbool userPermitsOverwritingWhenFileExists (FXWindow *const parent, const FXString &file)
 Returns true if either the file given by its name does not exist or the user allows overwriting it.
 

Detailed Description

Some helper functions for FOX.

Definition at line 37 of file MFXUtils.h.

Member Function Documentation

◆ assureExtension()

FXString MFXUtils::assureExtension ( const FXString &  filename,
const FXString &  defaultExtension 
)
static

Corrects missing extension.

At first, the extension is determined. If there is none, the given default extension is appended to the file name/path. Otherwise the file name/path remains as is. The so obtained correct file name is returned.

Parameters
[in]filenameThe filename to evaluate
[in]defaultExtensionThe default extension to use
Returns
The corrected filename (with extension if no one was given

Definition at line 69 of file MFXUtils.cpp.

Referenced by getFilename2Write(), GUIApplicationWindow::onCmdSaveConfig(), GUIApplicationWindow::onCmdSaveState(), and GNEApplicationWindowHelper::openFileDialog().

Here is the caller graph for this function:

◆ deleteChildren()

void MFXUtils::deleteChildren ( FXWindow *  w)
static

Deletes all children of the given window.

Parameters
[in]wThe window to delete all of his children

Definition at line 30 of file MFXUtils.cpp.

Referenced by GUIDialog_ViewSettings::rebuildColorMatrix(), and GUIDialog_ViewSettings::rebuildScaleMatrix().

Here is the caller graph for this function:

◆ getDocumentName()

FXString MFXUtils::getDocumentName ( const FXString &  filename)
static

Returns the document name.

Removes the path first. Then, returns the part before the first '.' occurrence of the so obtained string.

Parameters
[in]filenameThe file name (including the path) to obtain the name of
Returns
The name (without the path and the extension)

Definition at line 54 of file MFXUtils.cpp.

Referenced by getTitleText().

Here is the caller graph for this function:

◆ getFilename2Write()

FXString MFXUtils::getFilename2Write ( FXWindow *  parent,
const FXString &  header,
const FXString &  extension,
FXIcon *  icon,
FXString &  currentFolder 
)
static

Returns the file name to write.

A somehow complete procedure for determining the file name of a file to write. Builds a file dialog, checks whether a file was chosen, if so, checks whether it's not existing or the user allows to overwrite it etc.

Returns an empty string if the file shall not be created, the filename if it shall.

Parameters
[in]parentThe window needed to display dialogs
[in]headerTitle of the save-dialog
[in]extensionThe extension the file should have (must be in the form '.xxx'
[in]iconThe icon the dialog should have
[in]currentFolderThe string into which the information about the current folder shall be saved
Returns
The name of the file to write

Definition at line 82 of file MFXUtils.cpp.

References assureExtension(), and userPermitsOverwritingWhenFileExists().

Referenced by GUIDialog_ViewSettings::onCmdExportSetting(), GUIDialog_Breakpoints::onCmdSave(), GNESelectorFrame::SelectionOperation::onCmdSave(), GUIDialog_GLChosenEditor::onCmdSave(), GUIParameterTracker::onCmdSave(), GUIDialog_EditViewport::onCmdSave(), GNEMultipleParametersDialog::ParametersOperations::onCmdSaveParameters(), GNESingleParametersDialog::ParametersOperations::onCmdSaveParameters(), GNEVTypeDistributionsDialog::ParametersOperations::onCmdSaveParameters(), GNETLSEditorFrame::TLSFile::onCmdSaveTLSProgram(), GUIDialog_ViewSettings::onCmdSaveXMLDecals(), GNEFixDemandElements::FixOptions::saveContents(), and GNEFixNetworkElements::FixOptions::saveContents().

Here is the caller graph for this function:

◆ getFXColor()

FXColor MFXUtils::getFXColor ( const RGBColor col)
static

converts FXColor to RGBColor

Definition at line 112 of file MFXUtils.cpp.

References RGBColor::alpha(), RGBColor::blue(), RGBColor::green(), and RGBColor::red().

Referenced by GUIDialog_ViewSettings::build3DFrame(), GUIDialog_ViewSettings::buildAdditionalsFrame(), GUIDialog_ViewSettings::buildBackgroundFrame(), GUIDialog_ViewSettings::buildDemandFrame(), GUIDialog_ViewSettings::buildPersonsFrame(), GNEFrame::buildRainbow(), GUIDialog_ViewSettings::buildSelectionFrame(), GNETLSEditorFrame::TLSAttributes::clearTLSAttributes(), GNEAdditionalFrame::E2MultilaneLegendModule::E2MultilaneLegendModule(), GUIPropertySchemeStorage< T >::fill(), GNEInternalLane::getPopUpMenu(), GNELane::getPopUpMenu(), GNEPathLegendModule::GNEPathLegendModule(), GNEPlanCreatorLegend::GNEPlanCreatorLegend(), GNECrossingFrame::Information::Information(), GNEMoveFrame::Information::Information(), GNETLSEditorFrame::TLSAttributes::initTLSAttributes(), GNETLSEditorFrame::TLSAttributes::isValidOffset(), GNETLSEditorFrame::TLSAttributes::isValidParameters(), GNEConnectorFrame::Legend::Legend(), GNEProhibitionFrame::Legend::Legend(), GNETAZRelDataFrame::Legend::Legend(), GUIDialog_ViewSettings::NamePanel::NamePanel(), GUIApplicationWindow::onCmdGaming(), GUIDialog_ViewSettings::onCmdNameChange(), GNEAttributesCreatorRow::onCmdOpenColorDialog(), GNEAttributesEditorRow::onCmdOpenColorDialog(), GNETAZFrame::TAZParameters::onCmdSetColorAttribute(), GNEVehicleTypeDialog::VTypeAttributes::VTypeAttributeRow::openColorDialog(), GUIDialog_ViewSettings::rebuildColorMatrix(), GNETLSEditorFrame::TLSAttributes::setOffset(), GNETLSEditorFrame::TLSAttributes::setParameters(), GNETAZFrame::TAZEdgesGraphic::TAZEdgesGraphic(), and GUIDialog_ViewSettings::NamePanel::update().

Here is the caller graph for this function:

◆ getRGBColor()

RGBColor MFXUtils::getRGBColor ( FXColor  col)
static

◆ getTitleText()

FXString MFXUtils::getTitleText ( const FXString &  appname,
FXString  filename = "" 
)
static

Returns the title text in dependence to an optional file name.

The title is computed as default on windows: The application name only if no file name is given. If a file name is given, it is used without the extension, extended by the application name.

Parameters
[in]appnameThe name of the application to return the title of
[in]appnameThe name of the file loaded by the application
Returns
The built title

Definition at line 60 of file MFXUtils.cpp.

References getDocumentName().

Referenced by GUIApplicationWindow::closeAllWindows(), GUIApplicationWindow::dependentBuild(), GNEApplicationWindow::handleEvent_NetworkLoaded(), GUIApplicationWindow::handleEvent_SimulationLoaded(), and GNEApplicationWindow::onCmdSaveNetworkAs().

Here is the caller graph for this function:

◆ userPermitsOverwritingWhenFileExists()

FXbool MFXUtils::userPermitsOverwritingWhenFileExists ( FXWindow *const  parent,
const FXString &  file 
)
static

Returns true if either the file given by its name does not exist or the user allows overwriting it.

If the named file does not exist, true is returned. Otherwise, a message box is prompted that asks whether the file may be replaced. If the user answers "yes" in this case, true is returned. In any other cases ("no"/"cancel"), false.

Parameters
[in]parentA parent window needed to prompt the dialog box
[in]fileThe file to check whether it may be generated
Returns
Whether the named file may be written

Definition at line 39 of file MFXUtils.cpp.

Referenced by getFilename2Write(), GUISUMOViewParent::onCmdMakeSnapshot(), GNEViewParent::onCmdMakeSnapshot(), GUIApplicationWindow::onCmdSaveConfig(), GUIApplicationWindow::onCmdSaveState(), and GNEApplicationWindowHelper::openFileDialog().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: