LCOV - code coverage report
Current view: top level - src/utils/foxtools - MFXSevenSegment.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 7 9 77.8 %
Date: 2024-04-28 15:39:05 Functions: 1 3 33.3 %

          Line data    Source code
       1             : /****************************************************************************/
       2             : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3             : // Copyright (C) 2004-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    MFXSevenSegment.h
      15             : /// @author  Mathew Robertson
      16             : /// @author  Daniel Krajzewicz
      17             : /// @author  Michael Behrisch
      18             : /// @author  Pablo Alvarez Lopez
      19             : /// @date    2004-03-19
      20             : ///
      21             : //
      22             : /****************************************************************************/
      23             : #pragma once
      24             : #include <config.h>
      25             : 
      26             : #include "fxheader.h"
      27             : 
      28             : /// @brief Seven-segment (eg LCD/watch style) widget
      29             : class MFXSevenSegment : public FXFrame {
      30             :     /// @brief FOX declaration
      31           0 :     FXDECLARE(MFXSevenSegment)
      32             : 
      33             : public:
      34             :     /// @brief create a seven segment display
      35             :     MFXSevenSegment(FXComposite* p, FXObject* tgt = NULL, FXSelector sel = 0, FXuint opts = FRAME_NONE, FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD);
      36             : 
      37             :     /// @brief destructor
      38      491504 :     virtual ~MFXSevenSegment() {}
      39             : 
      40             :     /// @brief set the text on the display
      41             :     void setText(const FXchar val);
      42             : 
      43             :     /// @brief get the text on the display
      44             :     FXchar getText() const {
      45             :         return myValue;
      46             :     }
      47             : 
      48             :     /// @brief get/set foreground color
      49             :     void setFgColor(const FXColor clr);
      50             :     FXColor getFgColor() const {
      51      742114 :         return myLCDTextColor;
      52             :     }
      53             : 
      54             :     /// @brief get/set background color
      55             :     void setBgColor(const FXColor clr);
      56             :     FXColor getBgColor() const {
      57      742114 :         return myBackGroundColor;
      58             :     }
      59             : 
      60             :     /// @brief get/set horizontal segment length
      61             :     void setHorizontal(const FXint len);
      62             :     FXint getHorizontal() const {
      63       36200 :         return myHorizontalSegmentLength;
      64             :     }
      65             : 
      66             :     /// @brief get/set vertical segment length
      67             :     void setVertical(const FXint len);
      68             :     FXint getVertical() const {
      69       36200 :         return myVerticalSegmentLength;
      70             :     }
      71             : 
      72             :     /// @brief get/set segment thickness
      73             :     void setThickness(const FXint w);
      74             :     FXint getThickness() const {
      75       36200 :         return mySegmentThickness;
      76             :     }
      77             : 
      78             :     /// @brief get/set myGroove thickness
      79             :     void setGroove(const FXint w);
      80             :     FXint getGroove() const {
      81       36200 :         return myGroove;
      82             :     }
      83             : 
      84             :     /// @brief draw/redraw object
      85             :     long onPaint(FXObject*, FXSelector, void*);
      86             : 
      87             :     /// @brief set from value
      88             :     long onCmdSetValue(FXObject*, FXSelector, void*);
      89             : 
      90             :     /// @brief set from int value
      91             :     long onCmdSetIntValue(FXObject*, FXSelector, void*);
      92             : 
      93             :     /// @brief get from int value
      94             :     long onCmdGetIntValue(FXObject*, FXSelector, void*);
      95             : 
      96             :     /// @brief set from string value
      97             :     long onCmdSetStringValue(FXObject*, FXSelector, void*);
      98             : 
      99             :     /// @brief get from string value
     100             :     long onCmdGetStringValue(FXObject*, FXSelector, void*);
     101             : 
     102             :     /// @brief let parent show tip if appropriate
     103             :     long onQueryTip(FXObject*, FXSelector, void*);
     104             : 
     105             :     /// @brief let parent show help if appropriate
     106             :     long onQueryHelp(FXObject*, FXSelector, void*);
     107             : 
     108             :     /// @brief Return minimum width
     109             :     virtual FXint getDefaultWidth();
     110             : 
     111             :     /// @brief Return minimum height
     112             :     virtual FXint getDefaultHeight();
     113             : 
     114             :     /// @brief save resources
     115             :     virtual void save(FXStream& store) const;
     116             : 
     117             :     /// @brief load resources
     118             :     virtual void load(FXStream& store);
     119             : 
     120             : protected:
     121             :     /// @brief FOX constructor
     122           0 :     FOX_CONSTRUCTOR(MFXSevenSegment)
     123             : 
     124             :     /// @brief Draws the individual segment types
     125             :     void drawTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
     126             :     void drawLeftTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
     127             :     void drawRightTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
     128             :     void drawMiddleSegment(FXDCWindow& dc, FXshort x, FXshort y);
     129             :     void drawLeftBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
     130             :     void drawRightBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
     131             :     void drawBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
     132             : 
     133             :     /// @brief Draw a seven-segment unit (each segment can be set indepentantly)
     134             :     void drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7);
     135             : 
     136             :     /// @brief Draw an alphanumeric figure (consisting of seven segments)
     137             :     virtual void drawFigure(FXDCWindow& dc, FXchar figure);
     138             : 
     139             : private:
     140             :     /// @brief The currently shown character
     141             :     FXchar myValue;
     142             : 
     143             :     /// @brief The color of the LCD text
     144             :     FXColor myLCDTextColor;
     145             : 
     146             :     /// @brief The color of the LCD background
     147             :     FXColor myBackGroundColor;
     148             : 
     149             :     /// @brief This is pixel length of a horizontal segment
     150             :     FXshort myHorizontalSegmentLength;
     151             : 
     152             :     /// @brief This is pixel length of a vertical segment
     153             :     FXshort myVerticalSegmentLength;
     154             : 
     155             :     /// @brief This is segment thickness, in pixels
     156             :     FXshort mySegmentThickness;
     157             : 
     158             :     /// @brief Groove between segments
     159             :     FXshort myGroove;
     160             : 
     161             :     /// @brief validates the sizes of the segment dimensions
     162             :     void checkSize();
     163             : };

Generated by: LCOV version 1.14