|
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
|
00001 /********************************************************************************
00002 * *
00003 * LCD timer 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 FXLCDTIMER_H
00023 #define FXLCDTIMER_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 LCDTIMER_COUNTUP =0, /// timer counts up, indefinately
00035 LCDTIMER_COUNTDOWN =0x00100000, /// timer count down to zero, then fires an event
00036 LCDTIMER_SECONDS =0x00200000, /// show seconds
00037 LCDTIMER_MILLISECONDS=0x00400000, /// show milliseconds
00038 };
00039
00040 /**
00041 * Provide a seven segment display styled timer
00042 */
00043 class FXAPI FXLCDTimer : public FXHorizontalFrame{
00044 FXDECLARE(FXLCDTimer)
00045
00046 protected:
00047 FXLCDTimer () {}
00048
00049 private:
00050 FXTime endTime;
00051 FXTime seconds;
00052 FXint milliseconds;
00053 FXLCDLabel *hourSegment;
00054 FXLCDSymbol *colon1;
00055 FXLCDLabel *minuteSegment;
00056 FXLCDSymbol *colon2;
00057 FXLCDLabel *secondSegment;
00058 FXLCDSymbol *decimalPoint;
00059 FXLCDLabel *millisecondSegment;
00060
00061 private:
00062 void drawTimer();
00063
00064 public:
00065 enum {
00066 ID_TIMER=FXHorizontalFrame::ID_LAST,
00067 ID_MILLISECOND,
00068 ID_LAST
00069 };
00070
00071 public:
00072 long onPaint(FXObject*,FXSelector,void*);
00073 long onTimer(FXObject*,FXSelector,void*);
00074 long onMillisecondChore(FXObject*,FXSelector,void*);
00075 long onMillisecondTimer(FXObject*,FXSelector,void*);
00076 long onQueryTip(FXObject*,FXSelector,void*);
00077 long onQueryHelp(FXObject*,FXSelector,void*);
00078
00079 public:
00080 virtual FXint getDefaultWidth ();
00081 virtual FXint getDefaultHeight ();
00082
00083 public:
00084 /// create a clock
00085 FXLCDTimer(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);
00086
00087 /// set the timer value, ie when you want to count down
00088 void setTime(FXTime s);
00089
00090 /// get the timer value
00091 FXTime getTime();
00092
00093 /// reset the timer value
00094 void reset();
00095
00096 /// create resources
00097 virtual void create();
00098
00099 /// set the foreground color
00100 void setFgColor(FXColor clr);
00101
00102 /// get the foreground color
00103 FXColor getFgColor() const;
00104
00105 /// set the background color
00106 void setBgColor(FXColor clr);
00107
00108 /// get the background color
00109 FXColor getBgColor() const;
00110
00111 /// set/get the horizontal segment length
00112 void setHorizontal(const FXint len);
00113 FXint getHorizontal() const;
00114
00115 /// set/get the vertical segment length
00116 void setVertical(const FXint len);
00117 FXint getVertical() const;
00118
00119 /// set/get the segment thickness
00120 void setThickness(const FXint width);
00121 FXint getThickness() const;
00122
00123 /// set/get the groove thickness
00124 void setGroove(const FXint width);
00125 FXint getGroove() const;
00126
00127 /// dtor
00128 virtual ~FXLCDTimer();
00129 };
00130
00131 } // namespace FXEX
00132 #endif // FXLCDTIMER_H