Eclipse SUMO - Simulation of Urban MObility
FXSevenSegment.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2004-2020 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 /****************************************************************************/
20 //
21 /****************************************************************************/
22 
23 
24 #ifndef FXSEVENSEGMENT_H
25 #define FXSEVENSEGMENT_H
26 #include <config.h>
27 
28 #ifndef FXFRAME_H
29 
30 #include <FXFrame.h>
31 using namespace FX;
32 #endif
33 namespace FXEX {
34 
38 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
39  FXSevenSegment : public FXFrame {
40  FXDECLARE(FXSevenSegment)
41 
42 private:
43  FXchar value; // The currently shown character
44  FXColor fgcolor; // The color of the LCD text
45  FXColor bgcolor; // The color of the LCD background
46  FXshort hsl; // This is pixel length of a horizontal segment
47  FXshort vsl; // This is pixel length of a vertical segment
48  FXshort st; // This is segment thickness, in pixels
49  FXshort groove; // Groove between segments
50 
51 private:
52  void checkSize();
53 
54 protected:
56 
57  // Draws the individual segment types
58  void drawTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
59  void drawLeftTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
60  void drawRightTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
61  void drawMiddleSegment(FXDCWindow& dc, FXshort x, FXshort y);
62  void drawLeftBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
63  void drawRightBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
64  void drawBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
65 
66  // Draw a seven-segment unit (each segment can be set indepentantly)
67  void drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7);
68 
69  // Draw an alphanumeric figure (consisting of seven segments)
70  virtual void drawFigure(FXDCWindow& dc, FXchar figure);
71 
72 public:
73  long onPaint(FXObject*, FXSelector, void*);
74  long onCmdSetValue(FXObject*, FXSelector, void*);
75  long onCmdSetIntValue(FXObject*, FXSelector, void*);
76  long onCmdGetIntValue(FXObject*, FXSelector, void*);
77  long onCmdSetStringValue(FXObject*, FXSelector, void*);
78  long onCmdGetStringValue(FXObject*, FXSelector, void*);
79  long onQueryTip(FXObject*, FXSelector, void*);
80  long onQueryHelp(FXObject*, FXSelector, void*);
81 
82 public:
84  FXSevenSegment(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);
85 
87  void setText(const FXchar val);
88 
90  FXchar getText() const {
91  return value;
92  }
93 
95  void setFgColor(const FXColor clr);
96  FXColor getFgColor() const {
97  return fgcolor;
98  }
99 
101  void setBgColor(const FXColor clr);
102  FXColor getBgColor() const {
103  return bgcolor;
104  }
105 
107  void setHorizontal(const FXint len);
108  FXint getHorizontal() const {
109  return hsl;
110  }
111 
113  void setVertical(const FXint len);
114  FXint getVertical() const {
115  return vsl;
116  }
117 
119  void setThickness(const FXint width);
120  FXint getThickness() const {
121  return st;
122  }
123 
125  void setGroove(const FXint width);
126  FXint getGroove() const {
127  return groove;
128  }
129 
131  virtual FXint getDefaultWidth();
132 
134  virtual FXint getDefaultHeight();
135 
137  virtual void save(FXStream& store) const;
138 
140  virtual void load(FXStream& store);
141 
143  virtual ~FXSevenSegment() {}
144 };
145 
146 } // namespace FXEX
147 #endif // FXSEVENSEGMENT_H
FXColor getBgColor() const
FXchar getText() const
get the text on the display
FXColor getFgColor() const
FXint getHorizontal() const
FXint getThickness() const
FXint getVertical() const
virtual ~FXSevenSegment()
dtor
FXint getGroove() const