Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-2024 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 60264 : GUIDesigns::buildFXMenuTitle(FXComposite* p, const std::string& text, FXIcon* icon, FXMenuPane* menuPane) {
32 : // create menu title
33 60264 : FXMenuTitle* menuTitle = new FXMenuTitle(p, text.c_str(), icon, menuPane, LAYOUT_FIX_HEIGHT);
34 : // setheight (to avoid problems between Windows und Linux)
35 60264 : menuTitle->setHeight(GUIDesignHeight);
36 : // return menuTitle
37 60264 : return menuTitle;
38 : }
39 :
40 :
41 : FXMenuCommand*
42 323919 : GUIDesigns::buildFXMenuCommand(FXComposite* p, const std::string& text, FXIcon* icon, FXObject* tgt, FXSelector sel, const bool disable) {
43 : // build menu command
44 323919 : 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 323919 : menuCommand->setHeight(GUIDesignHeight);
47 : // check if disable after creation (used in certain parts of netedit)
48 323919 : if (disable) {
49 0 : menuCommand->disable();
50 : }
51 : // return menuCommand
52 323919 : return menuCommand;
53 : }
54 :
55 :
56 : FXMenuCommand*
57 0 : 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 0 : FXMenuCommand* menuCommand = new FXMenuCommand(p, text.c_str(), icon, tgt, sel, LAYOUT_FIX_HEIGHT);
60 : // set help
61 0 : menuCommand->setHelpText(help.c_str());
62 : // set width and height (to avoid problems between Windows und Linux)
63 0 : menuCommand->setHeight(GUIDesignHeight);
64 : // check if disable after creation (used in certain parts of netedit)
65 0 : if (disable) {
66 0 : menuCommand->disable();
67 : }
68 : // return menuCommand
69 0 : return menuCommand;
70 : }
71 :
72 :
73 : FXMenuCommand*
74 429381 : 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 858762 : 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 429381 : menuCommand->setHeight(GUIDesignHeight);
79 : // return menuCommand
80 429381 : return menuCommand;
81 : }
82 :
83 :
84 : FXMenuCheck*
85 67797 : GUIDesigns::buildFXMenuCheckbox(FXComposite* p, const std::string& text, const std::string& info, FXObject* tgt, FXSelector sel) {
86 : // build menu checkbox
87 135594 : 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 67797 : menuCheck->setHeight(GUIDesignHeight);
90 : // return menuCommand
91 67797 : return menuCheck;
92 : }
93 :
94 :
95 : MFXMenuCheckIcon*
96 0 : 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 0 : 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 0 : menuCheck->setHeight(GUIDesignHeight);
101 : // return menuCommand
102 0 : return menuCheck;
103 : }
104 :
105 :
106 : FXMenuCommand*
107 150660 : GUIDesigns::buildFXMenuCommandRecentFile(FXComposite* p, const std::string& text, FXObject* tgt, FXSelector sel) {
108 : // build rest of menu commands
109 150660 : 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 150660 : menuCommand->setHeight(GUIDesignHeight);
112 : // return menuCommand
113 150660 : return menuCommand;
114 : }
115 :
116 :
117 : FXLabel*
118 45198 : 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 45198 : FXLabel* label = new FXLabel(p, text.c_str(), ic, opts, x, y, w, h, pl, pr, pt, pb);
121 90396 : label->setTipText(tip.c_str());
122 90396 : label->setHelpText(help.c_str());
123 45198 : return label;
124 : }
125 :
126 :
127 : FXButton*
128 33831 : 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 33831 : FXButton* button = new FXButton(p, text.c_str(), ic, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb);
131 67662 : button->setTipText(tip.c_str());
132 67662 : button->setHelpText(help.c_str());
133 33831 : return button;
134 : }
135 :
136 :
137 : FXRadioButton*
138 0 : GUIDesigns::buildFXRadioButton(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 0 : FXRadioButton* radioButton = new FXRadioButton(p, text.c_str(), tgt, sel, opts, x, y, w, h, pl, pr, pt, pb);
141 0 : radioButton->setTipText(tip.c_str());
142 0 : radioButton->setHelpText(help.c_str());
143 0 : return radioButton;
144 : }
|