diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Progress.cxx | 108 | ||||
| -rw-r--r-- | src/Makefile | 6 | ||||
| -rw-r--r-- | src/makedepend | 8 |
3 files changed, 119 insertions, 3 deletions
diff --git a/src/Fl_Progress.cxx b/src/Fl_Progress.cxx new file mode 100644 index 000000000..d8406aff7 --- /dev/null +++ b/src/Fl_Progress.cxx @@ -0,0 +1,108 @@ +// +// "$Id: Fl_Progress.cxx,v 1.1.2.1 2001/08/11 14:49:51 easysw Exp $" +// +// Progress bar widget routines. +// +// Copyright 2000-2001 by Michael Sweet. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to "fltk-bugs@fltk.org". +// +// Contents: +// +// Fl_Progress::draw() - Draw the check button. +// Fl_Progress::Fl_Progress() - Construct a Fl_Progress widget. +// + +// +// Include necessary header files... +// + +#include <FL/Fl.H> +#include <FL/Fl_Progress.H> +#include <FL/fl_draw.H> + + +// +// Fl_Progress is a progress bar widget based off Fl_Widget that shows a +// standard progress bar... +// + + +// +// 'Fl_Progress::draw()' - Draw the check button. +// + +void Fl_Progress::draw() +{ + int progress; // Size of progress bar... + int bx, by, bw, bh; // Box areas... + + + // Get the box borders... + bx = Fl::box_dx(box()); + by = Fl::box_dy(box()); + bw = Fl::box_dw(box()); + bh = Fl::box_dh(box()); + + // Draw the box... + draw_box(box(), x(), y(), w(), h(), color()); + + // Draw the progress bar... + if (maximum_ > minimum_) + progress = (int)((w() - bw) * (value_ - minimum_) / + (maximum_ - minimum_) + 0.5f); + else + progress = 0; + + if (progress > 0) + { + fl_clip(x() + bx, y() + by, w() - bw, h() - bh); + + fl_color(active_r() ? color2() : inactive(color2())); + fl_polygon(x() + bx, y() + by, + x() + bx, y() + h() - by, + x() + 3 + progress - h() / 4, y() + h() - by, + x() + 1 + progress + h() / 4, y() + by); + + fl_pop_clip(); + } + + // Finally, the label... + draw_label(x() + bx, y() + by, w() - bw, h() - bh); +} + + +// +// 'Fl_Progress::Fl_Progress()' - Construct a Fl_Progress widget. +// + +Fl_Progress::Fl_Progress(int x, int y, int w, int h, const char* l) +: Fl_Widget(x, y, w, h, l) +{ + align(FL_ALIGN_INSIDE); + box(FL_DOWN_BOX); + color(FL_WHITE, FL_YELLOW); + minimum(0.0f); + maximum(100.0f); + value(0.0f); +} + + +// +// End of "$Id: Fl_Progress.cxx,v 1.1.2.1 2001/08/11 14:49:51 easysw Exp $". +// diff --git a/src/Makefile b/src/Makefile index af470233b..6f1097bc4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile,v 1.18.2.14.2.8 2001/08/04 12:21:33 easysw Exp $" +# "$Id: Makefile,v 1.18.2.14.2.9 2001/08/11 14:49:51 easysw Exp $" # # Library makefile for the Fast Light Tool Kit (FLTK). # @@ -33,6 +33,7 @@ CPPFILES = \ Fl_Box.cxx \ Fl_Button.cxx \ Fl_Chart.cxx \ + Fl_Check_Browser.cxx \ Fl_Check_Button.cxx \ Fl_Choice.cxx \ Fl_Clock.cxx \ @@ -64,6 +65,7 @@ CPPFILES = \ Fl_Pack.cxx \ Fl_Pixmap.cxx \ Fl_Positioner.cxx \ + Fl_Progress.cxx \ Fl_Repeat_Button.cxx \ Fl_Return_Button.cxx \ Fl_Roller.cxx \ @@ -256,5 +258,5 @@ install: $(LIBNAME) $(DSONAME) $(GLLIBNAME) $(GLDSONAME) ln -s FL $(includedir)/Fl # -# End of "$Id: Makefile,v 1.18.2.14.2.8 2001/08/04 12:21:33 easysw Exp $". +# End of "$Id: Makefile,v 1.18.2.14.2.9 2001/08/11 14:49:51 easysw Exp $". # diff --git a/src/makedepend b/src/makedepend index 955beb154..0b4e467a5 100644 --- a/src/makedepend +++ b/src/makedepend @@ -29,6 +29,10 @@ Fl_Button.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H Fl_Button.o: ../FL/Fl_Button.H ../FL/Fl_Widget.H ../FL/Fl_Group.H Fl_Chart.o: ../FL/math.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H Fl_Chart.o: ../FL/Fl_Chart.H ../FL/Fl_Widget.H ../FL/fl_draw.H +Fl_Check_Browser.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H +Fl_Check_Browser.o: ../FL/Fl_Check_Browser.H ../FL/Fl.H ../FL/Fl_Browser_.H +Fl_Check_Browser.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H +Fl_Check_Browser.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H Fl_Check_Button.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H Fl_Check_Button.o: ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H Fl_Check_Button.o: ../FL/Fl_Button.H ../FL/Fl_Widget.H @@ -57,7 +61,7 @@ Fl_FileBrowser.o: ../FL/Fl_FileBrowser.H ../FL/Fl_Browser.H Fl_FileBrowser.o: ../FL/Fl_Browser_.H ../FL/Fl_Group.H ../FL/Fl_Widget.H Fl_FileBrowser.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Scrollbar.H Fl_FileBrowser.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_FileIcon.H -Fl_FileBrowser.o: ../FL/Fl.H ../FL/fl_draw.H ../FL/filename.H +Fl_FileBrowser.o: ../FL/Fl.H ../FL/fl_draw.H ../FL/filename.H ../config.h Fl_FileChooser.o: ../FL/Fl_FileChooser.H ../FL/Fl.H ../FL/Enumerations.H Fl_FileChooser.o: ../FL/Fl_Export.H ../FL/Fl_Window.H ../FL/Fl_Group.H Fl_FileChooser.o: ../FL/Fl_Widget.H ../FL/Fl_FileBrowser.H ../FL/Fl_Browser.H @@ -141,6 +145,8 @@ Fl_Pixmap.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H ../FL/Fl_Pixmap.H Fl_Pixmap.o: ../FL/Fl_Image.H Fl_Positioner.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H Fl_Positioner.o: ../FL/Fl_Positioner.H ../FL/Fl_Widget.H ../FL/fl_draw.H +Fl_Progress.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H +Fl_Progress.o: ../FL/Fl_Progress.H ../FL/Fl_Widget.H ../FL/fl_draw.H Fl_Repeat_Button.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H Fl_Repeat_Button.o: ../FL/Fl_Repeat_Button.H ../FL/Fl.H ../FL/Fl_Button.H Fl_Repeat_Button.o: ../FL/Fl_Widget.H |
