summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Button.cxx21
-rw-r--r--src/Fl_Chart.cxx57
-rw-r--r--src/Fl_Check_Button.cxx13
-rw-r--r--src/Fl_Choice.cxx28
-rw-r--r--src/Fl_Clock.cxx50
-rw-r--r--src/Fl_Color_Chooser.cxx31
-rw-r--r--src/Fl_Counter.cxx15
7 files changed, 188 insertions, 27 deletions
diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx
index a3f0a8d6a..044d1e443 100644
--- a/src/Fl_Button.cxx
+++ b/src/Fl_Button.cxx
@@ -3,7 +3,7 @@
//
// Button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2008 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -34,6 +34,12 @@
// them are implemented by setting the type() value and testing it
// here. This includes Fl_Radio_Button and Fl_Toggle_Button
+/**
+ Sets the current value of the button.
+ A non-zero value sets the button to 1 (ON), and zero sets it to 0 (OFF).
+ \param[in] v button value.
+ \see set(), clear()
+ */
int Fl_Button::value(int v) {
v = v ? 1 : 0;
oldval = v;
@@ -48,6 +54,10 @@ int Fl_Button::value(int v) {
}
}
+/**
+ Turns on this button and turns off all other radio buttons in the group
+ (calling \c value(1) or \c set() does not do this).
+ */
void Fl_Button::setonly() { // set this radio button on, turn others off
value(1);
Fl_Group* g = (Fl_Group*)parent();
@@ -159,8 +169,13 @@ int Fl_Button::handle(int event) {
}
}
-Fl_Button::Fl_Button(int X, int Y, int W, int H, const char *l)
-: Fl_Widget(X,Y,W,H,l) {
+/**
+ The constructor creates the button using the given position, size and label.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Button::Fl_Button(int X, int Y, int W, int H, const char *L)
+: Fl_Widget(X,Y,W,H,L) {
box(FL_UP_BOX);
down_box(FL_NO_BOX);
value_ = oldval = 0;
diff --git a/src/Fl_Chart.cxx b/src/Fl_Chart.cxx
index 48529924d..fad325f48 100644
--- a/src/Fl_Chart.cxx
+++ b/src/Fl_Chart.cxx
@@ -3,7 +3,7 @@
//
// Forms-compatible chart widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2008 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -285,8 +285,14 @@ void Fl_Chart::draw() {
#define FL_CHART_LCOL FL_LCOL
#define FL_CHART_ALIGN FL_ALIGN_BOTTOM
-Fl_Chart::Fl_Chart(int X, int Y, int W, int H,const char *l) :
-Fl_Widget(X,Y,W,H,l) {
+/**
+ Create a new Fl_Chart widget using the given position, size and label string.
+ The default boxstyle is \c FL_NO_BOX.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Chart::Fl_Chart(int X, int Y, int W, int H,const char *L) :
+Fl_Widget(X,Y,W,H,L) {
box(FL_BORDER_BOX);
align(FL_ALIGN_BOTTOM);
numb = 0;
@@ -300,15 +306,28 @@ Fl_Widget(X,Y,W,H,l) {
entries = (FL_CHART_ENTRY *)calloc(sizeof(FL_CHART_ENTRY), FL_CHART_MAX + 1);
}
+/**
+ Destroys the Fl_Chart widget and all of its data.
+ */
Fl_Chart::~Fl_Chart() {
free(entries);
}
+/**
+ Removes all values from the chart.
+ */
void Fl_Chart::clear() {
numb = 0;
redraw();
}
+/**
+ Add the data value \p val with optional label \p str and color \p col
+ to the chart.
+ \param[in] val data value
+ \param[in] str optional data label
+ \param[in] col optional data color
+ */
void Fl_Chart::add(double val, const char *str, unsigned col) {
/* Allocate more entries if required */
if (numb >= sizenumb) {
@@ -331,6 +350,14 @@ void Fl_Chart::add(double val, const char *str, unsigned col) {
redraw();
}
+/**
+ Inserts a data value \p val at the given position \p ind.
+ Position 1 is the first data value.
+ \param[in] ind insertion position
+ \param[in] val data value
+ \param[in] str optional data label
+ \param[in] col optional data color
+ */
void Fl_Chart::insert(int ind, double val, const char *str, unsigned col) {
int i;
if (ind < 1 || ind > numb+1) return;
@@ -353,6 +380,14 @@ void Fl_Chart::insert(int ind, double val, const char *str, unsigned col) {
redraw();
}
+/**
+ Replace a data value \p val at the given position \p ind.
+ Position 1 is the first data value.
+ \param[in] ind insertion position
+ \param[in] val data value
+ \param[in] str optional data label
+ \param[in] col optional data color
+ */
void Fl_Chart::replace(int ind,double val, const char *str, unsigned col) {
if (ind < 1 || ind > numb) return;
entries[ind-1].val = float(val);
@@ -365,12 +400,22 @@ void Fl_Chart::replace(int ind,double val, const char *str, unsigned col) {
redraw();
}
-void Fl_Chart::bounds(double mymin, double mymax) {
- this->min = mymin;
- this->max = mymax;
+/**
+ Sets the lower and upper bounds of the chart values.
+ \param[in] a, b are used to set lower, upper
+ */
+void Fl_Chart::bounds(double a, double b) {
+ this->min = a;
+ this->max = b;
redraw();
}
+/**
+ Set the maximum number of data values for a chart.
+ If you do not call this method then the chart will be allowed to grow
+ to any size depending on available memory.
+ \param[in] m maximum number of data values allowed.
+ */
void Fl_Chart::maxsize(int m) {
int i;
/* Fill in the new number */
diff --git a/src/Fl_Check_Button.cxx b/src/Fl_Check_Button.cxx
index addd33d38..38bf5188b 100644
--- a/src/Fl_Check_Button.cxx
+++ b/src/Fl_Check_Button.cxx
@@ -3,7 +3,7 @@
//
// Check button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2008 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -28,12 +28,19 @@
#include <FL/Fl.H>
#include <FL/Fl_Check_Button.H>
+// TODO Correct incorrect Fl_Check_Button comments.
// A subclass of Fl_Button that always draws as a diamond box. This
// diamond is smaller than the widget size and can be surchecked by
// another box type, for compatibility with Forms.
-Fl_Check_Button::Fl_Check_Button(int X, int Y, int W, int H, const char *l)
-: Fl_Light_Button(X, Y, W, H, l) {
+/**
+ Creates a new Fl_Check_Button widget using the given position, size and
+ label string.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Check_Button::Fl_Check_Button(int X, int Y, int W, int H, const char *L)
+: Fl_Light_Button(X, Y, W, H, L) {
box(FL_NO_BOX);
down_box(FL_DOWN_BOX);
selection_color(FL_FOREGROUND_COLOR);
diff --git a/src/Fl_Choice.cxx b/src/Fl_Choice.cxx
index 469658a07..243fe83e9 100644
--- a/src/Fl_Choice.cxx
+++ b/src/Fl_Choice.cxx
@@ -3,7 +3,7 @@
//
// Choice widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2008 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -112,8 +112,18 @@ void Fl_Choice::draw() {
draw_label();
}
-Fl_Choice::Fl_Choice(int X, int Y, int W, int H, const char *l)
-: Fl_Menu_(X,Y,W,H,l) {
+/**
+ Create a new Fl_Choice widget using the given position, size and label string.
+ The default boxtype is \c FL_UP_BOX.
+
+ The constructor sets menu() to NULL.
+ See Fl_Menu_ for the methods to set or change the menu.
+
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Choice::Fl_Choice(int X, int Y, int W, int H, const char *L)
+: Fl_Menu_(X,Y,W,H,L) {
align(FL_ALIGN_LEFT);
when(FL_WHEN_RELEASE);
textfont(FL_HELVETICA);
@@ -121,12 +131,24 @@ Fl_Choice::Fl_Choice(int X, int Y, int W, int H, const char *l)
down_box(FL_BORDER_BOX);
}
+/**
+ Sets the currently selected value using a pointer to menu item.
+ Changing the selected value causes a redraw().
+ \param[in] v pointer to menu item in the menu item array.
+ \returns non-zero if the new value is different to the old one.
+ */
int Fl_Choice::value(const Fl_Menu_Item *v) {
if (!Fl_Menu_::value(v)) return 0;
redraw();
return 1;
}
+/**
+ Sets the currently selected value using the index into the menu item array.
+ Changing the selected value causes a redraw().
+ \param[in] v index of value in the menu item array.
+ \returns non-zero if the new value is different to the old one.
+ */
int Fl_Choice::value(int v) {
if (v == -1) return value((const Fl_Menu_Item *)0);
if (v < 0 || v >= (size() - 1)) return 0;
diff --git a/src/Fl_Clock.cxx b/src/Fl_Clock.cxx
index 7d724402e..b13223c5e 100644
--- a/src/Fl_Clock.cxx
+++ b/src/Fl_Clock.cxx
@@ -3,7 +3,7 @@
//
// Clock widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2006 by Bill Spitzak and others.
+// Copyright 1998-2008 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -112,6 +112,12 @@ void Fl_Clock_Output::draw() {
draw_label();
}
+/**
+ Set the displayed time.
+ Set the time in hours, minutes, and seconds.
+ \param[in] H, m, s displayed time
+ \see hour(), minute(), second()
+ */
void Fl_Clock_Output::value(int H, int m, int s) {
if (H!=hour_ || m!=minute_ || s!=second_) {
hour_ = H; minute_ = m; second_ = s;
@@ -120,6 +126,12 @@ void Fl_Clock_Output::value(int H, int m, int s) {
}
}
+/**
+ Set the displayed time.
+ Set the time in seconds since the UNIX epoch (January 1, 1970).
+ \param[in] v seconds since epoch
+ \see value()
+ */
void Fl_Clock_Output::value(ulong v) {
value_ = v;
struct tm *timeofday;
@@ -129,8 +141,14 @@ void Fl_Clock_Output::value(ulong v) {
value(timeofday->tm_hour, timeofday->tm_min, timeofday->tm_sec);
}
-Fl_Clock_Output::Fl_Clock_Output(int X, int Y, int W, int H, const char *l)
-: Fl_Widget(X, Y, W, H, l) {
+/**
+ Create a new Fl_Clock_Output widget with the given position, size and label.
+ The default boxtype is \c FL_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)
+: Fl_Widget(X, Y, W, H, L) {
box(FL_UP_BOX);
selection_color(fl_gray_ramp(5));
align(FL_ALIGN_BOTTOM);
@@ -142,11 +160,24 @@ Fl_Clock_Output::Fl_Clock_Output(int X, int Y, int W, int H, const char *l)
////////////////////////////////////////////////////////////////
-Fl_Clock::Fl_Clock(int X, int Y, int W, int H, const char *l)
- : Fl_Clock_Output(X, Y, W, H, l) {}
-
-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) {
+/**
+ Create an Fl_Clock widget using the given position, size, and label string.
+ The default boxtype is \c FL_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) {}
+
+/**
+ Create an Fl_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) {
type(t);
box(t==FL_ROUND_CLOCK ? FL_NO_BOX : FL_UP_BOX);
}
@@ -168,6 +199,9 @@ int Fl_Clock::handle(int event) {
return Fl_Clock_Output::handle(event);
}
+/**
+ The destructor removes the clock.
+ */
Fl_Clock::~Fl_Clock() {
Fl::remove_timeout(tick, this);
}
diff --git a/src/Fl_Color_Chooser.cxx b/src/Fl_Color_Chooser.cxx
index d97b2b577..01e4edbe7 100644
--- a/src/Fl_Color_Chooser.cxx
+++ b/src/Fl_Color_Chooser.cxx
@@ -3,7 +3,7 @@
//
// Color chooser for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2008 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -47,6 +47,11 @@
// you get this by defining this:
#define UPDATE_HUE_BOX 1
+/**
+ This \e static method converts HSV colors to RGB colorspace.
+ \param[in] H, S, V color components
+ \param[out] R, G, B color components
+ */
void Fl_Color_Chooser::hsv2rgb(
double H, double S, double V, double& R, double& G, double& B) {
if (S < 5.0e-6) {
@@ -68,6 +73,11 @@ void Fl_Color_Chooser::hsv2rgb(
}
}
+/**
+ This \e static method converts RGB colors to HSV colorspace.
+ \param[in] R, G, B color components
+ \param[out] H, S, V color components
+ */
void Fl_Color_Chooser::rgb2hsv(
double R, double G, double B, double& H, double& S, double& V) {
double maxv = R > G ? R : G; if (B > maxv) maxv = B;
@@ -119,6 +129,12 @@ void Fl_Color_Chooser::set_valuators() {
}
}
+/**
+ Sets the current rgb color values.
+ Does not do the callback. Does not clamp (but out of range values will
+ produce psychedelic effects in the hue selector).
+ \param[in] R, G, B color components.
+ */
int Fl_Color_Chooser::rgb(double R, double G, double B) {
if (R == r_ && G == g_ && B == b_) return 0;
r_ = R; g_ = G; b_ = B;
@@ -140,6 +156,12 @@ int Fl_Color_Chooser::rgb(double R, double G, double B) {
return 1;
}
+/**
+ Set the hsv values.
+ The passed values are clamped (or for hue, modulus 6 is used) to get
+ legal values. Does not do the callback.
+ \param[in] H, S, V color components.
+ */
int Fl_Color_Chooser::hsv(double H, double S, double V) {
H = fmod(H,6.0); if (H < 0.0) H += 6.0;
if (S < 0.0) S = 0.0; else if (S > 1.0) S = 1.0;
@@ -413,6 +435,13 @@ void Fl_Color_Chooser::mode_cb(Fl_Widget* o, void*) {
////////////////////////////////////////////////////////////////
+/**
+ Creates a new Fl_Color_Chooser widget using the given position, size, and
+ label string.
+ The recommended dimensions are 200x95. The color is initialized to black.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
Fl_Color_Chooser::Fl_Color_Chooser(int X, int Y, int W, int H, const char* L)
: Fl_Group(0,0,195,115,L),
huebox(0,0,115,115),
diff --git a/src/Fl_Counter.cxx b/src/Fl_Counter.cxx
index 656016e42..f0a79a417 100644
--- a/src/Fl_Counter.cxx
+++ b/src/Fl_Counter.cxx
@@ -3,7 +3,7 @@
//
// Counter widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2008 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -174,12 +174,21 @@ int Fl_Counter::handle(int event) {
}
}
+/**
+ Destroys the valuator.
+ */
Fl_Counter::~Fl_Counter() {
Fl::remove_timeout(repeat_callback, this);
}
-Fl_Counter::Fl_Counter(int X, int Y, int W, int H, const char* l)
- : Fl_Valuator(X, Y, W, H, l) {
+/**
+ Creates a new Fl_Counter widget using the given position, size, and label
+ string. The default type is FL_NORMAL_COUNTER.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Counter::Fl_Counter(int X, int Y, int W, int H, const char* L)
+ : Fl_Valuator(X, Y, W, H, L) {
box(FL_UP_BOX);
selection_color(FL_INACTIVE_COLOR); // was FL_BLUE
align(FL_ALIGN_BOTTOM);