FLTK 1.3.0
Fl_Clock.H
00001 //
00002 // "$Id: Fl_Clock.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
00003 //
00004 // Clock header file for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 1998-2010 by Bill Spitzak and others.
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Library General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2 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 // Library General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Library 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
00021 // USA.
00022 //
00023 // Please report all bugs and problems on the following page:
00024 //
00025 //     http://www.fltk.org/str.php
00026 //
00027 
00028 /* \file
00029    Fl_Clock, Fl_Clock_Output widgets . */
00030 
00031 #ifndef Fl_Clock_H
00032 #define Fl_Clock_H
00033 
00034 #ifndef Fl_Widget_H
00035 #include "Fl_Widget.H"
00036 #endif
00037 
00038 // values for type:
00039 #define FL_SQUARE_CLOCK         0       
00040 #define FL_ROUND_CLOCK          1       
00041 #define FL_ANALOG_CLOCK FL_SQUARE_CLOCK 
00042 #define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK 
00044 // fabien: Please keep the horizontal formatting of both images in class desc, 
00045 // don't lose vert. space for nothing!
00046 
00063 class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
00064   int hour_, minute_, second_;
00065   ulong value_;
00066   void drawhands(Fl_Color,Fl_Color); // part of draw
00067 protected:
00068   void draw();
00069   void draw(int X, int Y, int W, int H);
00070 public:
00071 
00072   Fl_Clock_Output(int X, int Y, int W, int H, const char *L = 0);
00073 
00074   void value(ulong v);  // set to this Unix time
00075   
00076   void value(int H, int m, int s);
00077 
00083   ulong value() const {return value_;}
00084 
00089   int hour() const {return hour_;}
00090 
00095   int minute() const {return minute_;}
00096 
00101   int second() const {return second_;}
00102 };
00103 
00104 // a Fl_Clock displays the current time always by using a timeout:
00105 
00122 class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
00123 public:
00124   int handle(int);
00125 
00126   Fl_Clock(int X, int Y, int W, int H,  const char *L = 0);
00127   
00128   Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L);
00129   
00130   ~Fl_Clock();
00131 };
00132 
00133 #endif
00134 
00135 //
00136 // End of "$Id: Fl_Clock.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
00137 //