Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEOverwriteElementsDialog.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Dialog used to ask user if overwrite elements during loading
19/****************************************************************************/
20
24
26
27
28// ===========================================================================
29// FOX callback mapping
30// ===========================================================================
31
32FXDEFMAP(GNEOverwriteElementsDialog) GNEOverwriteElementsDialogMap[] = {
34 FXMAPFUNC(SEL_CLOSE, 0, GNEOverwriteElementsDialog::onCmdCancel),
35};
36
37// Object implementation
38FXIMPLEMENT(GNEOverwriteElementsDialog, FXDialogBox, GNEOverwriteElementsDialogMap, ARRAYNUMBER(GNEOverwriteElementsDialogMap))
39
40// ===========================================================================
41// member method definitions
42// ===========================================================================
43
44// ---------------------------------------------------------------------------
45// GNEOverwriteElementsDialog - methods
46// ---------------------------------------------------------------------------
47
48GNEOverwriteElementsDialog::GNEOverwriteElementsDialog(GNEApplicationWindow* applicationWindow, const std::string elementType) :
49 FXDialogBox(applicationWindow->getApp(), ("Overwrite " + elementType + " elements").c_str(), GUIDesignDialogBoxExplicit(310, 90)) {
50 // set busStop icon for this dialog
52 // create main frame
53 FXVerticalFrame* mainFrame = new FXVerticalFrame(this, GUIDesignAuxiliarFrame);
54 // create label
55 new FXLabel(mainFrame, ("Selected " + elementType + " file was already loaded.\n Continue or overwrite elements?").c_str(), nullptr, GUIDesignLabelOverwrite);
56 // create buttons centered
57 FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(mainFrame, GUIDesignHorizontalFrame);
58 new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
59 myAcceptButton = new FXButton(buttonsFrame, (TL("accept") + std::string("\t\t") + TL("load elements")).c_str(), GUIIconSubSys::getIcon(GUIIcon::ACCEPT), this, MID_GNE_SELECT, GUIDesignButtonAccept);
60 myCancelButton = new FXButton(buttonsFrame, (TL("cancel") + std::string("\t\t") + TL("cancel loading of elements")).c_str(), GUIIconSubSys::getIcon(GUIIcon::CANCEL), this, MID_GNE_SELECT, GUIDesignButtonCancel);
61 myOverwriteButton = new FXButton(buttonsFrame, (TL("overwrite") + std::string("\t\t") + TL("overwrite elements")).c_str(), GUIIconSubSys::getIcon(GUIIcon::RESET), this, MID_GNE_SELECT, GUIDesignButtonOverwrite);
62 new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame);
63 // create Dialog
64 create();
65 // show in the given position
66 show(PLACEMENT_SCREEN);
67 // refresh APP
68 getApp()->refresh();
69 // open as modal dialog (will block all windows until stop() or stopModal() is called)
70 applicationWindow->getApp()->runModalFor(this);
71}
72
73
76
77
82
83
84long
85GNEOverwriteElementsDialog::onCmdSelectOption(FXObject* obj, FXSelector, void*) {
86 if (obj == myAcceptButton) {
88 } else if (obj == myOverwriteButton) {
90 }
91 // Stop Modal
92 getApp()->stopModal(this, FALSE);
93 return 1;
94}
95
96long
97GNEOverwriteElementsDialog::onCmdClose(FXObject*, FXSelector, void*) {
98 // Stop Modal
99 getApp()->stopModal(this, FALSE);
100 return 1;
101}
102
103/****************************************************************************/
FXDEFMAP(GNEOverwriteElementsDialog) GNEOverwriteElementsDialogMap[]
@ MID_GNE_SELECT
select element
Definition GUIAppEnum.h:925
#define GUIDesignDialogBoxExplicit(width, height)
design for dialog box with specific width and height (for example, additional dialogs)
Definition GUIDesigns.h:603
#define GUIDesignButtonAccept
Accept Button.
Definition GUIDesigns.h:151
#define GUIDesignButtonCancel
Cancel Button.
Definition GUIDesigns.h:157
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition GUIDesigns.h:394
#define GUIDesignLabelOverwrite
label extended over frame without thick and with text justify to left
Definition GUIDesigns.h:256
#define GUIDesignButtonOverwrite
overwrite Button
Definition GUIDesigns.h:166
#define GUIDesignAuxiliarFrame
design for auxiliar (Without borders) frame extended in all directions
Definition GUIDesigns.h:385
#define GUIDesignHorizontalFrame
Horizontal frame extended over frame parent with padding and spacing.
Definition GUIDesigns.h:323
@ SUPERMODEDEMAND
#define TL(string)
Definition MsgHandler.h:287
The main window of Netedit.
long onCmdClose(FXObject *obj, FXSelector, void *)
event when dialog is closed
FXButton * myAcceptButton
FOX need this.
Result myResult
result (by default cancel)
FXButton * myOverwriteButton
button for overwritte
long onCmdSelectOption(FXObject *obj, FXSelector, void *)
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Definition json.hpp:4471