From 92ff2e30bc595fb470d3d78bed9578a7376550a3 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 19 Oct 2014 20:17:17 +0000 Subject: [PATCH] Update docs related to buttons and update Fl_Check_Button.png. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10386 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Button.H | 15 ++++++---- FL/Fl_Check_Button.H | 24 ++++------------ FL/Fl_Radio_Button.H | 4 +-- FL/Fl_Radio_Light_Button.H | 4 +-- FL/Fl_Radio_Round_Button.H | 4 +-- FL/Fl_Round_Button.H | 7 ++--- documentation/src/Fl_Check_Button.png | Bin 461 -> 1652 bytes src/Fl_Button.cxx | 39 ++++++++++++++++++++------ src/Fl_Check_Button.cxx | 34 ++++++++++++++++------ src/Fl_Round_Button.cxx | 39 +++++++++++++++++++++----- 10 files changed, 113 insertions(+), 57 deletions(-) diff --git a/FL/Fl_Button.H b/FL/Fl_Button.H index 9cfcc7d5d..33c684962 100644 --- a/FL/Fl_Button.H +++ b/FL/Fl_Button.H @@ -3,10 +3,10 @@ // // Button header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2014 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 +// the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php @@ -27,7 +27,7 @@ #endif // values for type() -#define FL_NORMAL_BUTTON 0 /**< value() will be set to 1 during the press of the button and +#define FL_NORMAL_BUTTON 0 /**< value() will be set to 1 during the press of the button and reverts back to 0 when the button is released */ #define FL_TOGGLE_BUTTON 1 ///< value() toggles between 0 and 1 at every click of the button #define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2) /**< is set to 1 at button press, and all other @@ -42,7 +42,7 @@ class Fl_Widget_Tracker; /** \class Fl_Button \brief Buttons generate callbacks when they are clicked by the user. - + You control exactly when and how by changing the values for type() and when(). Buttons can also generate callbacks in response to \c FL_SHORTCUT events. The button can either have an explicit shortcut(int s) value or a @@ -72,6 +72,7 @@ class Fl_Widget_Tracker; (when the user pushes and releases the button, and as the mouse is dragged around in and out of the button). */ + class FL_EXPORT Fl_Button : public Fl_Widget { int shortcut_; @@ -84,7 +85,7 @@ protected: static Fl_Widget_Tracker *key_release_tracker; static void key_release_timeout(void*); void simulate_key_action(); - + virtual void draw(); public: @@ -150,6 +151,10 @@ public: /** Sets the down box type. The default value of 0 causes FLTK to figure out the correct matching down version of box(). + + Some derived classes (e.g. Fl_Round_Button and Fl_Light_Button use + down_box() for special purposes. See docs of these classes. + \param[in] b down box type */ void down_box(Fl_Boxtype b) {down_box_ = b;} diff --git a/FL/Fl_Check_Button.H b/FL/Fl_Check_Button.H index c439ab757..9c67c73bb 100644 --- a/FL/Fl_Check_Button.H +++ b/FL/Fl_Check_Button.H @@ -3,10 +3,10 @@ // // Check button header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2014 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 +// the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php @@ -16,29 +16,17 @@ // http://www.fltk.org/str.php // -/* \file - Fl_Check_Button widget . */ - #ifndef Fl_Check_Button_H #define Fl_Check_Button_H #include "Fl_Light_Button.H" -/** - \class Fl_Check_Button - \brief A button with an "checkmark" to show its status. +/* + class: Fl_Check_Button. - \image html Fl_Check_Button.png - \image latex Fl_Check_Button.png "Fl_Check_Button" width=4cm - Buttons generate callbacks when they are clicked by the user. You control - exactly when and how by changing the values for type() and when(). + A button with a "checkmark" to show its status. +*/ - The Fl_Check_Button subclass displays its "ON" state by showing a "checkmark" - rather than drawing itself pushed in. - - \todo Refactor Fl_Check_Button doxygen comments (add color() info etc?) - \todo Generate Fl_Check_Button.gif with visible checkmark. - */ class FL_EXPORT Fl_Check_Button : public Fl_Light_Button { public: Fl_Check_Button(int X, int Y, int W, int H, const char *L = 0); diff --git a/FL/Fl_Radio_Button.H b/FL/Fl_Radio_Button.H index 99d0922ca..5dafe42a8 100644 --- a/FL/Fl_Radio_Button.H +++ b/FL/Fl_Radio_Button.H @@ -3,10 +3,10 @@ // // Radio button header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2014 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 +// the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php diff --git a/FL/Fl_Radio_Light_Button.H b/FL/Fl_Radio_Light_Button.H index 352dccfda..5945be11f 100644 --- a/FL/Fl_Radio_Light_Button.H +++ b/FL/Fl_Radio_Light_Button.H @@ -3,10 +3,10 @@ // // Radio light button header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2014 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 +// the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php diff --git a/FL/Fl_Radio_Round_Button.H b/FL/Fl_Radio_Round_Button.H index a53673827..91f53481a 100644 --- a/FL/Fl_Radio_Round_Button.H +++ b/FL/Fl_Radio_Round_Button.H @@ -3,10 +3,10 @@ // // Radio round button header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2014 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 +// the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php diff --git a/FL/Fl_Round_Button.H b/FL/Fl_Round_Button.H index d71e75766..f5cb03325 100644 --- a/FL/Fl_Round_Button.H +++ b/FL/Fl_Round_Button.H @@ -3,10 +3,10 @@ // // Round button header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2014 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 +// the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php @@ -16,9 +16,6 @@ // http://www.fltk.org/str.php // -/* \file - Fl_Round_Button widget . */ - #ifndef Fl_Round_Button_H #define Fl_Round_Button_H diff --git a/documentation/src/Fl_Check_Button.png b/documentation/src/Fl_Check_Button.png index 63cfc85581328e197604566e3e55938e36c89220..b0084e811483eb08da8c927434419ce819eae03c 100644 GIT binary patch literal 1652 zcmV-)28;QLP)hR9{y1EG z*=((!2KW2dJ#Y6s=YF2^JonrU>FMbKjQ&k|F^_;QS41? z2L=YVGgu;#3=R%D?{nwQosf`_^73-`?7MmMrbr~ZdiAPDR_ocj?NWFE0GUkYd}K>Y z3%w|p%R4$c=ruJpHAzWH+cCmyHa9gj_4fA8&d%=HvnL@TAtxv2*s)_f`)KGZ+P80C zTwGjnaj{S+bUE<$?c0%&k=L(Z-?aFDzykoRt*tp}ZEbB`R}&u}Pe&dZ8Mz$`=H})k z5(xmHsHjLF5Uj1O4G#}jS63fBdX&Xt?JPf$NK{c#0RUK7Sa|d14UXe#wVKUl@AjSN zL%V-wy1H6hTdULQSS;4r zvuCedxq=`FTB_e1ASNJuak46xYP*vRE_>+9?Fdi~PUQcO%tadGj10|#JKkB*ME+wC7dd_WL{ zzF5z|b8;^?^z-M>zP>&T!yq|I91aIw>vX#F=g$)aVKSNIa=Az(N=r)v05mi-==J)t zvNArO|M~OhhYuh6`T3=%rvm_9y?UiqtFK+VmXeaPw6tV28rRLM*Xs#_xO?|*YHI3s z>|9=6?&|6a3JMAh4Rska7Z(?ugv}Q(UUYVL;yAv4|NgeNwp+JuQADZM_V#uh$E8v! zNseFOpl^@<@72)etwKYsj} zmX>C-+1|Z-S5;MY`0!x>0GG@C`t_?;t4&W&w_2^u&CMkxCFjnagVAqYz;9@1kjv%C z$;r;m`}FD4nKNeq04pmifq{Yd@89?K_Wl!RwcG6~mFmWg8&pOwEiD}$9#*MT5beQ( z2dNpOqN0u*IYKSgO?dPO3CV4h3+XuzMNv=f&iMFvcpV%ZJU>4V03b=yYPI4xPVX5W z9!@pcY&IB+HtxB_#l>gOp2fw*xtv-k6jC|QVzFqo+KP&b+S=OS;9$4cGC4W9va$l5 z20@Udq$HEc1Upbsno>YOz}(#2ALTrXpG$J?D-A|uBb;Dqr z%?7uH*=&aOF-4Q!160E?si&bbI&iEi5c-YHCue)!)8-`|{LZMJ9l`}IlD2gT~Cdy1R<450RT>p&qky1;>C*q06#xJ9*>-7uAowiiu_R`P*0000~ccr#D!=2pC#o-9S>;k*!KHad}>CnVZ_!9 ziK|WqcKNE;{=B_eKC?MO#{K!rlYi$ZA*C4)AvaM=dI<^ z>NTaqU&STwidget(); if (btn) { @@ -197,7 +197,16 @@ void Fl_Button::key_release_timeout(void *d) } /** - The constructor creates the button using the given position, size and label. + The constructor creates the button using the given position, size, and label. + + The default box type is box(FL_UP_BOX). + + You can control how the button is drawn when ON by setting down_box(). + The default is FL_NO_BOX (0) which will select an appropriate box type + using the normal (OFF) box type by using fl_down(box()). + + Derived classes may handle this differently. + \param[in] X, Y, W, H position and size of the widget \param[in] L widget label, default is no label */ @@ -210,15 +219,29 @@ Fl_Button::Fl_Button(int X, int Y, int W, int H, const char *L) set_flag(SHORTCUT_LABEL); } +/** + The constructor creates the button using the given position, size, and label. + The Button type() is set to FL_RADIO_BUTTON. + + \param[in] X, Y, W, H position and size of the widget + \param[in] L widget label, default is no label + */ Fl_Radio_Button::Fl_Radio_Button(int X,int Y,int W,int H,const char *L) : Fl_Button(X, Y, W, H, L) { type(FL_RADIO_BUTTON); } +/** + The constructor creates the button using the given position, size, and label. -Fl_Toggle_Button::Fl_Toggle_Button(int X,int Y,int W,int H,const char *l) -: Fl_Button(X,Y,W,H,l) + The Button type() is set to FL_TOGGLE_BUTTON. + + \param[in] X, Y, W, H position and size of the widget + \param[in] L widget label, default is no label + */ +Fl_Toggle_Button::Fl_Toggle_Button(int X,int Y,int W,int H,const char *L) +: Fl_Button(X,Y,W,H,L) { type(FL_TOGGLE_BUTTON); } diff --git a/src/Fl_Check_Button.cxx b/src/Fl_Check_Button.cxx index 63dabddb8..56ef3160b 100644 --- a/src/Fl_Check_Button.cxx +++ b/src/Fl_Check_Button.cxx @@ -3,10 +3,10 @@ // // Check button widget for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2014 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 +// the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php @@ -19,14 +19,32 @@ #include #include -// 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. +/** + \class Fl_Check_Button + \brief A button with a "checkmark" to show its status. + + \image html Fl_Check_Button.png + \image latex Fl_Check_Button.png "Fl_Check_Button" width=4cm + + Buttons generate callbacks when they are clicked by the user. You control + exactly when and how by changing the values for type() and when(). + + The Fl_Check_Button subclass displays its "ON" state by showing a "checkmark" + rather than drawing itself pushed in. + */ /** - Creates a new Fl_Check_Button widget using the given position, size and - label string. + Creates a new Fl_Check_Button widget using the given position, size, and label string. + + The default box type is FL_NO_BOX, which draws the label w/o a box + right of the checkmark. + + The selection_color() sets the color of the checkmark. + Default is FL_FOREGROUND_COLOR (usually black). + + You can use down_box() to change the box type of the checkmark. + Default is FL_DOWN_BOX. + \param[in] X, Y, W, H position and size of the widget \param[in] L widget label, default is no label */ diff --git a/src/Fl_Round_Button.cxx b/src/Fl_Round_Button.cxx index d3ba77e22..0f66396cd 100644 --- a/src/Fl_Round_Button.cxx +++ b/src/Fl_Round_Button.cxx @@ -3,10 +3,10 @@ // // Round button for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2014 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 +// the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php @@ -25,19 +25,44 @@ #include /** - Creates a new Fl_Round_Button widget using the given - position, size, and label string. + Creates a new Fl_Round_Button widget using the given position, size, and label string. + + \image html Fl_Round_Button.png + \image latex Fl_Round_Button.png " Fl_Round_Button" width=4cm + + The Fl_Round_Button subclass displays the "ON" state by + turning on a light, rather than drawing pushed in. + + The default box type is FL_NO_BOX, which draws the label w/o a box + right of the checkmark. + + The shape of the "light" is set with down_box() and its default + value is FL_ROUND_DOWN_BOX. + + The color of the light when on is controlled with selection_color(), + which defaults to FL_FOREGROUND_COLOR (usually black). + + \param[in] X, Y, W, H position and size of the widget + \param[in] L widget label, default is no label */ -Fl_Round_Button::Fl_Round_Button(int X,int Y,int W,int H, const char *l) -: Fl_Light_Button(X,Y,W,H,l) { +Fl_Round_Button::Fl_Round_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_ROUND_DOWN_BOX); selection_color(FL_FOREGROUND_COLOR); } +/** + Creates a new Fl_Radio_Button widget using the given position, size, and label string. + + The button type() is set to FL_RADIO_BUTTON. + + \param[in] X, Y, W, H position and size of the widget + \param[in] L widget label, default is no label +*/ Fl_Radio_Round_Button::Fl_Radio_Round_Button(int X,int Y,int W,int H,const char *L) -: Fl_Round_Button(X,Y,W,H,L) +: Fl_Round_Button(X,Y,W,H,L) { type(FL_RADIO_BUTTON); }