Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEOverwriteElement.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-2025 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
21#include <netedit/GNENet.h>
26
27#include "GNEOverwriteElement.h"
28
29// ===========================================================================
30// member method definitions
31// ===========================================================================
32
34 GNEDialog(AC->getNet()->getViewNet()->getViewParent()->getGNEAppWindows(),
35 TLF("Overwrite % '%'", AC->getTagProperty()->getTagStr(), AC->getID()), GUIIcon::QUESTION_SMALL,
36 GNEDialog::Buttons::YES_NO_CANCEL, GNEDialog::OpenType::MODAL, ResizeMode::STATIC),
37 myCommonHandler(commonHandler) {
38 // create dialog layout (obtained from FXMessageBox)
39 auto infoFrame = new FXVerticalFrame(myContentFrame, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10);
40 // add information label
41 new FXLabel(infoFrame, TLF("There is already a % '%'. Overwrite?", AC->getTagProperty()->getTagStr(), AC->getID()).c_str(),
42 nullptr, JUSTIFY_LEFT | ICON_BEFORE_TEXT | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | LAYOUT_FILL_Y);
43 // add checkButton
44 myApplySolutionToAllCheckButon = new FXCheckButton(infoFrame, TL("Apply this solution to all conflicted elements"), nullptr, 0, GUIDesignCheckButton);
45 // open modal dialog
46 openDialog();
47}
48
49
52
53
54void
56 // nothing to do
57}
58
59
60
61long
62GNEOverwriteElement::onCmdAccept(FXObject*, FXSelector, void*) {
63 if (myApplySolutionToAllCheckButon->getCheck() == TRUE) {
65 }
66 return closeDialogAccepting();
67}
68
69
70long
71GNEOverwriteElement::onCmdCancel(FXObject*, FXSelector, void*) {
72 if (myApplySolutionToAllCheckButon->getCheck() == TRUE) {
74 }
75 return closeDialogCanceling();
76}
77
78
79long
80GNEOverwriteElement::onCmdAbort(FXObject*, FXSelector, void*) {
82 return closeDialogAborting();
83}
84
85/****************************************************************************/
#define GUIDesignCheckButton
checkButton placed in left position
Definition GUIDesigns.h:194
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ QUESTION_SMALL
#define TL(string)
Definition MsgHandler.h:305
#define TLF(string,...)
Definition MsgHandler.h:307
The XML-Handler for network loading.
void forceRemainElements()
force remain elements (used if we're reloading elements)
void abortLoading()
abort loading
void forceOverwriteElements()
force overwritte elements (used if we're reloading elements)
const std::string getID() const
get ID (all Attribute Carriers have one)
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
FXVerticalFrame * myContentFrame
content frame
Definition GNEDialog.h:135
long closeDialogAborting()
close dialog aborting the changes
void openDialog(FXWindow *focusableElement=nullptr)
open dialog
long closeDialogAccepting()
close dialog accepting the changes
OpenType
Open dialog type.
Definition GNEDialog.h:55
long closeDialogCanceling()
close dialog declining the changes
long onCmdAbort(FXObject *, FXSelector, void *)
called when abort is called either closing dialog or pressing abort button (can be reimplemented in c...
long onCmdAccept(FXObject *, FXSelector, void *)
called when accept or yes button is pressed (can be reimplemented in children)
CommonHandler * myCommonHandler
pointer to common handler
long onCmdCancel(FXObject *, FXSelector, void *)
called when cancel or no button is pressed (can be reimplemented in children)
void runInternalTest(const InternalTestStep::DialogArgument *dialogArgument)
run internal test
FXCheckButton * myApplySolutionToAllCheckButon
apply solpution to all checkButton
GNEOverwriteElement(CommonHandler *commonHandler, const GNEAttributeCarrier *AC)
Constructor.
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
dialog arguments, used for certain modal dialogs that can not be edited using tab