LCOV - code coverage report
Current view: top level - src/utils/gui/div - GUIDesigns.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 31 48 64.6 %
Date: 2024-05-02 15:31:40 Functions: 7 10 70.0 %

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

Generated by: LCOV version 1.14