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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 //
18 /****************************************************************************/
19 
20 
21 #ifndef FXSEVENSEGMENT_H
22 #define FXSEVENSEGMENT_H
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
30 #ifndef FXFRAME_H
31 
32 #include <FXFrame.h>
33 using namespace FX;
34 #endif
35 namespace FXEX {
36 
40 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
41  FXSevenSegment : public FXFrame {
42  FXDECLARE(FXSevenSegment)
43 
44 private:
45  FXchar value; // The currently shown character
46  FXColor fgcolor; // The color of the LCD text
47  FXColor bgcolor; // The color of the LCD background
48  FXshort hsl; // This is pixel length of a horizontal segment
49  FXshort vsl; // This is pixel length of a vertical segment
50  FXshort st; // This is segment thickness, in pixels
51  FXshort groove; // Groove between segments
52 
53 private:
54  void checkSize();
55 
56 protected:
58 
59  // Draws the individual segment types
60  void drawTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
61  void drawLeftTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
62  void drawRightTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
63  void drawMiddleSegment(FXDCWindow& dc, FXshort x, FXshort y);
64  void drawLeftBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
65  void drawRightBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
66  void drawBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
67 
68  // Draw a seven-segment unit (each segment can be set indepentantly)
69  void drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7);
70 
71  // Draw an alphanumeric figure (consisting of seven segments)
72  virtual void drawFigure(FXDCWindow& dc, FXchar figure);
73 
74 public:
75  long onPaint(FXObject*, FXSelector, void*);
76  long onCmdSetValue(FXObject*, FXSelector, void*);
77  long onCmdSetIntValue(FXObject*, FXSelector, void*);
78  long onCmdGetIntValue(FXObject*, FXSelector, void*);
79  long onCmdSetStringValue(FXObject*, FXSelector, void*);
80  long onCmdGetStringValue(FXObject*, FXSelector, void*);
81  long onQueryTip(FXObject*, FXSelector, void*);
82  long onQueryHelp(FXObject*, FXSelector, void*);
83 
84 public:
86  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);
87 
89  void setText(const FXchar val);
90 
92  FXchar getText() const {
93  return value;
94  }
95 
97  void setFgColor(const FXColor clr);
98  FXColor getFgColor() const {
99  return fgcolor;
100  }
101 
103  void setBgColor(const FXColor clr);
104  FXColor getBgColor() const {
105  return bgcolor;
106  }
107 
109  void setHorizontal(const FXint len);
110  FXint getHorizontal() const {
111  return hsl;
112  }
113 
115  void setVertical(const FXint len);
116  FXint getVertical() const {
117  return vsl;
118  }
119 
121  void setThickness(const FXint width);
122  FXint getThickness() const {
123  return st;
124  }
125 
127  void setGroove(const FXint width);
128  FXint getGroove() const {
129  return groove;
130  }
131 
133  virtual FXint getDefaultWidth();
134 
136  virtual FXint getDefaultHeight();
137 
139  virtual void save(FXStream& store) const;
140 
142  virtual void load(FXStream& store);
143 
145  virtual ~FXSevenSegment() {}
146 };
147 
148 } // namespace FXEX
149 #endif // FXSEVENSEGMENT_H
FXColor getBgColor() const
FXchar getText() const
get the text on the display
FXint getHorizontal() const
FXint getGroove() const
virtual ~FXSevenSegment()
dtor
FXint getVertical() const
FXColor getFgColor() const
FXint getThickness() const