SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FXSevenSegment.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * Seven segment display widget *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2003 by Mathew Robertson. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************/
22 #ifndef FXSEVENSEGMENT_H
23 #define FXSEVENSEGMENT_H
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #ifndef FXFRAME_H
36 
37 #include <FXFrame.h>
38 using namespace FX;
39 #endif
40 namespace FXEX {
41 
45 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
46  FXSevenSegment : public FXFrame {
47  FXDECLARE(FXSevenSegment)
48 
49 private:
50  FXchar value; // The currently shown character
51  FXColor fgcolor; // The color of the LCD text
52  FXColor bgcolor; // The color of the LCD background
53  FXint hsl; // This is pixel length of a horizontal segment
54  FXint vsl; // This is pixel length of a vertical segment
55  FXint st; // This is segment thickness, in pixels
56  FXint groove; // Groove between segments
57 
58 private:
59  void checkSize();
60 
61 protected:
63 
64  // Draws the individual segment types
65  void drawTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
66  void drawLeftTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
67  void drawRightTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
68  void drawMiddleSegment(FXDCWindow& dc, FXshort x, FXshort y);
69  void drawLeftBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
70  void drawRightBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
71  void drawBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
72 
73  // Draw a seven-segment unit (each segment can be set indepentantly)
74  void drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7);
75 
76  // Draw an alphanumeric figure (consisting of seven segments)
77  virtual void drawFigure(FXDCWindow& dc, FXchar figure);
78 
79 public:
80  long onPaint(FXObject*, FXSelector, void*);
81  long onCmdSetValue(FXObject*, FXSelector, void*);
82  long onCmdSetIntValue(FXObject*, FXSelector, void*);
83  long onCmdGetIntValue(FXObject*, FXSelector, void*);
84  long onCmdSetStringValue(FXObject*, FXSelector, void*);
85  long onCmdGetStringValue(FXObject*, FXSelector, void*);
86  long onQueryTip(FXObject*, FXSelector, void*);
87  long onQueryHelp(FXObject*, FXSelector, void*);
88 
89 public:
91  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);
92 
94  void setText(const FXchar val);
95 
97  FXchar getText() const {
98  return value;
99  }
100 
102  void setFgColor(const FXColor clr);
103  FXColor getFgColor() const {
104  return fgcolor;
105  }
106 
108  void setBgColor(const FXColor clr);
109  FXColor getBgColor() const {
110  return bgcolor;
111  }
112 
114  void setHorizontal(const FXint len);
115  FXint getHorizontal() const {
116  return hsl;
117  }
118 
120  void setVertical(const FXint len);
121  FXint getVertical() const {
122  return vsl;
123  }
124 
126  void setThickness(const FXint width);
127  FXint getThickness() const {
128  return st;
129  }
130 
132  void setGroove(const FXint width);
133  FXint getGroove() const {
134  return groove;
135  }
136 
138  virtual FXint getDefaultWidth();
139 
141  virtual FXint getDefaultHeight();
142 
144  virtual void save(FXStream& store) const;
145 
147  virtual void load(FXStream& store);
148 
150  virtual ~FXSevenSegment() {}
151 };
152 
153 } // namespace FXEX
154 #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:82
FXint getGroove() const