Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members

FXLCDSymbol.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  LCD symbol objects                                           *
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 FXLCDMARK_H
00023 #define FXLCDMARK_H
00024 
00025 #ifndef FXFRAME_H
00026 #include <fox/FXFrame.h>
00027 using namespace FX;
00028 #endif
00029 namespace FXEX {
00030 
00031 /**
00032  * Implements a decimalpoint, full-stop or colon as used by the LCD clock
00033  */
00034 class FXAPI FXLCDSymbol : public FXFrame{
00035   FXDECLARE(FXLCDSymbol)
00036 
00037   private:
00038     FXchar  value;      // The currently shown character
00039     FXColor fgcolor;    // The color of the LCD text
00040     FXColor bgcolor;    // The color of the LCD background
00041     FXint   hsl;        // This is horizontal pixel length of a segment
00042     FXint   vsl;        // This is vertical pixel length of a segment (ie between the dots)
00043     FXint   st;         // This is segment thickness, in pixels
00044     FXint   groove;     // Groove between segments
00045 
00046   protected:
00047     FXLCDSymbol () {}
00048 
00049     // helper routine
00050     void calcLayout();
00051 
00052     // Draws the individual segment types
00053     void drawSegment(FXDCWindow &dc,FXshort x,FXshort y);
00054 
00055     // Draw a unit (each segment can be set indepentantly)
00056     void drawSegments (FXDCWindow &dc,FXbool s1,FXbool s2);
00057 
00058     // Draw appropriate symbol
00059     void drawAMsymbol (FXDCWindow &dc);
00060     void drawPMsymbol (FXDCWindow &dc);
00061 
00062     // Draw an alphanumeric figure (consisting of seven segments)
00063     virtual void drawFigure (FXDCWindow &dc, FXchar figure);
00064 
00065   public:
00066     long onPaint(FXObject*,FXSelector,void*);
00067     long onQueryTip(FXObject*,FXSelector,void*);
00068     long onQueryHelp(FXObject*,FXSelector,void*);
00069 
00070   public:
00071     virtual FXint getDefaultWidth(); // Return minimum width
00072     virtual FXint getDefaultHeight(); // Return minimum height
00073 
00074   public:
00075     /// create symbol/marker
00076     FXLCDSymbol (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);
00077 
00078     /// choose character
00079     void setText(const FXchar val);
00080 
00081     /// return chose character
00082     FXchar getText() const {return value;};
00083 
00084     /// set foreground color
00085     void setFgColor(const FXColor clr);
00086 
00087     /// get foreground color
00088     FXColor getFgColor() const { return fgcolor; }
00089 
00090     /// set background color
00091     void setBgColor(const FXColor clr);
00092 
00093     /// get background color
00094     FXColor getBgColor() const { return bgcolor; }
00095 
00096     /// set segment vertical length (ie the distance between dots)
00097     void setHorizontal(const FXint len);
00098 
00099     FXint getHorizontal() const { return hsl; }
00100 
00101     /// set segment vertical length (ie the distance between dots)
00102     void setVertical(const FXint len);
00103 
00104     /// get segment vertical length
00105     FXint getVertical() const { return vsl; }
00106 
00107     /// set segment thickness
00108     void setThickness(const FXint width);
00109 
00110     /// get segment thickness
00111     FXint getThickness() const { return st; }
00112 
00113     /// set groove width
00114     void setGroove(const FXint width);
00115 
00116     /// get groove width
00117     FXint getGroove() const { return groove; }
00118 
00119     // dtor
00120     virtual ~FXLCDSymbol() {}
00121   };
00122 
00123 } // namespace FXEX
00124 #endif // FXLCDSYMBOL