1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file GNEDemandElementDialog.h 11 /// @author Pablo Alvarez Lopez 12 /// @date Jan 2018 13 /// @version $Id$ 14 /// 15 // A abstract class for editing additional elements 16 /****************************************************************************/ 17 #ifndef GNEDemandElementDialog_h 18 #define GNEDemandElementDialog_h 19 20 // =========================================================================== 21 // included modules 22 // =========================================================================== 23 24 #include <config.h> 25 26 #include <fx.h> 27 #include <vector> 28 #include <utils/xml/SUMOXMLDefinitions.h> 29 30 // =========================================================================== 31 // class declarations 32 // =========================================================================== 33 34 class GNEDemandElement; 35 class GNEUndoList; 36 37 // =========================================================================== 38 // class definitions 39 // =========================================================================== 40 41 /** 42 * @class GNEDemandElementDialog 43 * @brief Dialog to edit sequences, parameters, etc.. of DemandElements 44 */ 45 class GNEDemandElementDialog : protected FXTopWindow { 46 /// @brief FOX-declaration abstract 47 FXDECLARE_ABSTRACT(GNEDemandElementDialog) 48 49 public: 50 /// @brief constructor 51 GNEDemandElementDialog(GNEDemandElement* parent, bool updatingElement, int width, int height); 52 53 /// @brief destructor 54 ~GNEDemandElementDialog(); 55 56 /// @brief get edited DemandElement 57 GNEDemandElement* getEditedDemandElement() const; 58 59 /// @name FOX-callbacks 60 /// @{ 61 /// @brief event after press accept button 62 virtual long onCmdAccept(FXObject* sender, FXSelector sel, void* ptr) = 0; 63 64 /// @brief event after press cancel button 65 virtual long onCmdCancel(FXObject* sender, FXSelector sel, void* ptr) = 0; 66 67 /// @brief event after press cancel button 68 virtual long onCmdReset(FXObject*, FXSelector, void*) = 0; 69 70 /// @brief event after press a key 71 long onKeyPress(FXObject* sender, FXSelector sel, void* ptr); 72 73 /// @brief event after release a key 74 long onKeyRelease(FXObject* sender, FXSelector sel, void* ptr); 75 76 /// @} 77 78 protected: 79 /// @brief FOX needs this GNEDemandElementDialog()80 GNEDemandElementDialog() {} 81 82 /// @brief pointer to edited aditional 83 GNEDemandElement* myEditedDemandElement; 84 85 /// @brief flag to indicate if additional are being created or modified (cannot be changed after open dialog) 86 bool myUpdatingElement; 87 88 /// @brief frame for contents 89 FXVerticalFrame* myContentFrame; 90 91 /// @brief execute dialog as modal 92 FXint openAsModalDialog(FXuint placement = PLACEMENT_CURSOR); 93 94 /// @brief change additional dialog header 95 void changeDemandElementDialogHeader(const std::string& newHeader); 96 97 /// @brief init a new group of changes that will be do it in dialog 98 void initChanges(); 99 100 /// @brief Accept changes did in this dialog. 101 void acceptChanges(); 102 103 /// @brief Cancel changes did in this dialog. 104 void cancelChanges(); 105 106 /// @brief reset changes did in this dialog. 107 void resetChanges(); 108 109 private: 110 /// @brief accept button 111 FXButton* myAcceptButton; 112 113 /// @brief cancel button 114 FXButton* myCancelButton; 115 116 /// @brief cancel button 117 FXButton* myResetButton; 118 119 /// @brief description of changes did in this additional dialog 120 std::string myChangesDescription; 121 122 /// @brief number of GNEChanges_... in dialog 123 int myNumberOfChanges; 124 125 /// @brief Invalidated copy constructor 126 GNEDemandElementDialog(const GNEDemandElementDialog&) = delete; 127 128 /// @brief Invalidated assignment operator 129 GNEDemandElementDialog& operator=(const GNEDemandElementDialog&) = delete; 130 }; 131 132 #endif 133