Path: blob/main/src/netedit/dialogs/file/GNEFilePathDialog.cpp
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNEFilePathDialog.cpp14/// @author Pablo Alvarez Lopez15/// @date Aug 202516///17// A basic dialog for selecting a file path (used in GNEFileSelector)18/****************************************************************************/1920#include <netedit/GNEApplicationWindow.h>21#include <utils/foxtools/MFXTextFieldIcon.h>22#include <utils/gui/div/GUIDesigns.h>2324#include "GNEFilePathDialog.h"2526// ===========================================================================27// method definitions28// ===========================================================================2930GNEFilePathDialog::GNEFilePathDialog(GNEApplicationWindow* applicationWindow, const std::string& title,31const std::string& info, const std::string& originalFilePath) :32GNEDialog(applicationWindow, title.c_str(), GUIIcon::OPEN, DialogType::FILEPATH,33GNEDialog::Buttons::ACCEPT_CANCEL_RESET, OpenType::MODAL, ResizeMode::STATIC),34myOriginalFilePath(originalFilePath) {35// create dialog layout (obtained from FXMessageBox)36//auto infoFrame = new FXVerticalFrame(myContentFrame, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10);37// add information label38new FXLabel(myContentFrame, info.c_str(), nullptr, GUIDesignLabel(JUSTIFY_NORMAL));39// create text field to enter the path40myPathTextField = new MFXTextFieldIcon(myContentFrame, applicationWindow->getStaticTooltipMenu(), GUIIcon::EMPTY,41nullptr, 0, GUIDesignTextField);42// set original file path43myPathTextField->setText(originalFilePath.c_str());44// open modal dialog45openDialog();46}474849GNEFilePathDialog::~GNEFilePathDialog() {50}515253void54GNEFilePathDialog::runInternalTest(const InternalTestStep::DialogArgument* /*dialogArgument*/) {55// nothing to do (yet)56}575859std::string60GNEFilePathDialog::getFilePath() const {61return myPathTextField->getText().text();62}636465long66GNEFilePathDialog::onCmdCancel(FXObject*, FXSelector, void*) {67// set an empty test68myPathTextField->setText("", FALSE);69return closeDialogCanceling();70}717273long74GNEFilePathDialog::onCmdReset(FXObject*, FXSelector, void*) {75// restore original file path76myPathTextField->setText(myOriginalFilePath.c_str(), TRUE);77return 1;78}7980/****************************************************************************/818283