fltk::ClockOutput Class Reference

#include <Clock.h>

Inherits fltk::Widget.

Inherited by fltk::Clock.

List of all members.

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()

Detailed Description

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).

Member Enumeration Documentation

anonymous enum

The type of clock


A square looking clock. Currently the same as ANALOG.


An old-school analog clock.


A round clock.


A digital clock. Apparently NYI.


Constructor & Destructor Documentation

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

xThe x position of the ClockOutput, relative to the Group
yThe y position of the ClockOutput, relative to the Group
wThe width of the ClockOutput
hThe height of the ClockOutput
lThe label of the ClockOutput

Member Function Documentation

void ClockOutput::draw ( int  x,
int  y,
int  w,
int  h 
) [protected]

The draw function

xThe x position of the ClockOutput
yThe y position of the ClockOutput
wThe width of the ClockOutput
hThe 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.

void ClockOutput::drawhands ( Color  fill,
Color  line 
) [private]

Draws the hands on the clock.

fillThe fltk::Color used to fill the hands
lineThe fltk::Color used to draw the hand outlines
int ClockOutput::hour ( ) const [inline]
The hour sent to the last call to value().
int ClockOutput::minute ( ) const [inline]
The minute sent to the last call to value().
int ClockOutput::second ( ) const [inline]
The second sent to the last call to value().
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.

hThe hour to draw the hour hand pointing to
mThe minute to draw the minute hand pointing to
sThe 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.

vThe unix timestamp used to calculate the time
unsigned long ClockOutput::value ( ) const [inline]
the last Unix timestamp the clock was set to.

The documentation for this class was generated from the following files: