Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/gui/div/GUIDesigns.cpp
169684 views
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
/****************************************************************************/
14
/// @file GUIDesigns.cpp
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2020
17
///
18
// File with the definitions of standard style of FXObjects in SUMO
19
/****************************************************************************/
20
21
#include "GUIDesigns.h"
22
23
#include "utils/foxtools/MFXMenuCheckIcon.h"
24
25
26
// ===========================================================================
27
// Definitions
28
// ===========================================================================
29
30
FXMenuTitle*
31
GUIDesigns::buildFXMenuTitle(FXComposite* p, const std::string& text, FXIcon* icon, FXMenuPane* menuPane) {
32
// create menu title
33
FXMenuTitle* menuTitle = new FXMenuTitle(p, text.c_str(), icon, menuPane, LAYOUT_FIX_HEIGHT);
34
// setheight (to avoid problems between Windows und Linux)
35
menuTitle->setHeight(GUIDesignHeight);
36
// return menuTitle
37
return menuTitle;
38
}
39
40
41
FXMenuCommand*
42
GUIDesigns::buildFXMenuCommand(FXComposite* p, const std::string& text, FXIcon* icon, FXObject* tgt, FXSelector sel, const bool disable) {
43
// build menu command
44
FXMenuCommand* menuCommand = new FXMenuCommand(p, text.c_str(), icon, tgt, sel, LAYOUT_FIX_HEIGHT);
45
// set width and height (to avoid problems between Windows und Linux)
46
menuCommand->setHeight(GUIDesignHeight);
47
// check if disable after creation (used in certain parts of netedit)
48
if (disable) {
49
menuCommand->disable();
50
}
51
// return menuCommand
52
return menuCommand;
53
}
54
55
56
FXMenuCommand*
57
GUIDesigns::buildFXMenuCommand(FXComposite* p, const std::string& text, const std::string& help, FXIcon* icon, FXObject* tgt, FXSelector sel, const bool disable) {
58
// build menu command
59
FXMenuCommand* menuCommand = new FXMenuCommand(p, text.c_str(), icon, tgt, sel, LAYOUT_FIX_HEIGHT);
60
// set help
61
menuCommand->setHelpText(help.c_str());
62
// set width and height (to avoid problems between Windows und Linux)
63
menuCommand->setHeight(GUIDesignHeight);
64
// check if disable after creation (used in certain parts of netedit)
65
if (disable) {
66
menuCommand->disable();
67
}
68
// return menuCommand
69
return menuCommand;
70
}
71
72
73
FXMenuCommand*
74
GUIDesigns::buildFXMenuCommandShortcut(FXComposite* p, const std::string& text, const std::string& shortcut, const std::string& info, FXIcon* icon, FXObject* tgt, FXSelector sel) {
75
// build menu command with shortcut
76
FXMenuCommand* menuCommand = new FXMenuCommand(p, (text + "\t" + shortcut + "\t" + info).c_str(), icon, tgt, sel, LAYOUT_FIX_HEIGHT);
77
// set width and height (to avoid problems between Windows und Linux)
78
menuCommand->setHeight(GUIDesignHeight);
79
// return menuCommand
80
return menuCommand;
81
}
82
83
84
FXMenuCheck*
85
GUIDesigns::buildFXMenuCheckbox(FXComposite* p, const std::string& text, const std::string& info, FXObject* tgt, FXSelector sel) {
86
// build menu checkbox
87
FXMenuCheck* menuCheck = new FXMenuCheck(p, (text + std::string("\t\t") + info).c_str(), tgt, sel, LAYOUT_FIX_HEIGHT);
88
// set height (to avoid problems between Windows und Linux)
89
menuCheck->setHeight(GUIDesignHeight);
90
// return menuCommand
91
return menuCheck;
92
}
93
94
95
MFXMenuCheckIcon*
96
GUIDesigns::buildFXMenuCheckboxIcon(FXComposite* p, const std::string& text, const std::string& shortcut, const std::string& info, FXIcon* icon, FXObject* tgt, FXSelector sel) {
97
// build menu checkbox
98
MFXMenuCheckIcon* menuCheck = new MFXMenuCheckIcon(p, text, shortcut, info, icon, tgt, sel, LAYOUT_FIX_HEIGHT);
99
// set height (to avoid problems between Windows und Linux)
100
menuCheck->setHeight(GUIDesignHeight);
101
// return menuCommand
102
return menuCheck;
103
}
104
105
106
FXMenuCommand*
107
GUIDesigns::buildFXMenuCommandRecentFile(FXComposite* p, const std::string& text, FXObject* tgt, FXSelector sel) {
108
// build rest of menu commands
109
FXMenuCommand* menuCommand = new FXMenuCommand(p, text.c_str(), nullptr, tgt, sel, LAYOUT_FIX_HEIGHT);
110
// set width and height (to avoid problems between Windows und Linux)
111
menuCommand->setHeight(GUIDesignHeight);
112
// return menuCommand
113
return menuCommand;
114
}
115
116
117
FXLabel*
118
GUIDesigns::buildFXLabel(FXComposite* p, const std::string& text, const std::string& tip, const std::string& help, FXIcon* ic,
119
FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) {
120
FXLabel* label = new FXLabel(p, text.c_str(), ic, opts, x, y, w, h, pl, pr, pt, pb);
121
label->setTipText(tip.c_str());
122
label->setHelpText(help.c_str());
123
return label;
124
}
125
126
127
FXButton*
128
GUIDesigns::buildFXButton(FXComposite* p, const std::string& text, const std::string& tip, const std::string& help, FXIcon* ic, FXObject* tgt,
129
FXSelector sel, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) {
130
FXButton* button = new FXButton(p, text.c_str(), ic, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb);
131
button->setTipText(tip.c_str());
132
button->setHelpText(help.c_str());
133
return button;
134
}
135
136
137
FXCheckButton*
138
GUIDesigns::buildFXCheckButton(FXComposite* p, const std::string& text, const std::string& tip, const std::string& help, FXObject* tgt,
139
FXSelector sel, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) {
140
FXCheckButton* checkButton = new FXCheckButton(p, text.c_str(), tgt, sel, opts, x, y, w, h, pl, pr, pt, pb);
141
checkButton->setTipText(tip.c_str());
142
checkButton->setHelpText(help.c_str());
143
return checkButton;
144
}
145
146
147
FXRadioButton*
148
GUIDesigns::buildFXRadioButton(FXComposite* p, const std::string& text, const std::string& tip, const std::string& help, FXObject* tgt,
149
FXSelector sel, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) {
150
FXRadioButton* radioButton = new FXRadioButton(p, text.c_str(), tgt, sel, opts, x, y, w, h, pl, pr, pt, pb);
151
radioButton->setTipText(tip.c_str());
152
radioButton->setHelpText(help.c_str());
153
return radioButton;
154
}
155
156