38#define MINNAMEWIDTH 200
67 const
std::
string& name, const
std::
string& description, const
std::
string& defaultValue) :
69 myGUIDialogOptions(GUIDialogOptions),
72 myDescription(description),
73 myDefaultValue(defaultValue) {
77 myNameLabel->setTipText(description.c_str());
114 if (getValue() != myDefaultValue) {
115 myResetButton->enable();
117 myResetButton->disable();
127 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
128 InputOption(GUIDialogOptions, parent, topic, name, description, defaultValue) {
137 myStringTextField->setText(myGUIDialogOptions->myOptionsContainer.getString(myName).c_str());
143 myStringTextField->setText(myGUIDialogOptions->myOriginalOptionsContainer.getString(myName).c_str());
149 myGUIDialogOptions->myOptionsContainer.resetWritable();
150 myGUIDialogOptions->myOptionsContainer.set(myName, myStringTextField->getText().text());
151 myGUIDialogOptions->myOptionsModified =
true;
158 myStringTextField->setText(myDefaultValue.c_str());
165 return myStringTextField->getText().text();
170 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
171 InputOption(GUIDialogOptions, parent, topic, name, description, defaultValue) {
179 myStringVectorTextField->setText(
toString(myGUIDialogOptions->myOptionsContainer.getStringVector(myName)).c_str());
185 myStringVectorTextField->setText(
toString(myGUIDialogOptions->myOriginalOptionsContainer.getStringVector(myName)).c_str());
191 myGUIDialogOptions->myOptionsContainer.resetWritable();
192 myGUIDialogOptions->myOptionsContainer.set(myName, myStringVectorTextField->getText().text());
193 myGUIDialogOptions->myOptionsModified =
true;
200 myStringVectorTextField->setText(myDefaultValue.c_str());
207 return myStringVectorTextField->getText().text();
215 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
216 InputOption(GUIDialogOptions, parent, topic, name, description, defaultValue) {
224 if (myGUIDialogOptions->myOptionsContainer.getBool(myName)) {
225 myCheckButton->setCheck(TRUE);
226 myCheckButton->setText(
TL(
"true"));
228 myCheckButton->setCheck(FALSE);
229 myCheckButton->setText(
TL(
"false"));
236 if (myGUIDialogOptions->myOriginalOptionsContainer.getBool(myName)) {
237 myCheckButton->setCheck(TRUE);
238 myCheckButton->setText(
TL(
"true"));
240 myCheckButton->setCheck(FALSE);
241 myCheckButton->setText(
TL(
"false"));
248 myGUIDialogOptions->myOptionsContainer.resetWritable();
249 if (myCheckButton->getCheck()) {
250 myGUIDialogOptions->myOptionsContainer.set(myName,
"true");
251 myCheckButton->setText(
TL(
"true"));
253 myGUIDialogOptions->myOptionsContainer.set(myName,
"false");
254 myCheckButton->setText(
TL(
"false"));
256 myGUIDialogOptions->myOptionsModified =
true;
258 if ((myName ==
"gui-testing-debug") && myGUIDialogOptions->myOptionsContainer.isSet(
"gui-testing-debug")) {
261 if ((myName ==
"gui-testing-debug-gl") && myGUIDialogOptions->myOptionsContainer.isSet(
"gui-testing-debug-gl")) {
271 myCheckButton->setCheck(TRUE);
272 myCheckButton->setText(
TL(
"true"));
274 myCheckButton->setCheck(FALSE);
275 myCheckButton->setText(
TL(
"false"));
283 return myCheckButton->getCheck() ?
"true" :
"false";
291 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
292 InputOption(GUIDialogOptions, parent, topic, name, description, defaultValue) {
300 myIntTextField->setText(
toString(myGUIDialogOptions->myOptionsContainer.getInt(myName)).c_str());
306 myIntTextField->setText(
toString(myGUIDialogOptions->myOriginalOptionsContainer.getInt(myName)).c_str());
312 if (myIntTextField->getText().empty()) {
313 myIntTextField->setText(myDefaultValue.c_str());
315 myGUIDialogOptions->myOptionsContainer.resetWritable();
316 myGUIDialogOptions->myOptionsContainer.set(myName, myIntTextField->getText().text());
317 myGUIDialogOptions->myOptionsModified =
true;
325 myIntTextField->setText(myDefaultValue.c_str());
332 return myIntTextField->getText().text();
340 const std::string& topic,
const std::string& name,
const std::string& description,
const std::string& defaultValue) :
341 InputOption(GUIDialogOptions, parent, topic, name, description, defaultValue) {
350 myIntVectorTextField->setText(
toString(myGUIDialogOptions->myOptionsContainer.getIntVector(myName)).c_str());
356 myIntVectorTextField->setText(
toString(myGUIDialogOptions->myOriginalOptionsContainer.getIntVector(myName)).c_str());
365 for (
const auto& intValue : intVector) {
368 myGUIDialogOptions->myOptionsContainer.resetWritable();
369 myGUIDialogOptions->myOptionsContainer.set(myName, myIntVectorTextField->getText().text());
370 myIntVectorTextField->setTextColor(FXRGB(0, 0, 0));
371 myGUIDialogOptions->myOptionsModified =
true;
373 myIntVectorTextField->setTextColor(FXRGB(255, 0, 0));
381 myIntVectorTextField->setText(myDefaultValue.c_str());
388 return myIntVectorTextField->getText().text();
396 const std::string& name,
const std::string& description,
const std::string& defaultValue) :
397 InputOption(GUIDialogOptions, parent, topic, name, description, parseFloat(defaultValue)) {
406 myFloatTextField->setText(
toString(myGUIDialogOptions->myOptionsContainer.getFloat(myName)).c_str());
412 myFloatTextField->setText(
toString(myGUIDialogOptions->myOriginalOptionsContainer.getFloat(myName)).c_str());
419 if (myFloatTextField->getText().empty()) {
420 myFloatTextField->setText(myDefaultValue.c_str());
422 myGUIDialogOptions->myOptionsContainer.resetWritable();
423 myGUIDialogOptions->myOptionsContainer.set(myName, myFloatTextField->getText().text());
424 myGUIDialogOptions->myOptionsModified =
true;
432 myFloatTextField->setText(myDefaultValue.c_str());
439 return myFloatTextField->getText().text();
457 const std::string& name,
const std::string& description,
const std::string& defaultValue) :
458 InputOption(GUIDialogOptions, parent, topic, name, description, parseTime(defaultValue)) {
467 myTimeTextField->setText(
toString(myGUIDialogOptions->myOptionsContainer.getString(myName)).c_str());
473 myTimeTextField->setText(
toString(myGUIDialogOptions->myOriginalOptionsContainer.getString(myName)).c_str());
480 if (myTimeTextField->getText().empty()) {
481 myTimeTextField->setText(myDefaultValue.c_str());
483 myGUIDialogOptions->myOptionsContainer.resetWritable();
484 myGUIDialogOptions->myOptionsContainer.set(myName, myTimeTextField->getText().text());
485 myGUIDialogOptions->myOptionsModified =
true;
493 myTimeTextField->setText(myDefaultValue.c_str());
500 return myTimeTextField->getText().text();
518 const std::string& name,
const std::string& description,
const std::string& defaultValue) :
519 InputOption(GUIDialogOptions, parent, topic, name, description, defaultValue) {
529 myFilenameTextField->setText(myGUIDialogOptions->myOptionsContainer.getString(myName).c_str());
535 myFilenameTextField->setText(myGUIDialogOptions->myOriginalOptionsContainer.getString(myName).c_str());
544 if (file.size() > 0) {
545 myFilenameTextField->setText(file.c_str(), TRUE);
554 myGUIDialogOptions->myOptionsContainer.resetWritable();
555 myGUIDialogOptions->myOptionsContainer.set(myName, myFilenameTextField->getText().text());
556 myFilenameTextField->setTextColor(FXRGB(0, 0, 0));
557 myGUIDialogOptions->myOptionsModified =
true;
559 myFilenameTextField->setTextColor(FXRGB(255, 0, 0));
567 myFilenameTextField->setText(myDefaultValue.c_str());
577 return myFilenameTextField->getText().text();
FXDEFMAP(GNEOptionsDialogElements::InputOption) InputOptionMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_GNE_SET_ATTRIBUTE_DIALOG
attribute edited trough dialog
@ MID_GNE_RESET
reset element
#define GUIDesignButtonIcon
button only with icon
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignTextFieldRestricted(type)
text field extended over Frame with thick frame (int)
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
OptionsCont & myOptionsContainer
reference to edited Option container
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void enableDebugGLMessages(bool enable)
enable/disable gl-debug messages
static void enableDebugMessages(bool enable)
enable/disable debug messages
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
const IntVector & getIntVector(const std::string &name) const
Returns the list of integer-value of the named option (only for Option_IntVector)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static bool isValidFilename(const std::string &value)
whether the given string is a valid attribute for a filename (for example, a name)
std::vector< std::string > getVector()
return vector of strings
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
static std::string openFileDialog(FXWindow *window, bool save, bool multi)
open general file dialog