FLTK 1.4.5: Fl_Clock.H Source File

FLTK 1.4.5

Loading...
Searching...
No Matches
Fl_Clock.H
1//
2// Clock header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2017 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17/* \file
18 Fl_Clock, Fl_Clock_Output widgets . */
19
20#ifndef Fl_Clock_H
21#define Fl_Clock_H
22
23#ifndef Fl_Widget_H
24#include "Fl_Widget.H"
25#endif
26
27// Values for type():
28// Please change doxygen documentation below (class Fl_Clock_Output)
29// accordingly as well when changing the following type values:
30
31#define FL_SQUARE_CLOCK 0
32#define FL_ROUND_CLOCK 1
33#define FL_ANALOG_CLOCK FL_SQUARE_CLOCK
34#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK
35
36// fabien: Please keep the horizontal formatting of both images in class desc,
37// don't lose vertical space for nothing!
38
65 class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
66 int hour_, minute_, second_;
67 ulong value_;
68 int shadow_; // draw shadows of hands
69 void drawhands(Fl_Color,Fl_Color); // part of draw
70protected:
71 void draw() FL_OVERRIDE;
72 void draw(int X, int Y, int W, int H);
73public:
74
75 Fl_Clock_Output(int X, int Y, int W, int H, const char *L = 0);
76
77 void value(ulong v); // set to this Unix time
78
79 void value(int H, int m, int s);
80
86 ulong value() const {return value_;}
87
92 int hour() const {return hour_;}
93
98 int minute() const {return minute_;}
99
104 int second() const {return second_;}
105
113 int shadow() const {return shadow_;}
114
127 void shadow(int mode) { shadow_ = mode ? 1 : 0; }
128};
129
130// a Fl_Clock displays the current time always by using a timeout:
131
152 class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
153public:
154 int handle(int) FL_OVERRIDE;
155
156 Fl_Clock(int X, int Y, int W, int H, const char *L = 0);
157
158 Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L);
159
160 ~Fl_Clock();
161};
162
163#endif
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition Enumerations.H:1120
Fl_Widget.H
Fl_Widget and Fl_Label classes.
Fl_Clock_Output::shadow
void shadow(int mode)
Sets the shadow drawing mode of the hands.
Definition Fl_Clock.H:127
Fl_Clock_Output::hour
int hour() const
Returns the displayed hour (0 to 23).
Definition Fl_Clock.H:92
Fl_Clock_Output::Fl_Clock_Output
Fl_Clock_Output(int X, int Y, int W, int H, const char *L=0)
Create a new Fl_Clock_Output widget with the given position, size and label.
Definition Fl_Clock.cxx:157
Fl_Clock_Output::shadow
int shadow() const
Returns the shadow drawing mode of the hands.
Definition Fl_Clock.H:113
Fl_Clock_Output::minute
int minute() const
Returns the displayed minute (0 to 59).
Definition Fl_Clock.H:98
Fl_Clock_Output::value
ulong value() const
Returns the displayed time.
Definition Fl_Clock.H:86
Fl_Clock_Output::second
int second() const
Returns the displayed second (0 to 60, 60=leap second).
Definition Fl_Clock.H:104
Fl_Clock_Output::value
void value(ulong v)
Set the displayed time.
Definition Fl_Clock.cxx:139
Fl_Clock::Fl_Clock
Fl_Clock(int X, int Y, int W, int H, const char *L=0)
Create an Fl_Clock widget using the given position, size, and label string.
Definition Fl_Clock.cxx:180
Fl_Widget::draw
virtual void draw()=0
Draws the widget.
Fl_Widget::handle
virtual int handle(int event)
Handles the specified event.
Definition Fl_Widget.cxx:102
FL_OVERRIDE
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46
uchar
unsigned char uchar
unsigned char
Definition fl_types.h:30
ulong
unsigned long ulong
unsigned long
Definition fl_types.h:32