#include <Clock.h>
Inherits fltk::Widget.
Inherited by fltk::Clock.
Public Types | |
enum | { SQUARE = 0, ANALOG = 0, ROUND, DIGITAL } |
Public Member Functions | |
ClockOutput (int x, int y, int w, int h, const char *l=0) | |
int | hour () const |
int | minute () const |
int | second () const |
unsigned long | value () const |
void | value (int, int, int) |
void | value (unsigned long v) |
Protected Member Functions | |
void | draw (int, int, int, int) |
void | draw () |
Private Member Functions | |
void | drawhands (Color, Color) |
Private Attributes | |
int | hour_ |
The current hour in the ClockOutput. | |
int | minute_ |
The current minute in the ClockOutput. | |
int | second_ |
The current second in the ClockOutput. | |
unsigned long | value_ |
The current unix time, passed through value() |
A ClockOutput can be used to display a program-supplied time
Base class of Clock, this one does not move, it just displays whatever time you set into it. The include file is <fltk/Clock.h>
type() may be set to SQUARE, ROUND, or DIGITAL (nyi).
anonymous enum |
The type of clock
SQUARE |
A square looking clock. Currently the same as ANALOG. |
ANALOG |
An old-school analog clock. |
ROUND |
A round clock. |
DIGITAL |
A digital clock. Apparently NYI.
|
ClockOutput::ClockOutput | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
const char * | l = 0 |
||
) |
The default constructor initialised the default_style based on Clock::default_style, sets ALIGN_BOTTOM and then sets all time to 0
x | The x position of the ClockOutput, relative to the Group |
y | The y position of the ClockOutput, relative to the Group |
w | The width of the ClockOutput |
h | The height of the ClockOutput |
l | The label of the ClockOutput |
void ClockOutput::draw | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) | [protected] |
The draw function
x | The x position of the ClockOutput |
y | The y position of the ClockOutput |
w | The width of the ClockOutput |
h | The height of the ClockOutput |
void ClockOutput::draw | ( | void | ) | [protected, virtual] |
Draws a background box and then throws to ClockOutput::draw(int, int, int int)
Reimplemented from fltk::Widget.
Draws the hands on the clock.
fill | The fltk::Color used to fill the hands |
line | The fltk::Color used to draw the hand outlines |
int ClockOutput::hour | ( | ) | const [inline] |
int ClockOutput::minute | ( | ) | const [inline] |
int ClockOutput::second | ( | ) | const [inline] |
void ClockOutput::value | ( | int | h, |
int | m, | ||
int | s | ||
) |
Set the hour, minute, and second to display. The hour is effectively taken modulo 12 and the minute and second modulo 60 to figure out where to place the hands. Redraw happens only if different.
This does not set the unsigned long value() member, as it can't because it does not know the date.
h | The hour to draw the hour hand pointing to |
m | The minute to draw the minute hand pointing to |
s | The seconds to draw the second hand pointing to |
void ClockOutput::value | ( | unsigned long | v | ) |
Set the clock to a Unix timestamp. The value is passed through the localtime() library function and used to get the hour, minute, and second.
v | The unix timestamp used to calculate the time |
unsigned long ClockOutput::value | ( | ) | const [inline] |