Eclipse SUMO - Simulation of Urban MObility
MFXSevenSegment.h
Go to the documentation of this file.
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 /****************************************************************************/
21 //
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
26 #include "fxheader.h"
27 
29 class MFXSevenSegment : public FXFrame {
31  FXDECLARE(MFXSevenSegment)
32 
33 public:
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 
38  virtual ~MFXSevenSegment() {}
39 
41  void setText(const FXchar val);
42 
44  FXchar getText() const {
45  return myValue;
46  }
47 
49  void setFgColor(const FXColor clr);
50  FXColor getFgColor() const {
51  return myLCDTextColor;
52  }
53 
55  void setBgColor(const FXColor clr);
56  FXColor getBgColor() const {
57  return myBackGroundColor;
58  }
59 
61  void setHorizontal(const FXint len);
62  FXint getHorizontal() const {
64  }
65 
67  void setVertical(const FXint len);
68  FXint getVertical() const {
70  }
71 
73  void setThickness(const FXint w);
74  FXint getThickness() const {
75  return mySegmentThickness;
76  }
77 
79  void setGroove(const FXint w);
80  FXint getGroove() const {
81  return myGroove;
82  }
83 
85  long onPaint(FXObject*, FXSelector, void*);
86 
88  long onCmdSetValue(FXObject*, FXSelector, void*);
89 
91  long onCmdSetIntValue(FXObject*, FXSelector, void*);
92 
94  long onCmdGetIntValue(FXObject*, FXSelector, void*);
95 
97  long onCmdSetStringValue(FXObject*, FXSelector, void*);
98 
100  long onCmdGetStringValue(FXObject*, FXSelector, void*);
101 
103  long onQueryTip(FXObject*, FXSelector, void*);
104 
106  long onQueryHelp(FXObject*, FXSelector, void*);
107 
109  virtual FXint getDefaultWidth();
110 
112  virtual FXint getDefaultHeight();
113 
115  virtual void save(FXStream& store) const;
116 
118  virtual void load(FXStream& store);
119 
120 protected:
122  FOX_CONSTRUCTOR(MFXSevenSegment)
123 
124 
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 
134  void drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7);
135 
137  virtual void drawFigure(FXDCWindow& dc, FXchar figure);
138 
139 private:
141  FXchar myValue;
142 
144  FXColor myLCDTextColor;
145 
148 
151 
154 
157 
159  FXshort myGroove;
160 
162  void checkSize();
163 };
Seven-segment (eg LCD/watch style) widget.
FXshort myVerticalSegmentLength
This is pixel length of a vertical segment.
long onCmdSetStringValue(FXObject *, FXSelector, void *)
set from string value
void setText(const FXchar val)
set the text on the display
FXshort myGroove
Groove between segments.
void drawLeftBottomSegment(FXDCWindow &dc, FXshort x, FXshort y)
void drawLeftTopSegment(FXDCWindow &dc, FXshort x, FXshort y)
void drawTopSegment(FXDCWindow &dc, FXshort x, FXshort y)
FOX constructor.
FXchar getText() const
get the text on the display
void setThickness(const FXint w)
get/set segment thickness
void checkSize()
validates the sizes of the segment dimensions
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)
FOX declaration.
long onCmdSetIntValue(FXObject *, FXSelector, void *)
set from int value
virtual FXint getDefaultHeight()
Return minimum height.
long onCmdGetStringValue(FXObject *, FXSelector, void *)
get from string value
virtual void save(FXStream &store) const
save resources
void setHorizontal(const FXint len)
get/set horizontal segment length
FXint getThickness() const
void drawRightBottomSegment(FXDCWindow &dc, FXshort x, FXshort y)
FXshort myHorizontalSegmentLength
This is pixel length of a horizontal segment.
virtual void drawFigure(FXDCWindow &dc, FXchar figure)
Draw an alphanumeric figure (consisting of seven segments)
void setVertical(const FXint len)
get/set vertical segment length
long onPaint(FXObject *, FXSelector, void *)
draw/redraw object
FXColor getFgColor() const
long onQueryTip(FXObject *, FXSelector, void *)
let parent show tip if appropriate
void drawMiddleSegment(FXDCWindow &dc, FXshort x, FXshort y)
FXshort mySegmentThickness
This is segment thickness, in pixels.
void setBgColor(const FXColor clr)
get/set background color
virtual FXint getDefaultWidth()
Return minimum width.
FXColor myBackGroundColor
The color of the LCD background.
FXColor myLCDTextColor
The color of the LCD text.
FXint getVertical() const
FXint getHorizontal() const
void drawBottomSegment(FXDCWindow &dc, FXshort x, FXshort y)
void setFgColor(const FXColor clr)
get/set foreground color
long onQueryHelp(FXObject *, FXSelector, void *)
let parent show help if appropriate
void drawSegments(FXDCWindow &dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7)
Draw a seven-segment unit (each segment can be set indepentantly)
FXColor getBgColor() const
virtual ~MFXSevenSegment()
destructor
long onCmdSetValue(FXObject *, FXSelector, void *)
set from value
void setGroove(const FXint w)
get/set myGroove thickness
long onCmdGetIntValue(FXObject *, FXSelector, void *)
get from int value
FXint getGroove() const
void drawRightTopSegment(FXDCWindow &dc, FXshort x, FXshort y)
FXchar myValue
The currently shown character.
virtual void load(FXStream &store)
load resources