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 60784 : GUIDesigns::buildFXMenuTitle(FXComposite* p, const std::string& text, FXIcon* icon, FXMenuPane* menuPane) {
32 : // create menu title
33 60784 : FXMenuTitle* menuTitle = new FXMenuTitle(p, text.c_str(), icon, menuPane, LAYOUT_FIX_HEIGHT);
34 : // setheight (to avoid problems between Windows und Linux)
35 60784 : menuTitle->setHeight(GUIDesignHeight);
36 : // return menuTitle
37 60784 : return menuTitle;
38 : }
39 :
40 :
41 : FXMenuCommand*
42 326714 : GUIDesigns::buildFXMenuCommand(FXComposite* p, const std::string& text, FXIcon* icon, FXObject* tgt, FXSelector sel, const bool disable) {
43 : // build menu command
44 326714 : 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 326714 : menuCommand->setHeight(GUIDesignHeight);
47 : // check if disable after creation (used in certain parts of netedit)
48 326714 : if (disable) {
49 0 : menuCommand->disable();
50 : }
51 : // return menuCommand
52 326714 : 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 433086 : 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 866172 : 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 433086 : menuCommand->setHeight(GUIDesignHeight);
79 : // return menuCommand
80 433086 : return menuCommand;
81 : }
82 :
83 :
84 : FXMenuCheck*
85 68382 : GUIDesigns::buildFXMenuCheckbox(FXComposite* p, const std::string& text, const std::string& info, FXObject* tgt, FXSelector sel) {
86 : // build menu checkbox
87 136764 : 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 68382 : menuCheck->setHeight(GUIDesignHeight);
90 : // return menuCommand
91 68382 : 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 151960 : GUIDesigns::buildFXMenuCommandRecentFile(FXComposite* p, const std::string& text, FXObject* tgt, FXSelector sel) {
108 : // build rest of menu commands
109 151960 : 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 151960 : menuCommand->setHeight(GUIDesignHeight);
112 : // return menuCommand
113 151960 : return menuCommand;
114 : }
115 :
116 :
117 : FXLabel*
118 45588 : 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 45588 : FXLabel* label = new FXLabel(p, text.c_str(), ic, opts, x, y, w, h, pl, pr, pt, pb);
121 91176 : label->setTipText(tip.c_str());
122 91176 : label->setHelpText(help.c_str());
123 45588 : return label;
124 : }
125 :
126 :
127 : FXButton*
128 34100 : 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 34100 : FXButton* button = new FXButton(p, text.c_str(), ic, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb);
131 68200 : button->setTipText(tip.c_str());
132 68200 : button->setHelpText(help.c_str());
133 34100 : 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 : }
|