LCOV - code coverage report
Current view: top level - src/utils/foxtools - MFXButtonTooltip.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 15 15 100.0 %
Date: 2024-04-27 15:34:54 Functions: 7 8 87.5 %

          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    MFXButtonTooltip.cpp
      15             : /// @author  Angelo Banse
      16             : /// @date    2022-06-21
      17             : ///
      18             : // Button similar to FXButton but with the possibility of showing tooltips
      19             : /****************************************************************************/
      20             : #include <config.h>
      21             : 
      22             : #include "MFXButtonTooltip.h"
      23             : 
      24             : 
      25             : FXDEFMAP(MFXButtonTooltip) MFXButtonTooltipMap[] = {
      26             :     FXMAPFUNC(SEL_ENTER,    0,  MFXButtonTooltip::onEnter),
      27             :     FXMAPFUNC(SEL_LEAVE,    0,  MFXButtonTooltip::onLeave),
      28             :     FXMAPFUNC(SEL_MOTION,   0,  MFXButtonTooltip::onMotion),
      29             : };
      30             : 
      31             : 
      32             : // Object implementation
      33    49366442 : FXIMPLEMENT(MFXButtonTooltip, FXButton, MFXButtonTooltipMap, ARRAYNUMBER(MFXButtonTooltipMap))
      34             : 
      35      150915 : MFXButtonTooltip::MFXButtonTooltip(FXComposite* p, MFXStaticToolTip* staticToolTip,
      36             :                                    const std::string& text, FXIcon* ic,
      37             :                                    FXObject* tgt, FXSelector sel, FXuint opts,
      38             :                                    FXint x, FXint y, FXint w, FXint h,
      39      150915 :                                    FXint pl, FXint pr, FXint pt, FXint pb) :
      40             :     FXButton(p, text.c_str(), ic, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb),
      41      150915 :     myStaticToolTip(staticToolTip) {
      42      150915 : }
      43             : 
      44             : 
      45      301082 : MFXButtonTooltip::~MFXButtonTooltip() {}
      46             : 
      47             : 
      48             : long
      49          21 : MFXButtonTooltip::onEnter(FXObject* sender, FXSelector sel, void* ptr) {
      50             :     // show tip show
      51          21 :     myStaticToolTip->showStaticToolTip(getTipText());
      52          21 :     return FXButton::onEnter(sender, sel, ptr);
      53             : }
      54             : 
      55             : 
      56             : long
      57          18 : MFXButtonTooltip::onLeave(FXObject* sender, FXSelector sel, void* ptr) {
      58             :     // hide static toolTip
      59          18 :     myStaticToolTip->hideStaticToolTip();
      60          18 :     return FXButton::onLeave(sender, sel, ptr);
      61             : }
      62             : 
      63             : 
      64             : long
      65          78 : MFXButtonTooltip::onMotion(FXObject* sender, FXSelector sel, void* ptr) {
      66             :     // update static tooltip
      67          78 :     myStaticToolTip->onUpdate(sender, sel, ptr);
      68          78 :     return FXButton::onMotion(sender, sel, ptr);
      69             : }
      70             : 
      71             : /****************************************************************************/

Generated by: LCOV version 1.14