FLTK: Fl_Clock.H Source File

FLTK

Fl_Clock.H
1 //
2 // "$Id$"
3 //
4 // Clock header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18
19 /* \file
20 Fl_Clock, Fl_Clock_Output widgets . */
21
22 #ifndef Fl_Clock_H
23 #define Fl_Clock_H
24
25 #ifndef Fl_Widget_H
26 #include "Fl_Widget.H"
27 #endif
28
29 // values for type:
30 #define FL_SQUARE_CLOCK 0
31 #define FL_ROUND_CLOCK 1
32 #define FL_ANALOG_CLOCK FL_SQUARE_CLOCK
33 #define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK
35 // fabien: Please keep the horizontal formatting of both images in class desc,
36 // don't lose vert. space for nothing!
37
54 class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
55 int hour_, minute_, second_;
56 ulong value_;
57 void drawhands(Fl_Color,Fl_Color); // part of draw
58 protected:
59 void draw();
60 void draw(int X, int Y, int W, int H);
61 public:
62
63 Fl_Clock_Output(int X, int Y, int W, int H, const char *L = 0);
64
65 void value(ulong v); // set to this Unix time
66
67 void value(int H, int m, int s);
68
74 ulong value() const {return value_;}
75
80 int hour() const {return hour_;}
81
86 int minute() const {return minute_;}
87
92 int second() const {return second_;}
93 };
94
95 // a Fl_Clock displays the current time always by using a timeout:
96
113 class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
114 public:
115 int handle(int);
116
117 Fl_Clock(int X, int Y, int W, int H, const char *L = 0);
118
119 Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L);
120
121 ~Fl_Clock();
122 };
123
124 #endif
125
126 //
127 // End of "$Id$".
128 //
Fl_Widget.H
Fl_Widget, Fl_Label classes .
Fl_Clock_Output::minute
int minute() const
Returns the displayed minute (0 to 59).
Definition: Fl_Clock.H:86
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition: Enumerations.H:934
Fl_Clock
This widget provides a round analog clock display.
Definition: Fl_Clock.H:113
Fl_Clock_Output
This widget can be used to display a program-supplied time.
Definition: Fl_Clock.H:54
Fl_Clock_Output::hour
int hour() const
Returns the displayed hour (0 to 23).
Definition: Fl_Clock.H:80
Fl_Clock_Output::value
ulong value() const
Returns the displayed time.
Definition: Fl_Clock.H:74
ulong
unsigned long ulong
unsigned long
Definition: fl_types.h:32
Fl_Clock_Output::second
int second() const
Returns the displayed second (0 to 60, 60=leap second).
Definition: Fl_Clock.H:92
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:101
Fl_Widget::handle
virtual int handle(int event)
Handles the specified event.
Definition: Fl_Widget.cxx:112
Fl_Widget::draw
virtual void draw()=0
Draws the widget.
uchar
unsigned char uchar
unsigned char
Definition: fl_types.h:30
- © 1998-2016 by Bill Spitzak and others.