![]() |
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * LCD text label 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 FXLCDLABEL_H 00023 #define FXLCDLABEL_H 00024 00025 #ifndef FXHORIZONTALFRAME_H 00026 #include <fox/FXHorizontalFrame.h> 00027 using namespace FX; 00028 #endif 00029 namespace FXEX { 00030 00031 /// LCD Label styles 00032 enum { 00033 LCDLABEL_NORMAL = FRAME_SUNKEN|FRAME_THICK, 00034 LCDLABEL_LEADING_ZEROS = 0x01000000, /// leading zero's on label - useful for integers 00035 }; 00036 00037 /** 00038 * A widget which has the seven-segment display used as the drawing object for each letter 00039 * in the label. Supports display of leading zeros, such as when you need to display a 00040 * number. Also supports the 'JUSTIFY_RIGHT' option, for right alignment. 00041 */ 00042 class FXAPI FXLCDLabel : public FXHorizontalFrame{ 00043 FXDECLARE(FXLCDLabel) 00044 00045 protected: 00046 FXLCDLabel () {} 00047 00048 FXString label; /// The currently shown label 00049 FXint nfigures; /// The number of shown figuresi, greater than zero 00050 00051 // Draw a string 00052 virtual void drawString(const FXString& lbl); 00053 00054 public: 00055 enum { 00056 ID_SEVENSEGMENT=FXHorizontalFrame::ID_LAST, 00057 ID_LAST 00058 }; 00059 00060 public: 00061 long onPaint (FXObject*, FXSelector, void*); 00062 long onCmdSetValue(FXObject*,FXSelector,void* ptr); 00063 long onCmdSetIntValue(FXObject*,FXSelector,void* ptr); 00064 long onCmdSetRealValue(FXObject*,FXSelector,void* ptr); 00065 long onCmdSetStringValue(FXObject*,FXSelector,void* ptr); 00066 long onCmdGetIntValue(FXObject*,FXSelector,void* ptr); 00067 long onCmdGetRealValue(FXObject*,FXSelector,void* ptr); 00068 long onCmdGetStringValue(FXObject*,FXSelector,void* ptr); 00069 long onRedirectEvent(FXObject*,FXSelector,void* ptr); 00070 long onQueryTip(FXObject*,FXSelector,void* ptr); 00071 long onQueryHelp(FXObject*,FXSelector,void* ptr); 00072 00073 public: 00074 /// make me a label 00075 FXLCDLabel (FXComposite* p,FXuint nfig=1,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=LCDLABEL_NORMAL,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_PAD); 00076 00077 /// create resrouces 00078 virtual void create(); 00079 00080 /// detach resources 00081 virtual void detach(); 00082 00083 /// destroy resources 00084 virtual void destroy(); 00085 00086 /// manipulate text in LCD label 00087 void setText(FXString lbl); 00088 FXString getText() const { return label; } 00089 00090 /// set/get forground color 00091 void setFgColor(FXColor clr); 00092 FXColor getFgColor() const; 00093 00094 /// set/get background color 00095 void setBgColor(FXColor clr); 00096 FXColor getBgColor() const; 00097 00098 /// set/get segment horizontal length - must be more than twice the segment width 00099 void setHorizontal(const FXint len); 00100 FXint getHorizontal() const; 00101 00102 /// set/get segment vertical length - must be more than twice the segment width 00103 void setVertical(const FXint len); 00104 FXint getVertical() const; 00105 00106 /// set/get segment width - must be less than half the segment length 00107 void setThickness(const FXint width); 00108 FXint getThickness() const; 00109 00110 /// set/get groove width - must be less than segment width 00111 void setGroove(const FXint width); 00112 FXint getGroove() const; 00113 00114 /// return minimum width 00115 virtual FXint getDefaultWidth(); 00116 00117 /// return minimum height 00118 virtual FXint getDefaultHeight(); 00119 00120 /// save resources 00121 virtual void save(FXStream &store) const; 00122 00123 /// load resources 00124 virtual void load(FXStream &store); 00125 00126 /// dtor 00127 virtual ~FXLCDLabel(); 00128 }; 00129 00130 } // namespace FXEX 00131 #endif // FXLCDLabel