SUMO - Simulation of Urban MObility
FXSevenSegment.h
Go to the documentation of this file.
1 /****************************************************************************/
9 //
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 #ifndef FXSEVENSEGMENT_H
25 #define FXSEVENSEGMENT_H
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #ifndef FXFRAME_H
38 
39 #include <FXFrame.h>
40 using namespace FX;
41 #endif
42 namespace FXEX {
43 
47 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
48  FXSevenSegment : public FXFrame {
49  FXDECLARE(FXSevenSegment)
50 
51 private:
52  FXchar value; // The currently shown character
53  FXColor fgcolor; // The color of the LCD text
54  FXColor bgcolor; // The color of the LCD background
55  FXint hsl; // This is pixel length of a horizontal segment
56  FXint vsl; // This is pixel length of a vertical segment
57  FXint st; // This is segment thickness, in pixels
58  FXint groove; // Groove between segments
59 
60 private:
61  void checkSize();
62 
63 protected:
65 
66  // Draws the individual segment types
67  void drawTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
68  void drawLeftTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
69  void drawRightTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
70  void drawMiddleSegment(FXDCWindow& dc, FXshort x, FXshort y);
71  void drawLeftBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
72  void drawRightBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
73  void drawBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
74 
75  // Draw a seven-segment unit (each segment can be set indepentantly)
76  void drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7);
77 
78  // Draw an alphanumeric figure (consisting of seven segments)
79  virtual void drawFigure(FXDCWindow& dc, FXchar figure);
80 
81 public:
82  long onPaint(FXObject*, FXSelector, void*);
83  long onCmdSetValue(FXObject*, FXSelector, void*);
84  long onCmdSetIntValue(FXObject*, FXSelector, void*);
85  long onCmdGetIntValue(FXObject*, FXSelector, void*);
86  long onCmdSetStringValue(FXObject*, FXSelector, void*);
87  long onCmdGetStringValue(FXObject*, FXSelector, void*);
88  long onQueryTip(FXObject*, FXSelector, void*);
89  long onQueryHelp(FXObject*, FXSelector, void*);
90 
91 public:
93  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);
94 
96  void setText(const FXchar val);
97 
99  FXchar getText() const {
100  return value;
101  }
102 
104  void setFgColor(const FXColor clr);
105  FXColor getFgColor() const {
106  return fgcolor;
107  }
108 
110  void setBgColor(const FXColor clr);
111  FXColor getBgColor() const {
112  return bgcolor;
113  }
114 
116  void setHorizontal(const FXint len);
117  FXint getHorizontal() const {
118  return hsl;
119  }
120 
122  void setVertical(const FXint len);
123  FXint getVertical() const {
124  return vsl;
125  }
126 
128  void setThickness(const FXint width);
129  FXint getThickness() const {
130  return st;
131  }
132 
134  void setGroove(const FXint width);
135  FXint getGroove() const {
136  return groove;
137  }
138 
140  virtual FXint getDefaultWidth();
141 
143  virtual FXint getDefaultHeight();
144 
146  virtual void save(FXStream& store) const;
147 
149  virtual void load(FXStream& store);
150 
152  virtual ~FXSevenSegment() {}
153 };
154 
155 } // namespace FXEX
156 #endif // FXSEVENSEGMENT_H
FXint getVertical() const
FXchar getText() const
get the text on the display
FXColor getFgColor() const
virtual ~FXSevenSegment()
dtor
FXint getHorizontal() const
FXColor getBgColor() const
FXint getThickness() const
MSNet * load(OptionsCont &oc)
Definition: sumo_main.cpp:86
FXint getGroove() const