![]() |
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,2009 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published by * 00010 * the Free Software Foundation; either version 3 of the License, or * 00011 * (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 * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/> * 00020 ********************************************************************************* 00021 * $Id: FX7Segment.h,v 1.17 2009/01/06 13:07:21 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FX7SEGMENT_H 00024 #define FX7SEGMENT_H 00025 00026 #ifndef FXFRAME_H 00027 #include "FXFrame.h" 00028 #endif 00029 00030 00031 namespace FX { 00032 00033 /// 7 Segment styles 00034 enum { 00035 SEVENSEGMENT_NORMAL = 0, /// Draw segments normally 00036 SEVENSEGMENT_SHADOW = 0x00080000 /// Draw shadow under the segments 00037 }; 00038 00039 00040 /** 00041 * Seven-segment (eg LCD/watch style) widget, useful for making 00042 * indicators and timers. Besides numbers, the seven-segment 00043 * display widget can also display some letters and punctuations. 00044 */ 00045 class FXAPI FX7Segment : public FXFrame { 00046 FXDECLARE(FX7Segment) 00047 protected: 00048 FXString label; // Text being shown 00049 FXColor textColor; // Text color 00050 FXint thickness; // Segment thickness 00051 FXint cellwidth; // Width of cell 00052 FXint cellheight; // height of cell 00053 FXString tip; // Tooltip 00054 FXString help; // Help message 00055 protected: 00056 FX7Segment(); 00057 private: 00058 FX7Segment(const FX7Segment&); 00059 FX7Segment &operator=(const FX7Segment&); 00060 void drawCells(FXDCWindow &dc,FXint x,FXint y,FXint cw,FXint ch); 00061 void drawSegments(FXDCWindow &dc,FXint x,FXint y,FXint w,FXint h,FXuint segments); 00062 public: 00063 long onPaint(FXObject*,FXSelector,void*); 00064 long onCmdSetValue(FXObject*,FXSelector,void*); 00065 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00066 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00067 long onCmdSetLongValue(FXObject*,FXSelector,void*); 00068 long onCmdGetLongValue(FXObject*,FXSelector,void*); 00069 long onCmdSetRealValue(FXObject*,FXSelector,void*); 00070 long onCmdGetRealValue(FXObject*,FXSelector,void*); 00071 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00072 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00073 long onCmdSetHelp(FXObject*,FXSelector,void*); 00074 long onCmdGetHelp(FXObject*,FXSelector,void*); 00075 long onCmdSetTip(FXObject*,FXSelector,void*); 00076 long onCmdGetTip(FXObject*,FXSelector,void*); 00077 long onQueryHelp(FXObject*,FXSelector,void*); 00078 long onQueryTip(FXObject*,FXSelector,void*); 00079 public: 00080 00081 /// Create a seven segment display 00082 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); 00083 00084 /// Return default width 00085 virtual FXint getDefaultWidth(); 00086 00087 /// Return default height 00088 virtual FXint getDefaultHeight(); 00089 00090 /// Set the text for this label 00091 void setText(const FXString& text); 00092 00093 /// Get the text for this label 00094 FXString getText() const { return label; } 00095 00096 /// Change text color 00097 void setTextColor(FXColor clr); 00098 00099 /// Return text color 00100 FXColor getTextColor() const { return textColor; } 00101 00102 /// Get/set cell width 00103 void setCellWidth(FXint w); 00104 FXint getCellWidth() const { return cellwidth; } 00105 00106 /// Get/set cell height 00107 void setCellHeight(FXint h); 00108 FXint getCellHeight() const { return cellheight; } 00109 00110 /// Get/set segment thickness 00111 void setThickness(FXint t); 00112 FXint getThickness() const { return thickness; } 00113 00114 /// Change 7 segment style 00115 void set7SegmentStyle(FXuint style); 00116 00117 /// Get current 7 segment style 00118 FXuint get7SegmentStyle() const; 00119 00120 /// Set the current text-justification mode. 00121 void setJustify(FXuint mode); 00122 00123 /// Get the current text-justification mode. 00124 FXuint getJustify() const; 00125 00126 /// Set the status line help text 00127 void setHelpText(const FXString& text){ help=text; } 00128 00129 /// Get the status line help text 00130 const FXString& getHelpText() const { return help; } 00131 00132 /// Set the tool tip message 00133 void setTipText(const FXString& text){ tip=text; } 00134 00135 /// Get the tool tip message 00136 const FXString& getTipText() const { return tip; } 00137 00138 /// Save to a stream 00139 virtual void save(FXStream &store) const; 00140 00141 /// Load from a stream 00142 virtual void load(FXStream &store); 00143 }; 00144 00145 } 00146 00147 #endif
![]() |