Path: blob/main/src/netedit/dialogs/file/GNEFileDialog.h
193808 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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 GNEFileDialog.h14/// @author Pablo Alvarez Lopez15/// @date Aug 202516///17// Dialog used for opening/saving files18/****************************************************************************/19#pragma once20#include <config.h>2122#include <netedit/dialogs/GNEDialog.h>2324// ===========================================================================25// class declaration26// ===========================================================================2728class GNEFileSelector;2930// ===========================================================================31// class definitions32// ===========================================================================3334class GNEFileDialog : public GNEDialog {3536public:37/// @brief file open mode38enum class OpenMode {39SAVE, // A single file, existing or not (to save to)40LOAD_SINGLE, // An existing file (to load)41LOAD_MULTIPLE, // Multiple existing files42LOAD_DIRECTORY // Existing directory, including '.' or '..'43};4445/// @brief config type46enum class ConfigType {47SUMO, // sumo config48NETEDIT, // netedit config49};5051/// @brief constructor52GNEFileDialog(GNEApplicationWindow* applicationWindow, const std::string elementFile,53const std::vector<std::string>& extensions, GNEFileDialog::OpenMode openMode,54GNEFileDialog::ConfigType configType, const std::string initialFolder = "");5556/// @brief constructor with dialog parent57GNEFileDialog(GNEApplicationWindow* applicationWindow, GNEDialog* parentDialog,58const std::string elementFile, const std::vector<std::string>& extensions,59GNEFileDialog::OpenMode openMode, GNEFileDialog::ConfigType configType,60const std::string initialFolder = "");6162/// @brief destructor63~GNEFileDialog();6465/// @brief run internal test66void runInternalTest(const InternalTestStep::DialogArgument* dialogArgument);6768/// @brief Return file name, if any69std::string getFilename() const;7071/// @brief Return empty-string terminated list of selected file names, or NULL if none selected72std::vector<std::string> getFilenames() const;7374/// @brief Return directory75std::string getDirectory() const;7677/// @brief check extensions78std::string assureExtension(const std::string& filename) const;7980/// @name FOX-callbacks81/// @{8283/// @brief called when accept or yes button is pressed (can be reimplemented in children)84long onCmdAccept(FXObject*, FXSelector, void*);8586/// @}8788protected:89/// @brief the file selector widget90GNEFileSelector* myFileSelector;9192private:93/// @brief builder94void buildFileDialog(const std::string elementFile, const std::vector<std::string>& extensions,95GNEFileDialog::OpenMode openMode, GNEFileDialog::ConfigType configType,96const std::string initialFolder);9798/// @brief invalidate copy constructor99GNEFileDialog(const GNEFileDialog&) = delete;100101/// @brief invalidate assignment operator102GNEFileDialog& operator=(const GNEFileDialog&) = delete;103};104105106