Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEFilePathDialog.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
// A basic dialog for selecting a file path (used in GNEFileSelector)
19
/****************************************************************************/
20
21
#include <
netedit/GNEApplicationWindow.h
>
22
#include <
utils/foxtools/MFXTextFieldIcon.h
>
23
#include <
utils/gui/div/GUIDesigns.h
>
24
25
#include "
GNEFilePathDialog.h
"
26
27
// ===========================================================================
28
// method definitions
29
// ===========================================================================
30
31
GNEFilePathDialog::GNEFilePathDialog
(
GNEApplicationWindow
* applicationWindow,
const
std::string& title,
32
const
std::string& info,
const
std::string& originalFilePath) :
33
GNEDialog
(applicationWindow, title.c_str(),
GUIIcon
::
OPEN
,
GNEDialog
::
Buttons
::ACCEPT_CANCEL_RESET,
OpenType
::MODAL,
ResizeMode
::
STATIC
),
34
myOriginalFilePath(originalFilePath) {
35
// create dialog layout (obtained from FXMessageBox)
36
//auto infoFrame = new FXVerticalFrame(myContentFrame, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10);
37
// add information label
38
new
FXLabel(
myContentFrame
, info.c_str(),
nullptr
,
GUIDesignLabel
(JUSTIFY_NORMAL));
39
// create text field to enter the path
40
myPathTextField
=
new
MFXTextFieldIcon
(
myContentFrame
, applicationWindow->
getStaticTooltipMenu
(),
GUIIcon::EMPTY
,
41
nullptr
, 0,
GUIDesignTextField
);
42
// set original file path
43
myPathTextField
->
setText
(originalFilePath.c_str());
44
// open modal dialog
45
openDialog
();
46
}
47
48
49
GNEFilePathDialog::~GNEFilePathDialog
() {
50
}
51
52
53
void
54
GNEFilePathDialog::runInternalTest
(
const
InternalTestStep::DialogArgument
*
/*dialogArgument*/
) {
55
// nothing to do (yet)
56
}
57
58
59
std::string
60
GNEFilePathDialog::getFilePath
()
const
{
61
return
myPathTextField
->
getText
().text();
62
}
63
64
65
long
66
GNEFilePathDialog::onCmdCancel
(FXObject*, FXSelector,
void
*) {
67
// set an empty test
68
myPathTextField
->
setText
(
""
, FALSE);
69
return
closeDialogCanceling
();
70
}
71
72
73
long
74
GNEFilePathDialog::onCmdReset
(FXObject*, FXSelector,
void
*) {
75
// restore original file path
76
myPathTextField
->
setText
(
myOriginalFilePath
.c_str(), TRUE);
77
return
1;
78
}
79
80
/****************************************************************************/
GNEApplicationWindow.h
GNEFilePathDialog.h
GUIDesigns.h
GUIDesignTextField
#define GUIDesignTextField
Definition
GUIDesigns.h:74
GUIDesignLabel
#define GUIDesignLabel(justify)
Definition
GUIDesigns.h:245
GUIIcon
GUIIcon
An enumeration of icons used by the gui applications.
Definition
GUIIcons.h:33
GUIIcon::OPEN
@ OPEN
open icons
GUIIcon::EMPTY
@ EMPTY
MFXTextFieldIcon.h
TrafficLightType::STATIC
@ STATIC
GNEApplicationWindow
The main window of Netedit.
Definition
GNEApplicationWindow.h:50
GNEDialog
Definition
GNEDialog.h:36
GNEDialog::myContentFrame
FXVerticalFrame * myContentFrame
content frame
Definition
GNEDialog.h:135
GNEDialog::ResizeMode
ResizeMode
Definition
GNEDialog.h:61
GNEDialog::openDialog
void openDialog(FXWindow *focusableElement=nullptr)
open dialog
Definition
GNEDialog.cpp:173
GNEDialog::OpenType
OpenType
Open dialog type.
Definition
GNEDialog.h:55
GNEDialog::Buttons
Buttons
Definition
GNEDialog.h:41
GNEDialog::closeDialogCanceling
long closeDialogCanceling()
close dialog declining the changes
Definition
GNEDialog.cpp:243
GNEFilePathDialog::getFilePath
std::string getFilePath() const
get the file path
Definition
GNEFilePathDialog.cpp:60
GNEFilePathDialog::onCmdCancel
long onCmdCancel(FXObject *, FXSelector, void *)
called when cancel or no button is pressed (can be reimplemented in children)
Definition
GNEFilePathDialog.cpp:66
GNEFilePathDialog::~GNEFilePathDialog
~GNEFilePathDialog()
Destructor.
Definition
GNEFilePathDialog.cpp:49
GNEFilePathDialog::onCmdReset
long onCmdReset(FXObject *, FXSelector, void *)
called when reset button is pressed (must be reimplemented in children)
Definition
GNEFilePathDialog.cpp:74
GNEFilePathDialog::myOriginalFilePath
std::string myOriginalFilePath
original file path (used for reset)
Definition
GNEFilePathDialog.h:59
GNEFilePathDialog::runInternalTest
void runInternalTest(const InternalTestStep::DialogArgument *dialogArgument)
run internal test
Definition
GNEFilePathDialog.cpp:54
GNEFilePathDialog::GNEFilePathDialog
GNEFilePathDialog(GNEApplicationWindow *applicationWindow, const std::string &title, const std::string &info, const std::string &originalFilePath)
Constructor.
Definition
GNEFilePathDialog.cpp:31
GNEFilePathDialog::myPathTextField
MFXTextFieldIcon * myPathTextField
text field to enter the path
Definition
GNEFilePathDialog.h:62
GUIMainWindow::getStaticTooltipMenu
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
Definition
GUIMainWindow.cpp:209
InternalTestStep::DialogArgument
dialog arguments, used for certain modal dialogs that can not be edited using tab
Definition
InternalTestStep.h:47
MFXTextFieldIcon
Definition
MFXTextFieldIcon.h:37
MFXTextFieldIcon::getText
FXString getText() const
Get the text for this label.
Definition
MFXTextFieldIcon.cpp:2226
MFXTextFieldIcon::setText
void setText(const FXString &text, FXbool notify=FALSE)
Change the text and move cursor to end.
Definition
MFXTextFieldIcon.cpp:2197
src
netedit
dialogs
file
GNEFilePathDialog.cpp
Generated on Sat Sep 6 2025 00:08:04 for Eclipse SUMO - Simulation of Urban MObility by
1.9.8