![]() |
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * LCD Clock 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 FXLCDCLOCK_H 00023 #define FXLCDCLOCK_H 00024 00025 #ifndef FXHORIZONTALFRAME_H 00026 #include <fox/FXHorizontalFrame.h> 00027 using namespace FX; 00028 #endif 00029 namespace FXEX { 00030 class FXLCDLabel; 00031 class FXLCDSymbol; 00032 00033 enum { 00034 LCDCLOCK_LOCALTIME =0, /// show localtime on clock 00035 LCDCLOCK_UTCTIME =0x00100000, /// show UTC time on clock 00036 LCDCLOCK_SECONDS =0x00200000, /// show seconds 00037 LCDCLOCK_MILLISECONDS=0x00400000, /// show milliseconds 00038 LCDCLOCK_24HOUR =0, /// use 24 clock 00039 LCDCLOCK_12HOUR =0x00800000, /// use 12 hour clock 00040 LCDCLOCK_SYMBOL =0x01000000, /// show the am/pm symbol 00041 LCDCLOCK_LEADING_ZERO=0x02000000 /// show the leading zero for the hour 00042 }; 00043 00044 /** 00045 * Provide a seven segment display styled clock 00046 */ 00047 class FXAPI FXLCDClock : public FXHorizontalFrame{ 00048 FXDECLARE(FXLCDClock) 00049 00050 protected: 00051 FXLCDClock () {} 00052 00053 private: 00054 FXTime timeLast; 00055 FXChore *chore; 00056 FXLCDLabel *hourSegment; 00057 FXLCDSymbol *colon1; 00058 FXLCDLabel *minuteSegment; 00059 FXLCDSymbol *colon2; 00060 FXLCDLabel *secondSegment; 00061 FXLCDSymbol *decimalPoint; 00062 FXLCDLabel *millisecondSegment; 00063 FXLCDSymbol *symbol; 00064 00065 private: 00066 void drawClock(); 00067 00068 public: 00069 enum { 00070 ID_CLOCK_TIMER=FXHorizontalFrame::ID_LAST, 00071 ID_MILLISECOND, 00072 ID_LAST 00073 }; 00074 00075 public: 00076 long onPaint(FXObject*,FXSelector,void*); 00077 long onClockTimer(FXObject*,FXSelector,void*); 00078 long onMillisecondChore(FXObject*,FXSelector,void*); 00079 long onMillisecondTimer(FXObject*,FXSelector,void*); 00080 long onQueryTip(FXObject*,FXSelector,void*); 00081 long onQueryHelp(FXObject*,FXSelector,void*); 00082 00083 public: 00084 virtual FXint getDefaultWidth (); 00085 virtual FXint getDefaultHeight (); 00086 00087 public: 00088 /// create a clock 00089 FXLCDClock(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,FXint hs=DEFAULT_PAD); 00090 00091 /// create resources 00092 virtual void create(); 00093 00094 /// set the foreground color 00095 void setFgColor(FXColor clr); 00096 00097 /// get the foreground color 00098 FXColor getFgColor() const; 00099 00100 /// set the background color 00101 void setBgColor(FXColor clr); 00102 00103 /// get the background color 00104 FXColor getBgColor() const; 00105 00106 /// set/get the horizontal segment length 00107 void setHorizontal(const FXint len); 00108 FXint getHorizontal() const; 00109 00110 /// set/get the vertical segment length 00111 void setVertical(const FXint len); 00112 FXint getVertical() const; 00113 00114 /// set/get the segment thickness 00115 void setThickness(const FXint width); 00116 FXint getThickness() const; 00117 00118 /// set/get the groove thickness 00119 void setGroove(const FXint width); 00120 FXint getGroove() const; 00121 00122 /// dtor 00123 virtual ~FXLCDClock(); 00124 }; 00125 00126 } // namespace FXEX 00127 #endif // FXLCDCLOCK_H