Improve and clarify Fl_Clock documentation.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12236 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser
2017-05-15 14:26:02 +00:00
parent 039beaf26a
commit 034148b289
2 changed files with 63 additions and 14 deletions

View File

@@ -3,7 +3,7 @@
//
// Clock header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 1998-2017 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -26,19 +26,22 @@
#include "Fl_Widget.H"
#endif
// values for type:
// Values for type():
// Please change doxygen documentation below (class Fl_Clock_Output)
// accordingly as well when changing the following type values:
#define FL_SQUARE_CLOCK 0 /**< type() of Square Clock variant */
#define FL_ROUND_CLOCK 1 /**< type() of Round Clock variant */
#define FL_ANALOG_CLOCK FL_SQUARE_CLOCK /**< An analog clock is square */
#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK /**< Not yet implemented */
// fabien: Please keep the horizontal formatting of both images in class desc,
// don't lose vert. space for nothing!
// don't lose vertical space for nothing!
/**
\class Fl_Clock_Output
\brief This widget can be used to display a program-supplied time.
The time shown on the clock is not updated. To display the current time,
use Fl_Clock instead.
@@ -50,6 +53,16 @@
\htmlonly </TD> </TR> </table> \endhtmlonly
\image latex clock.png "FL_SQUARE_CLOCK type" width=4cm
\image latex round_clock.png "FL_ROUND_CLOCK type" width=4cm
Values for clock type() (\#include \<FL/Clock.H\>):
\code
#define FL_SQUARE_CLOCK 0 // Square Clock variant
#define FL_ROUND_CLOCK 1 // Round Clock variant
#define FL_ANALOG_CLOCK FL_SQUARE_CLOCK // An analog clock is square
#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK // Not yet implemented
\endcode
*/
class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
int hour_, minute_, second_;
@@ -100,7 +113,9 @@ public:
Fl_Clock is provided for Forms compatibility.
It installs a 1-second timeout callback using Fl::add_timeout().
You can choose the rounded or square type of the clock with type(), see below.
You can choose the rounded or square type of the clock with type().
Please see Fl_Clock_Output widget for applicable values.
\htmlonly <BR> <table align=CENTER border=1 cellpadding=5 >
<caption align=bottom>type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK </caption> <TR><TD> \endhtmlonly
\image html clock.png
@@ -109,6 +124,8 @@ public:
\htmlonly </TD> </TR> </table> \endhtmlonly
\image latex clock.png "FL_SQUARE_CLOCK type" width=4cm
\image latex round_clock.png "FL_ROUND_CLOCK type" width=4cm
\see class Fl_Clock_Output
*/
class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
public:

View File

@@ -144,7 +144,10 @@ void Fl_Clock_Output::value(ulong v) {
/**
Create a new Fl_Clock_Output widget with the given position, size and label.
The default boxtype is \c FL_NO_BOX.
The default clock type is \c FL_SQUARE_CLOCK and the default boxtype is
\c FL_UP_BOX.
\param[in] X, Y, W, H position and size of the widget
\param[in] L widget label, default is no label
*/
@@ -163,7 +166,10 @@ Fl_Clock_Output::Fl_Clock_Output(int X, int Y, int W, int H, const char *L)
/**
Create an Fl_Clock widget using the given position, size, and label string.
The default boxtype is \c FL_NO_BOX.
The default clock type is FL_SQUARE_CLOCK and the default
boxtype is \c FL_UP_BOX.
\param[in] X, Y, W, H position and size of the widget
\param[in] L widget label, default is no label
*/
@@ -171,12 +177,25 @@ Fl_Clock::Fl_Clock(int X, int Y, int W, int H, const char *L)
: Fl_Clock_Output(X, Y, W, H, L) {}
/**
Create an Fl_Clock widget using the given boxtype, position, size, and
label string.
\param[in] t boxtype
Create an Fl_Clock widget using the given clock type \p t,
position, size, and label string.
The default clock type \p t is \c FL_SQUARE_CLOCK. You can set the
clock type to FL_ROUND_CLOCK or any other valid clock type.
See Fl_Clock_Output widget for applicable values.
The default boxtype is \c FL_UP_BOX for \c FL_SQUARE_CLOCK
and \c FL_NO_BOX for \c FL_ROUND_CLOCK, if set by the constructor.
If you change the clock type with type() later you should also set
the boxtype with box().
\param[in] t type of clock: FL_ROUND_CLOCK or FL_SQUARE_CLOCK (0)
\param[in] X, Y, W, H position and size of the widget
\param[in] L widget label, default is no label
*/
\see class Fl_Clock_Output
*/
Fl_Clock::Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L)
: Fl_Clock_Output(X, Y, W, H, L) {
type(t);
@@ -202,7 +221,7 @@ int Fl_Clock::handle(int event) {
}
return Fl_Clock_Output::handle(event);
}
/**
The destructor removes the clock.
*/
@@ -211,10 +230,23 @@ Fl_Clock::~Fl_Clock() {
}
/**
Create an Fl_Round_Clock widget using the given
position, size, and label string.
The clock type is \c FL_ROUND_CLOCK and the boxtype is \c FL_NO_BOX.
This construcktor is the same as Fl_Clock(FL_ROUND_CLOCK, X, Y, W, H, L).
\see Fl_Clock(uchar, int, int, int, int, const char *)
\param[in] X, Y, W, H position and size of the widget
\param[in] L widget label, default is no label
*/
Fl_Round_Clock::Fl_Round_Clock(int X,int Y,int W,int H, const char *L)
: Fl_Clock(X, Y, W, H, L)
: Fl_Clock(X, Y, W, H, L)
{
type(FL_ROUND_CLOCK);
type(FL_ROUND_CLOCK);
box(FL_NO_BOX);
}