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