SUMO - Simulation of Urban MObility
FXSevenSegment.h
Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  Seven segment display widget                                 *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2003 by Mathew Robertson.   All Rights Reserved.                *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************/
00022 #ifndef FXSEVENSEGMENT_H
00023 #define FXSEVENSEGMENT_H
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #ifndef FXFRAME_H
00036 
00037 #include <FXFrame.h>
00038 using namespace FX;
00039 #endif
00040 namespace FXEX {
00041 
00045 class /* FXAPI // patch by Daniel Krajzewicz 24.02.2004 */
00046         FXSevenSegment : public FXFrame {
00047     FXDECLARE(FXSevenSegment)
00048 
00049 private:
00050     FXchar  value;      // The currently shown character
00051     FXColor fgcolor;    // The color of the LCD text
00052     FXColor bgcolor;    // The color of the LCD background
00053     FXint   hsl;        // This is pixel length of a horizontal segment
00054     FXint   vsl;        // This is pixel length of a vertical segment
00055     FXint   st;         // This is segment thickness, in pixels
00056     FXint   groove;     // Groove between segments
00057 
00058 private:
00059     void checkSize();
00060 
00061 protected:
00062     FXSevenSegment() {}
00063 
00064     // Draws the individual segment types
00065     void drawTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
00066     void drawLeftTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
00067     void drawRightTopSegment(FXDCWindow& dc, FXshort x, FXshort y);
00068     void drawMiddleSegment(FXDCWindow& dc, FXshort x, FXshort y);
00069     void drawLeftBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
00070     void drawRightBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
00071     void drawBottomSegment(FXDCWindow& dc, FXshort x, FXshort y);
00072 
00073     // Draw a seven-segment unit (each segment can be set indepentantly)
00074     void drawSegments(FXDCWindow& dc, FXbool s1, FXbool s2, FXbool s3, FXbool s4, FXbool s5, FXbool s6, FXbool s7);
00075 
00076     // Draw an alphanumeric figure (consisting of seven segments)
00077     virtual void drawFigure(FXDCWindow& dc, FXchar figure);
00078 
00079 public:
00080     long onPaint(FXObject*, FXSelector, void*);
00081     long onCmdSetValue(FXObject*, FXSelector, void*);
00082     long onCmdSetIntValue(FXObject*, FXSelector, void*);
00083     long onCmdGetIntValue(FXObject*, FXSelector, void*);
00084     long onCmdSetStringValue(FXObject*, FXSelector, void*);
00085     long onCmdGetStringValue(FXObject*, FXSelector, void*);
00086     long onQueryTip(FXObject*, FXSelector, void*);
00087     long onQueryHelp(FXObject*, FXSelector, void*);
00088 
00089 public:
00091     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);
00092 
00094     void setText(const FXchar val);
00095 
00097     FXchar getText() const {
00098         return value;
00099     }
00100 
00102     void setFgColor(const FXColor clr);
00103     FXColor getFgColor() const {
00104         return fgcolor;
00105     }
00106 
00108     void setBgColor(const FXColor clr);
00109     FXColor getBgColor() const {
00110         return bgcolor;
00111     }
00112 
00114     void setHorizontal(const FXint len);
00115     FXint getHorizontal() const {
00116         return hsl;
00117     }
00118 
00120     void setVertical(const FXint len);
00121     FXint getVertical() const {
00122         return vsl;
00123     }
00124 
00126     void setThickness(const FXint width);
00127     FXint getThickness() const {
00128         return st;
00129     }
00130 
00132     void setGroove(const FXint width);
00133     FXint getGroove() const {
00134         return groove;
00135     }
00136 
00138     virtual FXint getDefaultWidth();
00139 
00141     virtual FXint getDefaultHeight();
00142 
00144     virtual void save(FXStream& store) const;
00145 
00147     virtual void load(FXStream& store);
00148 
00150     virtual ~FXSevenSegment() {}
00151 };
00152 
00153 } // namespace FXEX
00154 #endif // FXSEVENSEGMENT_H
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines