Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
00001 /******************************************************************************** 00002 * * 00003 * 7 - S e g m e n t D i s p l a y W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2004,2005 by Jeroen van der Zijp. 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 * $Id: FX7Segment.h,v 1.10 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FX7SEGMENT_H 00025 #define FX7SEGMENT_H 00026 00027 #ifndef FXFRAME_H 00028 #include "FXFrame.h" 00029 #endif 00030 00031 00032 namespace FX { 00033 00034 /// 7 Segment styles 00035 enum { 00036 SEVENSEGMENT_NORMAL = 0, /// Draw segments normally 00037 SEVENSEGMENT_SHADOW = 0x00080000 /// Draw shadow under the segments 00038 }; 00039 00040 00041 /** 00042 * Seven-segment (eg LCD/watch style) widget, useful for making 00043 * indicators and timers. Besides numbers, the seven-segment 00044 * display widget can also display some letters and punctuations. 00045 */ 00046 class FXAPI FX7Segment : public FXFrame { 00047 FXDECLARE(FX7Segment) 00048 protected: 00049 FXString label; // Text being shown 00050 FXColor textColor; // Text color 00051 FXint thickness; // Segment thickness 00052 FXint cellwidth; // Width of cell 00053 FXint cellheight; // height of cell 00054 protected: 00055 FX7Segment(); 00056 private: 00057 FX7Segment(const FX7Segment&); 00058 FX7Segment &operator=(const FX7Segment&); 00059 void drawCells(FXDCWindow &dc,FXint x,FXint y,FXint cw,FXint ch); 00060 void drawSegments(FXDCWindow &dc,FXint x,FXint y,FXint w,FXint h,FXuint segments); 00061 public: 00062 long onPaint(FXObject*,FXSelector,void*); 00063 long onCmdSetValue(FXObject*,FXSelector,void*); 00064 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00065 long onCmdSetRealValue(FXObject*,FXSelector,void*); 00066 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00067 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00068 long onCmdGetRealValue(FXObject*,FXSelector,void*); 00069 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00070 public: 00071 00072 /// Create a seven segment display 00073 FX7Segment(FXComposite* p,const FXString& text,FXuint opts=SEVENSEGMENT_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD); 00074 00075 /// Return default width 00076 virtual FXint getDefaultWidth(); 00077 00078 /// Return default height 00079 virtual FXint getDefaultHeight(); 00080 00081 /// Set the text for this label 00082 void setText(const FXString& text); 00083 00084 /// Get the text for this label 00085 FXString getText() const { return label; } 00086 00087 /// Change text color 00088 void setTextColor(FXColor clr); 00089 00090 /// Return text color 00091 FXColor getTextColor() const { return textColor; } 00092 00093 /// Get/set cell width 00094 void setCellWidth(FXint w); 00095 FXint getCellWidth() const { return cellwidth; } 00096 00097 /// Get/set cell height 00098 void setCellHeight(FXint h); 00099 FXint getCellHeight() const { return cellheight; } 00100 00101 /// Get/set segment thickness 00102 void setThickness(FXint t); 00103 FXint getThickness() const { return thickness; } 00104 00105 /// Change 7 segment style 00106 void set7SegmentStyle(FXuint style); 00107 00108 /// Get current 7 segment style 00109 FXuint get7SegmentStyle() const; 00110 00111 /// Set the current text-justification mode. 00112 void setJustify(FXuint mode); 00113 00114 /// Get the current text-justification mode. 00115 FXuint getJustify() const; 00116 00117 /// Save to a stream 00118 virtual void save(FXStream &store) const; 00119 00120 /// Load from a stream 00121 virtual void load(FXStream &store); 00122 }; 00123 00124 } 00125 00126 #endif
Copyright © 1997-2005 Jeroen van der Zijp |