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,2006 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.12 2006/03/01 02:13:21 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 FXString tip; // Tooltip 00055 FXString help; // Help message 00056 protected: 00057 FX7Segment(); 00058 private: 00059 FX7Segment(const FX7Segment&); 00060 FX7Segment &operator=(const FX7Segment&); 00061 void drawCells(FXDCWindow &dc,FXint x,FXint y,FXint cw,FXint ch); 00062 void drawSegments(FXDCWindow &dc,FXint x,FXint y,FXint w,FXint h,FXuint segments); 00063 public: 00064 long onPaint(FXObject*,FXSelector,void*); 00065 long onCmdSetValue(FXObject*,FXSelector,void*); 00066 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00067 long onCmdSetRealValue(FXObject*,FXSelector,void*); 00068 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00069 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00070 long onCmdGetRealValue(FXObject*,FXSelector,void*); 00071 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00072 long onCmdSetHelp(FXObject*,FXSelector,void*); 00073 long onCmdGetHelp(FXObject*,FXSelector,void*); 00074 long onCmdSetTip(FXObject*,FXSelector,void*); 00075 long onCmdGetTip(FXObject*,FXSelector,void*); 00076 long onQueryHelp(FXObject*,FXSelector,void*); 00077 long onQueryTip(FXObject*,FXSelector,void*); 00078 public: 00079 00080 /// Create a seven segment display 00081 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); 00082 00083 /// Return default width 00084 virtual FXint getDefaultWidth(); 00085 00086 /// Return default height 00087 virtual FXint getDefaultHeight(); 00088 00089 /// Set the text for this label 00090 void setText(const FXString& text); 00091 00092 /// Get the text for this label 00093 FXString getText() const { return label; } 00094 00095 /// Change text color 00096 void setTextColor(FXColor clr); 00097 00098 /// Return text color 00099 FXColor getTextColor() const { return textColor; } 00100 00101 /// Get/set cell width 00102 void setCellWidth(FXint w); 00103 FXint getCellWidth() const { return cellwidth; } 00104 00105 /// Get/set cell height 00106 void setCellHeight(FXint h); 00107 FXint getCellHeight() const { return cellheight; } 00108 00109 /// Get/set segment thickness 00110 void setThickness(FXint t); 00111 FXint getThickness() const { return thickness; } 00112 00113 /// Change 7 segment style 00114 void set7SegmentStyle(FXuint style); 00115 00116 /// Get current 7 segment style 00117 FXuint get7SegmentStyle() const; 00118 00119 /// Set the current text-justification mode. 00120 void setJustify(FXuint mode); 00121 00122 /// Get the current text-justification mode. 00123 FXuint getJustify() const; 00124 00125 /// Set the status line help text 00126 void setHelpText(const FXString& text){ help=text; } 00127 00128 /// Get the status line help text 00129 const FXString& getHelpText() const { return help; } 00130 00131 /// Set the tool tip message 00132 void setTipText(const FXString& text){ tip=text; } 00133 00134 /// Get the tool tip message 00135 const FXString& getTipText() const { return tip; } 00136 00137 /// Save to a stream 00138 virtual void save(FXStream &store) const; 00139 00140 /// Load from a stream 00141 virtual void load(FXStream &store); 00142 }; 00143 00144 } 00145 00146 #endif
Copyright © 1997-2005 Jeroen van der Zijp |