diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-11-28 21:37:35 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-11-28 21:37:35 +0000 |
| commit | 79d6a32be98d8809c915fd4914cb57a5730202b3 (patch) | |
| tree | d9ec1ec8fbf8d45c2487717be39a379db2c4234a /src | |
| parent | 313a2430eae8a78b59bf9e727a810708be3a377b (diff) | |
Add new plastic box types (kindof a shiny translucent box type...)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1781 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Light_Button.cxx | 6 | ||||
| -rw-r--r-- | src/Makefile | 5 | ||||
| -rw-r--r-- | src/fl_boxtype.cxx | 8 | ||||
| -rw-r--r-- | src/fl_plastic.cxx | 165 | ||||
| -rw-r--r-- | src/makedepend | 51 |
5 files changed, 198 insertions, 37 deletions
diff --git a/src/Fl_Light_Button.cxx b/src/Fl_Light_Button.cxx index f065f8bba..5d70e5fc8 100644 --- a/src/Fl_Light_Button.cxx +++ b/src/Fl_Light_Button.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.6 2001/10/26 20:30:05 easysw Exp $" +// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.7 2001/11/28 21:37:35 easysw Exp $" // // Lighted button widget for the Fast Light Tool Kit (FLTK). // @@ -45,6 +45,8 @@ void Fl_Light_Button::draw() { switch (down_box()) { case FL_DOWN_BOX : case FL_UP_BOX : + case _FL_PLASTIC_DOWN_BOX : + case _FL_PLASTIC_UP_BOX : // Check box... draw_box(down_box(), x()+d, y()+d, W, W, FL_WHITE); if (value()) { @@ -105,5 +107,5 @@ Fl_Light_Button::Fl_Light_Button(int x, int y, int w, int h, const char* l) } // -// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.6 2001/10/26 20:30:05 easysw Exp $". +// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.7 2001/11/28 21:37:35 easysw Exp $". // diff --git a/src/Makefile b/src/Makefile index 12f9e70b8..debe44770 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile,v 1.18.2.14.2.21 2001/11/27 17:44:07 easysw Exp $" +# "$Id: Makefile,v 1.18.2.14.2.22 2001/11/28 21:37:35 easysw Exp $" # # Library makefile for the Fast Light Tool Kit (FLTK). # @@ -137,6 +137,7 @@ CPPFILES = \ fl_oval_box.cxx \ fl_overlay.cxx \ fl_overlay_visual.cxx \ + fl_plastic.cxx \ fl_rect.cxx \ fl_round_box.cxx \ fl_rounded_box.cxx \ @@ -296,5 +297,5 @@ uninstall: # -# End of "$Id: Makefile,v 1.18.2.14.2.21 2001/11/27 17:44:07 easysw Exp $". +# End of "$Id: Makefile,v 1.18.2.14.2.22 2001/11/28 21:37:35 easysw Exp $". # diff --git a/src/fl_boxtype.cxx b/src/fl_boxtype.cxx index da8794d59..7718a7171 100644 --- a/src/fl_boxtype.cxx +++ b/src/fl_boxtype.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_boxtype.cxx,v 1.8.2.4.2.3 2001/11/22 15:35:01 easysw Exp $" +// "$Id: fl_boxtype.cxx,v 1.8.2.4.2.4 2001/11/28 21:37:35 easysw Exp $" // // Box drawing code for the Fast Light Tool Kit (FLTK). // @@ -219,6 +219,10 @@ static struct { {fl_border_box, 1,1,2,2,0}, // _FL_OVAL_SHADOW_BOX, {fl_border_frame, 1,1,2,2,0}, // _FL_OVAL_FRAME {fl_rectf, 0,0,0,0,0}, // _FL_OVAL_FLAT_BOX, + {fl_up_box, 3,3,5,5,0}, // _FL_PLASTIC_UP_BOX, + {fl_down_box, 3,3,5,5,0}, // _FL_PLASTIC_DOWN_BOX, + {fl_up_frame, 3,3,5,5,0}, // _FL_PLASTIC_UP_FRAME, + {fl_down_frame, 3,3,5,5,0}, // _FL_PLASTIC_DOWN_FRAME, {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+0 {fl_down_box, 3,3,6,6,0}, // FL_FREE_BOX+1 {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+2 @@ -284,5 +288,5 @@ const { } // -// End of "$Id: fl_boxtype.cxx,v 1.8.2.4.2.3 2001/11/22 15:35:01 easysw Exp $". +// End of "$Id: fl_boxtype.cxx,v 1.8.2.4.2.4 2001/11/28 21:37:35 easysw Exp $". // diff --git a/src/fl_plastic.cxx b/src/fl_plastic.cxx new file mode 100644 index 000000000..512337d7a --- /dev/null +++ b/src/fl_plastic.cxx @@ -0,0 +1,165 @@ +// +// "$Id: fl_plastic.cxx,v 1.1.2.1 2001/11/28 21:37:35 easysw Exp $" +// +// "Plastic" drawing routines for the Fast Light Tool Kit (FLTK). +// +// These box types provide a +// Copyright 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". +// + +// Box drawing code for an obscure box type. +// These box types are in seperate files so they are not linked +// in if not used. + +#include <FL/Fl.H> +#include <FL/fl_draw.H> +#include <string.h> + + +extern uchar *fl_gray_ramp(); + +inline Fl_Color shade_color(uchar gc, Fl_Color bc) { + return fl_color_average((Fl_Color)gc, bc, 0.67f); +} + +static void shade_frame(int x, int y, int w, int h, const char *c, Fl_Color bc) { + uchar *g = fl_gray_ramp(); + int b = strlen(c) / 4 + 1; + + for (x += b, y += b, w -= 2 * b, h -= 2 * b; b > 1; b --) + { + fl_color(shade_color(g[*c++], bc)); + fl_line(x, y + h + b, x + w - 1, y + h + b, x + w + b - 1, y + h); + fl_color(shade_color(g[*c++], bc)); + fl_line(x + w + b - 1, y + h, x + w + b - 1, y, x + w - 1, y - b); + fl_color(shade_color(g[*c++], bc)); + fl_line(x + w - 1, y - b, x, y - b, x - b, y); + fl_color(shade_color(g[*c++], bc)); + fl_line(x - b, y, x - b, y + h, x, y + h + b); + } +} + +static void shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) +{ + uchar *g = fl_gray_ramp(); + int xoff, yoff; + int cmod, cerr; + int clen = strlen(c); + + + if (w >= h) + { + h ++; + cmod = clen % h; + cerr = 0; + + fl_color(shade_color(g[*c], bc)); + + for (yoff = 0; yoff < h; yoff ++) + { + fl_xyline(x, y + yoff, x + w - 1); + + cerr += cmod; + if (cerr >= h) + { + cerr -= h; + c ++; + + fl_color(shade_color(g[*c], bc)); + } + } + } + else + { + w ++; + cmod = clen % w; + cerr = 0; + + fl_color(shade_color(g[*c], bc)); + + for (xoff = 0; xoff < w; xoff ++) + { + fl_yxline(x + xoff, y, y + h - 1); + + cerr += cmod; + if (cerr >= w) + { + cerr -= w; + c ++; + + fl_color(shade_color(g[*c], bc)); + } + } + } +} + + +static void up_frame(int x, int y, int w, int h, Fl_Color c) { + shade_frame(x, y, w, h, "RRSSDLNN", c); +} + + +static void up_box(int x, int y, int w, int h, Fl_Color c) { + if (w > 30 && h > 30) + { + fl_color(c); + fl_rectf(x + 2, y + 2, w - 4, h - 4); + } + else + shade_rect(x + 2, y + 2, w - 4, h - 4, "VUTSSTUVWW", c); + + up_frame(x, y, w, h, c); +} + + +static void down_frame(int x, int y, int w, int h, Fl_Color c) { + shade_frame(x, y, w, h, "LLRRTTLL", c); +} + + +static void down_box(int x, int y, int w, int h, Fl_Color c) { + if (w > 30 && h > 30) + { + fl_color(c); + fl_rectf(x + 2, y + 2, w - 4, h - 4); + } + else + shade_rect(x + 2, y + 2, w - 4, h - 4, "STUVWWWWVT", c); + + down_frame(x, y, w, h, c); +} + + +extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*); + + +Fl_Boxtype define_FL_PLASTIC_UP_BOX() { + fl_internal_boxtype(_FL_PLASTIC_UP_BOX, up_box); + fl_internal_boxtype(_FL_PLASTIC_DOWN_BOX, down_box); + fl_internal_boxtype(_FL_PLASTIC_UP_FRAME, up_frame); + fl_internal_boxtype(_FL_PLASTIC_DOWN_FRAME, down_frame); + + return _FL_PLASTIC_UP_BOX; +} + + +// +// End of "$Id: fl_plastic.cxx,v 1.1.2.1 2001/11/28 21:37:35 easysw Exp $". +// diff --git a/src/makedepend b/src/makedepend index a5a25956a..068b94b35 100644 --- a/src/makedepend +++ b/src/makedepend @@ -276,7 +276,8 @@ Fl_visual.o: ../FL/x.H ../FL/Fl_Window.H Fl_x.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H Fl_x.o: ../FL/x.H ../FL/Fl_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H Fl_x.o: ../FL/Fl_Widget.H -filename_absolute.o: ../FL/filename.H ../FL/Fl_Export.H +filename_absolute.o: ../FL/filename.H ../FL/Fl_Export.H flstring.h +filename_absolute.o: ../config.h filename_expand.o: ../FL/filename.H ../FL/Fl_Export.H filename_ext.o: ../FL/filename.H ../FL/Fl_Export.H filename_isdir.o: ../config.h ../FL/filename.H ../FL/Fl_Export.H @@ -313,15 +314,15 @@ fl_draw_pixmap.o: ../FL/Fl_Export.H ../FL/fl_draw.H ../FL/x.H fl_draw_pixmap.o: ../FL/Fl_Window.H fl_engraved_label.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H fl_engraved_label.o: ../FL/Fl_Widget.H ../FL/fl_draw.H -fl_file_dir.o: ../config.h ../FL/Fl_File_Chooser.H ../FL/Fl.H -fl_file_dir.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Window.H -fl_file_dir.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_File_Browser.H -fl_file_dir.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H -fl_file_dir.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_File_Icon.H -fl_file_dir.o: ../FL/Fl.H ../FL/Fl_Button.H ../FL/Fl_Return_Button.H -fl_file_dir.o: ../FL/Fl_Button.H ../FL/fl_ask.H ../FL/Fl_Input.H -fl_file_dir.o: ../FL/Fl_Input_.H ../FL/Fl_Choice.H ../FL/Fl_Menu_.H -fl_file_dir.o: ../FL/Fl_Menu_Item.H +fl_file_dir.o: ../config.h ../FL/filename.H ../FL/Fl_Export.H +fl_file_dir.o: ../FL/Fl_File_Chooser.H ../FL/Fl.H ../FL/Enumerations.H +fl_file_dir.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H +fl_file_dir.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H +fl_file_dir.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H +fl_file_dir.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/Fl_Button.H +fl_file_dir.o: ../FL/Fl_Return_Button.H ../FL/Fl_Button.H ../FL/fl_ask.H +fl_file_dir.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Choice.H +fl_file_dir.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H fl_font.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H fl_font.o: ../FL/fl_draw.H ../FL/x.H ../FL/Fl_Window.H Fl_Font.H fl_labeltype.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H @@ -335,6 +336,8 @@ fl_oval_box.o: ../FL/fl_draw.H fl_overlay.o: ../FL/x.H ../FL/Enumerations.H ../FL/Fl_Export.H fl_overlay.o: ../FL/Fl_Window.H ../FL/fl_draw.H fl_overlay_visual.o: ../config.h +fl_plastic.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H +fl_plastic.o: ../FL/fl_draw.H fl_rect.o: ../FL/Fl_Widget.H ../FL/fl_draw.H ../FL/Enumerations.H fl_rect.o: ../FL/Fl_Export.H ../FL/x.H ../FL/Fl_Window.H fl_round_box.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H @@ -440,27 +443,13 @@ forms_pixmap.o: ../FL/Fl_Input.H ../FL/Fl_Menu_Button.H ../FL/Fl_Positioner.H forms_pixmap.o: ../FL/Fl_Value_Slider.H ../FL/Fl_Timer.H forms_timer.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H forms_timer.o: ../FL/Fl_Timer.H ../FL/Fl_Widget.H ../FL/fl_draw.H -Fl_Gl_Choice.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H -Fl_Gl_Choice.o: ../FL/x.H ../FL/Fl_Window.H Fl_Gl_Choice.H -Fl_Gl_Overlay.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H -Fl_Gl_Overlay.o: ../FL/Fl_Export.H ../FL/x.H ../FL/Fl_Window.H Fl_Gl_Choice.H -Fl_Gl_Overlay.o: ../FL/Fl_Gl_Window.H -Fl_Gl_Window.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H -Fl_Gl_Window.o: ../FL/x.H ../FL/Fl_Window.H Fl_Gl_Choice.H -Fl_Gl_Window.o: ../FL/Fl_Gl_Window.H -gl_draw.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H -gl_draw.o: ../FL/gl.h ../FL/x.H ../FL/Fl_Window.H ../FL/fl_draw.H -gl_draw.o: Fl_Gl_Choice.H Fl_Font.H -gl_start.o: ../config.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H -gl_start.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/x.H -gl_start.o: ../FL/Fl_Window.H ../FL/fl_draw.H Fl_Gl_Choice.H -glut_compatability.o: ../config.h ../FL/glut.H ../FL/gl.h -glut_compatability.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl.H -glut_compatability.o: ../FL/Fl_Gl_Window.H ../FL/Fl_Window.H -glut_compatability.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H -glut_font.o: ../config.h ../FL/glut.H ../FL/gl.h ../FL/Enumerations.H -glut_font.o: ../FL/Fl_Export.H ../FL/Fl.H ../FL/Fl_Gl_Window.H -glut_font.o: ../FL/Fl_Window.H +Fl_Gl_Choice.o: ../config.h +Fl_Gl_Overlay.o: ../config.h +Fl_Gl_Window.o: ../config.h +gl_draw.o: ../config.h +gl_start.o: ../config.h +glut_compatability.o: ../config.h +glut_font.o: ../config.h scandir.o: ../config.h numericsort.o: ../config.h vsnprintf.o: ../config.h |
