Author: matt
Date: 2011-05-18 23:37:02 -0700 (Wed, 18 May 2011)
New Revision: 8690
Log:
123: updated 'clock' test.
Modified:
branches/branch-3.0/fltk3/Clock.h
branches/branch-3.0/fltk3/RoundClock.h
branches/branch-3.0/fltk3/forms.h
branches/branch-3.0/fluid/factory.cxx
branches/branch-3.0/fluid/function_panel.cxx
branches/branch-3.0/src/Fl_Clock.cxx
branches/branch-3.0/test/buttons.cxx
branches/branch-3.0/test/clock.cxx
Modified: branches/branch-3.0/fltk3/Clock.h
===================================================================
--- branches/branch-3.0/fltk3/Clock.h 2011-05-19 06:29:46 UTC (rev 8689)
+++ branches/branch-3.0/fltk3/Clock.h 2011-05-19 06:37:02 UTC (rev 8690)
@@ -26,109 +26,111 @@
//
/* \file
- Fl_Clock, Fl_Clock_Output widgets . */
+ fltk3::Clock, fltk3::ClockOutput widgets . */
#ifndef Fltk3_Clock_H
#define Fltk3_Clock_H
-#ifndef Fl_Widget_H
#include "Widget.h"
-#endif
-// values for type:
-#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!
-
-/**
- \class Fl_Clock_Output
- \brief This widget can be used to display a program-supplied time.
+namespace fltk3 {
- The time shown on the clock is not updated. To display the current time,
- use Fl_Clock instead.
-
- \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
- \htmlonly </TD> <TD> \endhtmlonly
- \image html round_clock.png
- \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
- */
-class FLTK3_EXPORT Fl_Clock_Output : public fltk3::Widget {
- int hour_, minute_, second_;
- ulong value_;
- void drawhands(fltk3::Color,fltk3::Color); // part of draw
-protected:
- void draw();
- void draw(int X, int Y, int W, int H);
-public:
-
- Fl_Clock_Output(int X, int Y, int W, int H, const char *L = 0);
-
- void value(ulong v); // set to this Unix time
+ // values for type:
+ const uchar SQUARE_CLOCK = 0; /**< type() of Square Clock variant */
+ const uchar ROUND_CLOCK = 1; /**< type() of Round Clock variant */
+ const uchar ANALOG_CLOCK = SQUARE_CLOCK; /**< An analog clock is square
*/
+ const uchar DIGITAL_CLOCK = SQUARE_CLOCK; /**< Not yet implemented */
- void value(int H, int m, int s);
-
+ // fabien: Please keep the horizontal formatting of both images in class
desc,
+ // don't lose vert. space for nothing!
+
/**
- Returns the displayed time.
- Returns the time in seconds since the UNIX epoch (January 1, 1970).
- \see value(ulong)
+ \class fltk3::ClockOutput
+ \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 fltk3::Clock instead.
+
+ \htmlonly <BR> <table align=CENTER border=1 cellpadding=5 >
+ <caption align=bottom>type() fltk3::SQUARE_CLOCK and fltk3::ROUND_CLOCK
</caption> <TR><TD> \endhtmlonly
+ \image html clock.png
+ \htmlonly </TD> <TD> \endhtmlonly
+ \image html round_clock.png
+ \htmlonly </TD> </TR> </table> \endhtmlonly
+ \image latex clock.png "fltk3::SQUARE_CLOCK type" width=4cm
+ \image latex round_clock.png "fltk3::ROUND_CLOCK type" width=4cm
*/
- ulong value() const {return value_;}
-
+ class FLTK3_EXPORT ClockOutput : public Widget {
+ int hour_, minute_, second_;
+ ulong value_;
+ void drawhands(fltk3::Color,fltk3::Color); // part of draw
+ protected:
+ void draw();
+ void draw(int X, int Y, int W, int H);
+ public:
+
+ ClockOutput(int X, int Y, int W, int H, const char *L = 0);
+
+ void value(ulong v); // set to this Unix time
+
+ void value(int H, int m, int s);
+
+ /**
+ Returns the displayed time.
+ Returns the time in seconds since the UNIX epoch (January 1, 1970).
+ \see value(ulong)
+ */
+ ulong value() const {return value_;}
+
+ /**
+ Returns the displayed hour (0 to 23).
+ \see value(), minute(), second()
+ */
+ int hour() const {return hour_;}
+
+ /**
+ Returns the displayed minute (0 to 59).
+ \see value(), hour(), second()
+ */
+ int minute() const {return minute_;}
+
+ /**
+ Returns the displayed second (0 to 60, 60=leap second).
+ \see value(), hour(), minute()
+ */
+ int second() const {return second_;}
+ };
+
+ // a fltk3::Clock displays the current time always by using a timeout:
+
/**
- Returns the displayed hour (0 to 23).
- \see value(), minute(), second()
+ \class fltk3::Clock
+ \brief This widget provides a round analog clock display.
+
+ fltk3::Clock is provided for Forms compatibility.
+ It installs a 1-second timeout callback using fltk3::add_timeout().
+ You can choose the rounded or square type of the clock with type(), see
below.
+ \htmlonly <BR> <table align=CENTER border=1 cellpadding=5 >
+ <caption align=bottom>type() fltk3::SQUARE_CLOCK and fltk3::ROUND_CLOCK
</caption> <TR><TD> \endhtmlonly
+ \image html clock.png
+ \htmlonly </TD> <TD> \endhtmlonly
+ \image html round_clock.png
+ \htmlonly </TD> </TR> </table> \endhtmlonly
+ \image latex clock.png "fltk3::SQUARE_CLOCK type" width=4cm
+ \image latex round_clock.png "fltk3::ROUND_CLOCK type" width=4cm
*/
- int hour() const {return hour_;}
-
- /**
- Returns the displayed minute (0 to 59).
- \see value(), hour(), second()
- */
- int minute() const {return minute_;}
-
- /**
- Returns the displayed second (0 to 60, 60=leap second).
- \see value(), hour(), minute()
- */
- int second() const {return second_;}
-};
-
-// a Fl_Clock displays the current time always by using a timeout:
-
-/**
- \class Fl_Clock
- \brief This widget provides a round analog clock display.
-
- Fl_Clock is provided for Forms compatibility.
- It installs a 1-second timeout callback using fltk3::add_timeout().
- You can choose the rounded or square type of the clock with type(), see
below.
- \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
- \htmlonly </TD> <TD> \endhtmlonly
- \image html round_clock.png
- \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
- */
-class FLTK3_EXPORT Fl_Clock : public Fl_Clock_Output {
-public:
- int handle(int);
-
- Fl_Clock(int X, int Y, int W, int H, const char *L = 0);
+ class FLTK3_EXPORT Clock : public ClockOutput {
+ public:
+ int handle(int);
+
+ Clock(int X, int Y, int W, int H, const char *L = 0);
+
+ Clock(uchar t, int X, int Y, int W, int H, const char *L);
+
+ ~Clock();
+ };
- Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L);
-
- ~Fl_Clock();
-};
+}
#endif
Modified: branches/branch-3.0/fltk3/RoundClock.h
===================================================================
--- branches/branch-3.0/fltk3/RoundClock.h 2011-05-19 06:29:46 UTC (rev
8689)
+++ branches/branch-3.0/fltk3/RoundClock.h 2011-05-19 06:37:02 UTC (rev
8690)
@@ -26,20 +26,24 @@
//
/* \file
- Fl_Round_Clock widget . */
+ Fl_Round_Clock widget . */
#ifndef Fltk3_Round_Clock_H
#define Fltk3_Round_Clock_H
#include "Clock.h"
-/** A clock widget of type fltk3::ROUND_CLOCK. Has no box. */
-class FLTK3_EXPORT Fl_Round_Clock : public Fl_Clock {
-public:
+namespace fltk3 {
+
+ /** A clock widget of type fltk3::ROUND_CLOCK. Has no box. */
+ class FLTK3_EXPORT RoundClock : public Clock {
+ public:
/** Creates the clock widget, setting his type and box. */
- Fl_Round_Clock(int x,int y,int w,int h, const char *l = 0)
- : Fl_Clock(x,y,w,h,l) {type(fltk3::ROUND_CLOCK); box(fltk3::NO_BOX);}
-};
+ RoundClock(int x,int y,int w,int h, const char *l = 0)
+ : Clock(x,y,w,h,l) {type(fltk3::ROUND_CLOCK); box(fltk3::NO_BOX);}
+ };
+
+}
#endif
Modified: branches/branch-3.0/fltk3/forms.h
===================================================================
--- branches/branch-3.0/fltk3/forms.h 2011-05-19 06:29:46 UTC (rev 8689)
+++ branches/branch-3.0/fltk3/forms.h 2011-05-19 06:37:02 UTC (rev 8690)
@@ -567,11 +567,11 @@
// inline void fl_set_choice_item_shortcut(fltk3::Widget*, int, const char*);
#include "Clock.h"
-forms_constructort(Fl_Clock, fl_add_clock)
+forms_constructort(fltk3::Clock, fl_add_clock)
inline void fl_get_clock(fltk3::Widget* o, int* h, int* m, int* s) {
- *h = ((Fl_Clock*)o)->hour();
- *m = ((Fl_Clock*)o)->minute();
- *s = ((Fl_Clock*)o)->second();
+ *h = ((fltk3::Clock*)o)->hour();
+ *m = ((fltk3::Clock*)o)->minute();
+ *s = ((fltk3::Clock*)o)->second();
}
#include "Counter.h"
Modified: branches/branch-3.0/fluid/factory.cxx
===================================================================
--- branches/branch-3.0/fluid/factory.cxx 2011-05-19 06:29:46 UTC (rev
8689)
+++ branches/branch-3.0/fluid/factory.cxx 2011-05-19 06:37:02 UTC (rev
8690)
@@ -643,16 +643,16 @@
////////////////////////////////////////////////////////////////
#include <fltk3/Clock.h>
-class Fl_Clock_Type : public Fl_Widget_Type {
+class fltk3::Clock_Type : public Fl_Widget_Type {
public:
- virtual const char *type_name() {return "Fl_Clock";}
+ virtual const char *type_name() {return "fltk3::Clock";}
virtual const char *alt_type_name() {return "fltk::Clock";}
fltk3::Widget *widget(int x,int y,int w,int h) {
- return new Fl_Clock(x,y,w,h);}
- Fl_Widget_Type *_make() {return new Fl_Clock_Type();}
+ return new fltk3::Clock(x,y,w,h);}
+ Fl_Widget_Type *_make() {return new fltk3::Clock_Type();}
int pixmapID() { return 34; }
};
-static Fl_Clock_Type Fl_Clock_type;
+static fltk3::Clock_Type fltk3::Clock_type;
////////////////////////////////////////////////////////////////
@@ -1073,7 +1073,7 @@
{0},
{"Other",0,0,0,FL_SUBMENU},
{0,0,cb,(void*)&Fl_Box_type},
- {0,0,cb,(void*)&Fl_Clock_type},
+ {0,0,cb,(void*)&fltk3::Clock_type},
{0,0,cb,(void*)&Fl_Help_View_type},
{0,0,cb,(void*)&Fl_Progress_type},
{0},
Modified: branches/branch-3.0/fluid/function_panel.cxx
===================================================================
--- branches/branch-3.0/fluid/function_panel.cxx 2011-05-19 06:29:46 UTC
(rev 8689)
+++ branches/branch-3.0/fluid/function_panel.cxx 2011-05-19 06:37:02 UTC
(rev 8690)
@@ -1033,7 +1033,7 @@
{ fltk3::Button* o = new fltk3::Button(542, 5, 24, 24);
o->tooltip("Clock");
o->box(fltk3::THIN_UP_BOX);
- o->callback((fltk3::Callback*)type_make_cb, (void*)("Fl_Clock"));
+ o->callback((fltk3::Callback*)type_make_cb, (void*)("fltk3::Clock"));
o->image(pixmap[34]);
} // fltk3::Button* o
{ fltk3::Button* o = new fltk3::Button(517, 30, 24, 24);
Modified: branches/branch-3.0/src/Fl_Clock.cxx
===================================================================
--- branches/branch-3.0/src/Fl_Clock.cxx 2011-05-19 06:29:46 UTC (rev
8689)
+++ branches/branch-3.0/src/Fl_Clock.cxx 2011-05-19 06:37:02 UTC (rev
8690)
@@ -53,7 +53,7 @@
fltk3::pop_matrix();
}
-void Fl_Clock_Output::drawhands(fltk3::Color fill, fltk3::Color line) {
+void fltk3::ClockOutput::drawhands(fltk3::Color fill, fltk3::Color line) {
if (!active_r()) {
fill = fltk3::inactive(fill);
line = fltk3::inactive(line);
@@ -78,14 +78,14 @@
Draw clock with the given position and size.
\param[in] X, Y, W, H position and size
*/
-void Fl_Clock_Output::draw(int X, int Y, int W, int H) {
- fltk3::Color box_color = type()==FL_ROUND_CLOCK ? fltk3::GRAY : color();
+void fltk3::ClockOutput::draw(int X, int Y, int W, int H) {
+ fltk3::Color box_color = type()==fltk3::ROUND_CLOCK ? fltk3::GRAY : color();
fltk3::Color shadow_color = fltk3::color_average(box_color, fltk3::BLACK,
0.5);
draw_box(box(), X, Y, W, H, box_color);
fltk3::push_matrix();
fltk3::translate(X+W/2.0-.5, Y+H/2.0-.5);
fltk3::scale((W-1)/28.0, (H-1)/28.0);
- if (type() == FL_ROUND_CLOCK) {
+ if (type() == fltk3::ROUND_CLOCK) {
fltk3::color(active_r() ? color() : fltk3::inactive(color()));
fltk3::begin_polygon(); fltk3::circle(0,0,14); fltk3::end_polygon();
fltk3::color(active_r() ? fltk3::FOREGROUND_COLOR :
fltk3::inactive(fltk3::FOREGROUND_COLOR));
@@ -114,7 +114,7 @@
/**
Draw clock with current position and size.
*/
-void Fl_Clock_Output::draw() {
+void fltk3::ClockOutput::draw() {
draw(x(), y(), w(), h());
draw_label();
}
@@ -125,7 +125,7 @@
\param[in] H, m, s displayed time
\see hour(), minute(), second()
*/
-void Fl_Clock_Output::value(int H, int m, int s) {
+void fltk3::ClockOutput::value(int H, int m, int s) {
if (H!=hour_ || m!=minute_ || s!=second_) {
hour_ = H; minute_ = m; second_ = s;
value_ = (H * 60 + m) * 60 + s;
@@ -139,7 +139,7 @@
\param[in] v seconds since epoch
\see value()
*/
-void Fl_Clock_Output::value(ulong v) {
+void fltk3::ClockOutput::value(ulong v) {
value_ = v;
struct tm *timeofday;
// Some platforms, notably Windows, now use a 64-bit time_t value...
@@ -149,12 +149,12 @@
}
/**
- Create a new Fl_Clock_Output widget with the given position, size and label.
+ Create a new fltk3::ClockOutput widget with the given position, size and
label.
The default boxtype is \c fltk3::NO_BOX.
\param[in] X, Y, W, H position and size of the widget
\param[in] L widget label, default is no label
*/
-Fl_Clock_Output::Fl_Clock_Output(int X, int Y, int W, int H, const char *L)
+fltk3::ClockOutput::ClockOutput(int X, int Y, int W, int H, const char *L)
: fltk3::Widget(X, Y, W, H, L) {
box(fltk3::UP_BOX);
selection_color(fltk3::gray_ramp(5));
@@ -168,33 +168,33 @@
////////////////////////////////////////////////////////////////
/**
- Create an Fl_Clock widget using the given position, size, and label string.
+ Create an fltk3::Clock widget using the given position, size, and label
string.
The default boxtype is \c fltk3::NO_BOX.
\param[in] X, Y, W, H position and size of the widget
\param[in] L widget label, default is no label
*/
-Fl_Clock::Fl_Clock(int X, int Y, int W, int H, const char *L)
- : Fl_Clock_Output(X, Y, W, H, L) {}
+fltk3::Clock::Clock(int X, int Y, int W, int H, const char *L)
+ : fltk3::ClockOutput(X, Y, W, H, L) {}
/**
- Create an Fl_Clock widget using the given boxtype, position, size, and
+ Create an fltk3::Clock widget using the given boxtype, position, size, and
label string.
\param[in] t boxtype
\param[in] X, Y, W, H position and size of the widget
\param[in] L widget label, default is no label
*/
-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) {
+fltk3::Clock::Clock(uchar t, int X, int Y, int W, int H, const char *L)
+ : fltk3::ClockOutput(X, Y, W, H, L) {
type(t);
- box(t==FL_ROUND_CLOCK ? fltk3::NO_BOX : fltk3::UP_BOX);
+ box(t==fltk3::ROUND_CLOCK ? fltk3::NO_BOX : fltk3::UP_BOX);
}
static void tick(void *v) {
- ((Fl_Clock*)v)->value(time(0));
+ ((fltk3::Clock*)v)->value(time(0));
fltk3::add_timeout(1.0, tick, v);
}
-int Fl_Clock::handle(int event) {
+int fltk3::Clock::handle(int event) {
switch (event) {
case fltk3::SHOW:
tick(this);
@@ -203,13 +203,13 @@
fltk3::remove_timeout(tick, this);
break;
}
- return Fl_Clock_Output::handle(event);
+ return fltk3::ClockOutput::handle(event);
}
/**
The destructor removes the clock.
*/
-Fl_Clock::~Fl_Clock() {
+fltk3::Clock::~Clock() {
fltk3::remove_timeout(tick, this);
}
Modified: branches/branch-3.0/test/buttons.cxx
===================================================================
--- branches/branch-3.0/test/buttons.cxx 2011-05-19 06:29:46 UTC (rev
8689)
+++ branches/branch-3.0/test/buttons.cxx 2011-05-19 06:37:02 UTC (rev
8690)
@@ -28,14 +28,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <fltk3/run.h>
-#include <fltk3/Window.H>
-#include <fltk3/Button.H>
-#include <fltk3/ReturnButton.H>
-#include <fltk3/RepeatButton.H>
-#include <fltk3/CheckButton.H>
-#include <fltk3/LightButton.H>
-#include <fltk3/RoundButton.H>
-#include <fltk3/Tooltip.H>
+#include <fltk3/Window.h>
+#include <fltk3/Button.h>
+#include <fltk3/ReturnButton.h>
+#include <fltk3/RepeatButton.h>
+#include <fltk3/CheckButton.h>
+#include <fltk3/LightButton.h>
+#include <fltk3/RoundButton.h>
+#include <fltk3/Tooltip.h>
int main(int argc, char ** argv) {
fltk3::Window *window = new fltk3::Window(320,130);
Modified: branches/branch-3.0/test/clock.cxx
===================================================================
--- branches/branch-3.0/test/clock.cxx 2011-05-19 06:29:46 UTC (rev 8689)
+++ branches/branch-3.0/test/clock.cxx 2011-05-19 06:37:02 UTC (rev 8690)
@@ -25,27 +25,27 @@
// http://www.fltk.org/str.php
//
-#include <FL/Fl.H>
-#include <FL/Fl_Double_Window.H>
-#include <FL/Fl_Clock.H>
-#include <FL/Fl_Round_Clock.H>
+#include <fltk3/run.h>
+#include <fltk3/DoubleWindow.h>
+#include <fltk3/Clock.h>
+#include <fltk3/RoundClock.h>
int main(int argc, char **argv) {
- Fl_Double_Window window(220,220,"Fl_Clock");
- Fl_Clock c1(0,0,220,220); // c1.color(2,1);
+ fltk3::DoubleWindow window(220,220,"fltk3::Clock");
+ fltk3::Clock c1(0,0,220,220); // c1.color(2,1);
window.resizable(c1);
window.end();
- Fl_Double_Window window2(220,220,"Fl_Round_Clock");
- Fl_Round_Clock c2(0,0,220,220); // c2.color(3,4);
+ fltk3::DoubleWindow window2(220,220,"fltk3::Round_Clock");
+ fltk3::RoundClock c2(0,0,220,220); // c2.color(3,4);
window2.resizable(c2);
window2.end();
// my machine had a clock* Xresource set for another program, so
// I don't want the class to be "clock":
- window.xclass("Fl_Clock");
- window2.xclass("Fl_Clock");
+ window.xclass("fltk3::Clock");
+ window2.xclass("fltk3::Clock");
window.show(argc,argv);
window2.show();
- return Fl::run();
+ return fltk3::run();
}
//
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit