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-2019 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 /****************************************************************************/
16 //
17 /****************************************************************************/
18 
19 
20 #ifndef FXSEVENSEGMENT_H
21 #define FXSEVENSEGMENT_H
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #ifndef FXFRAME_H
30 
31 #include <FXFrame.h>
32 using namespace FX;
33 #endif
34 namespace FXEX {
35 
39 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
40  FXSevenSegment : public FXFrame {
41  FXDECLARE(FXSevenSegment)
42 
43 private:
44  FXchar value; // The currently shown character
45  FXColor fgcolor; // The color of the LCD text
46  FXColor bgcolor; // The color of the LCD background
47  FXshort hsl; // This is pixel length of a horizontal segment
48  FXshort vsl; // This is pixel length of a vertical segment
49  FXshort st; // This is segment thickness, in pixels
50  FXshort groove; // Groove between segments
51 
52 private:
53  void checkSize();
54 
55 protected:
57 
58  // Draws the individual segment types
59  void drawTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
60  void drawLeftTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
61  void drawRightTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
62  void drawMiddleSegment(FXDCWindow& dc, FXshort x, FXshort y);
63  void drawLeftBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
64  void drawRightBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
65  void drawBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
66 
67  // Draw a seven-segment unit (each segment can be set indepentantly)
68  void drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7);
69 
70  // Draw an alphanumeric figure (consisting of seven segments)
71  virtual void drawFigure(FXDCWindow& dc, FXchar figure);
72 
73 public:
74  long onPaint(FXObject*, FXSelector, void*);
75  long onCmdSetValue(FXObject*, FXSelector, void*);
76  long onCmdSetIntValue(FXObject*, FXSelector, void*);
77  long onCmdGetIntValue(FXObject*, FXSelector, void*);
78  long onCmdSetStringValue(FXObject*, FXSelector, void*);
79  long onCmdGetStringValue(FXObject*, FXSelector, void*);
80  long onQueryTip(FXObject*, FXSelector, void*);
81  long onQueryHelp(FXObject*, FXSelector, void*);
82 
83 public:
85  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);
86 
88  void setText(const FXchar val);
89 
91  FXchar getText() const {
92  return value;
93  }
94 
96  void setFgColor(const FXColor clr);
97  FXColor getFgColor() const {
98  return fgcolor;
99  }
100 
102  void setBgColor(const FXColor clr);
103  FXColor getBgColor() const {
104  return bgcolor;
105  }
106 
108  void setHorizontal(const FXint len);
109  FXint getHorizontal() const {
110  return hsl;
111  }
112 
114  void setVertical(const FXint len);
115  FXint getVertical() const {
116  return vsl;
117  }
118 
120  void setThickness(const FXint width);
121  FXint getThickness() const {
122  return st;
123  }
124 
126  void setGroove(const FXint width);
127  FXint getGroove() const {
128  return groove;
129  }
130 
132  virtual FXint getDefaultWidth();
133 
135  virtual FXint getDefaultHeight();
136 
138  virtual void save(FXStream& store) const;
139 
141  virtual void load(FXStream& store);
142 
144  virtual ~FXSevenSegment() {}
145 };
146 
147 } // namespace FXEX
148 #endif // FXSEVENSEGMENT_H
FXEX::FXSevenSegment::getBgColor
FXColor getBgColor() const
Definition: FXSevenSegment.h:103
FXEX::FXSevenSegment::getGroove
FXint getGroove() const
Definition: FXSevenSegment.h:127
FXEX::FXSevenSegment
Definition: FXSevenSegment.h:40
FXEX::FXSevenSegment::~FXSevenSegment
virtual ~FXSevenSegment()
dtor
Definition: FXSevenSegment.h:144
FXEX::FXSevenSegment::st
FXshort st
Definition: FXSevenSegment.h:49
FXEX::FXSevenSegment::getText
FXchar getText() const
get the text on the display
Definition: FXSevenSegment.h:91
FXEX
Definition: FXBaseObject.cpp:47
FXEX::FXSevenSegment::bgcolor
FXColor bgcolor
Definition: FXSevenSegment.h:46
FXEX::FXSevenSegment::getFgColor
FXColor getFgColor() const
Definition: FXSevenSegment.h:97
FXEX::FXSevenSegment::value
FXchar value
Definition: FXSevenSegment.h:44
FXEX::FXSevenSegment::groove
FXshort groove
Definition: FXSevenSegment.h:50
FXEX::FXSevenSegment::hsl
FXshort hsl
Definition: FXSevenSegment.h:47
config.h
FXEX::FXSevenSegment::vsl
FXshort vsl
Definition: FXSevenSegment.h:48
FXEX::FXSevenSegment::getThickness
FXint getThickness() const
Definition: FXSevenSegment.h:121
FXEX::FXSevenSegment::getHorizontal
FXint getHorizontal() const
Definition: FXSevenSegment.h:109
FXEX::FXSevenSegment::FXSevenSegment
FXSevenSegment()
Definition: FXSevenSegment.h:56
FXEX::FXSevenSegment::getVertical
FXint getVertical() const
Definition: FXSevenSegment.h:115
FXEX::FXSevenSegment::fgcolor
FXColor fgcolor
Definition: FXSevenSegment.h:45