/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2004-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file MFXSevenSegment.h14/// @author Mathew Robertson15/// @author Daniel Krajzewicz16/// @author Michael Behrisch17/// @author Pablo Alvarez Lopez18/// @date 2004-03-1919///20//21/****************************************************************************/22#pragma once23#include <config.h>2425#include "fxheader.h"2627/// @brief Seven-segment (eg LCD/watch style) widget28class MFXSevenSegment : public FXFrame {29/// @brief FOX declaration30FXDECLARE(MFXSevenSegment)3132public:33/// @brief create a seven segment display34MFXSevenSegment(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);3536/// @brief destructor37virtual ~MFXSevenSegment() {}3839/// @brief set the text on the display40void setText(const FXchar val);4142/// @brief get the text on the display43FXchar getText() const {44return myValue;45}4647/// @brief get/set foreground color48void setFgColor(const FXColor clr);49FXColor getFgColor() const {50return myLCDTextColor;51}5253/// @brief get/set background color54void setBgColor(const FXColor clr);55FXColor getBgColor() const {56return myBackGroundColor;57}5859/// @brief get/set horizontal segment length60void setHorizontal(const FXint len);61FXint getHorizontal() const {62return myHorizontalSegmentLength;63}6465/// @brief get/set vertical segment length66void setVertical(const FXint len);67FXint getVertical() const {68return myVerticalSegmentLength;69}7071/// @brief get/set segment thickness72void setThickness(const FXint w);73FXint getThickness() const {74return mySegmentThickness;75}7677/// @brief get/set myGroove thickness78void setGroove(const FXint w);79FXint getGroove() const {80return myGroove;81}8283/// @brief draw/redraw object84long onPaint(FXObject*, FXSelector, void*);8586/// @brief set from value87long onCmdSetValue(FXObject*, FXSelector, void*);8889/// @brief set from int value90long onCmdSetIntValue(FXObject*, FXSelector, void*);9192/// @brief get from int value93long onCmdGetIntValue(FXObject*, FXSelector, void*);9495/// @brief set from string value96long onCmdSetStringValue(FXObject*, FXSelector, void*);9798/// @brief get from string value99long onCmdGetStringValue(FXObject*, FXSelector, void*);100101/// @brief let parent show tip if appropriate102long onQueryTip(FXObject*, FXSelector, void*);103104/// @brief let parent show help if appropriate105long onQueryHelp(FXObject*, FXSelector, void*);106107/// @brief Return minimum width108virtual FXint getDefaultWidth();109110/// @brief Return minimum height111virtual FXint getDefaultHeight();112113/// @brief save resources114virtual void save(FXStream& store) const;115116/// @brief load resources117virtual void load(FXStream& store);118119protected:120/// @brief FOX constructor121FOX_CONSTRUCTOR(MFXSevenSegment)122123/// @brief Draws the individual segment types124void drawTopSegment(FXDCWindow& dc, FXshort x, FXshort y);125void drawLeftTopSegment(FXDCWindow& dc, FXshort x, FXshort y);126void drawRightTopSegment(FXDCWindow& dc, FXshort x, FXshort y);127void drawMiddleSegment(FXDCWindow& dc, FXshort x, FXshort y);128void drawLeftBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);129void drawRightBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);130void drawBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);131132/// @brief Draw a seven-segment unit (each segment can be set indepentantly)133void drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7);134135/// @brief Draw an alphanumeric figure (consisting of seven segments)136virtual void drawFigure(FXDCWindow& dc, FXchar figure);137138private:139/// @brief The currently shown character140FXchar myValue;141142/// @brief The color of the LCD text143FXColor myLCDTextColor;144145/// @brief The color of the LCD background146FXColor myBackGroundColor;147148/// @brief This is pixel length of a horizontal segment149FXshort myHorizontalSegmentLength;150151/// @brief This is pixel length of a vertical segment152FXshort myVerticalSegmentLength;153154/// @brief This is segment thickness, in pixels155FXshort mySegmentThickness;156157/// @brief Groove between segments158FXshort myGroove;159160/// @brief validates the sizes of the segment dimensions161void checkSize();162};163164165