Path: blob/main/src/netedit/dialogs/file/GNEFileDialog.h
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 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);5556/// @brief destructor57~GNEFileDialog();5859/// @brief run internal test60void runInternalTest(const InternalTestStep::DialogArgument* dialogArgument);6162/// @brief Return file name, if any63std::string getFilename() const;6465/// @brief Return empty-string terminated list of selected file names, or NULL if none selected66std::vector<std::string> getFilenames() const;6768/// @brief Return directory69std::string getDirectory() const;7071/// @name FOX-callbacks72/// @{7374/// @brief called when accept or yes button is pressed (can be reimplemented in children)75long onCmdAccept(FXObject*, FXSelector, void*);7677/// @}7879protected:80/// @brief the file selector widget81GNEFileSelector* myFileSelector;8283private:84/// @brief check extensions85std::string assureExtension(const std::string& filename) const;8687/// @brief invalidate copy constructor88GNEFileDialog(const GNEFileDialog&) = delete;8990/// @brief invalidate assignment operator91GNEFileDialog& operator=(const GNEFileDialog&) = delete;92};939495