[773] | 1 | // |
---|
| 2 | // "$Id: Clock.h 3039 2003-06-25 06:11:43Z spitzak $" |
---|
| 3 | // |
---|
| 4 | // Copyright 1998-2002 by Bill Spitzak and others. |
---|
| 5 | // |
---|
| 6 | // This library is free software; you can redistribute it and/or |
---|
| 7 | // modify it under the terms of the GNU Library General Public |
---|
| 8 | // License as published by the Free Software Foundation; either |
---|
| 9 | // version 2 of the License, or (at your option) any later version. |
---|
| 10 | // |
---|
| 11 | // This library is distributed in the hope that it will be useful, |
---|
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 14 | // Library General Public License for more details. |
---|
| 15 | // |
---|
| 16 | // You should have received a copy of the GNU Library General Public |
---|
| 17 | // License along with this library; if not, write to the Free Software |
---|
| 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
---|
| 19 | // USA. |
---|
| 20 | // |
---|
| 21 | // Please report all bugs and problems to "fltk-bugs@fltk.org". |
---|
| 22 | // |
---|
| 23 | |
---|
| 24 | #ifndef fltk_Clock_h |
---|
| 25 | #define fltk_Clock_h |
---|
| 26 | |
---|
| 27 | #include <fltk/Widget.h> |
---|
| 28 | |
---|
| 29 | namespace fltk { |
---|
| 30 | |
---|
| 31 | // a ClockOutput can be used to display a program-supplied time: |
---|
| 32 | |
---|
| 33 | class FL_API ClockOutput : public Widget { |
---|
| 34 | public: |
---|
| 35 | enum {SQUARE = 0, ANALOG = 0, ROUND, DIGITAL}; |
---|
| 36 | ClockOutput(int x,int y,int w,int h, const char *l = 0); |
---|
| 37 | void value(unsigned long v); // set to this Unix time |
---|
| 38 | void value(int,int,int); // set hour, minute, second |
---|
| 39 | unsigned long value() const {return value_;} |
---|
| 40 | int hour() const {return hour_;} |
---|
| 41 | int minute() const {return minute_;} |
---|
| 42 | int second() const {return second_;} |
---|
| 43 | protected: |
---|
| 44 | void draw(int, int, int, int); |
---|
| 45 | void draw(); |
---|
| 46 | private: |
---|
| 47 | int hour_, minute_, second_; |
---|
| 48 | unsigned long value_; |
---|
| 49 | void drawhands(Color, Color); // part of draw |
---|
| 50 | }; |
---|
| 51 | |
---|
| 52 | // a Clock displays the current time always by using a timeout: |
---|
| 53 | |
---|
| 54 | class FL_API Clock : public ClockOutput { |
---|
| 55 | public: |
---|
| 56 | int handle(int); |
---|
| 57 | void update(); |
---|
| 58 | Clock(int x,int y,int w,int h, const char *l = 0); |
---|
| 59 | static NamedStyle* default_style; |
---|
| 60 | }; |
---|
| 61 | |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | #endif |
---|
| 65 | |
---|
| 66 | // |
---|
| 67 | // End of "$Id: Clock.h 3039 2003-06-25 06:11:43Z spitzak $". |
---|
| 68 | // |
---|