Add thin up box with plastic style.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2981 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2003-05-18 22:12:24 +00:00
parent 180e298537
commit 8a2aa0a0d1
8 changed files with 89 additions and 24 deletions

View File

@ -1,5 +1,6 @@
CHANGES IN FLTK 1.1.4
- Added thin plastic box types.
- Fl_Pack ignored the box() setting and cleared any
unused areas to the widget color; it now only does so
if the box() is set to something other than FL_NO_BOX.

View File

@ -1,5 +1,5 @@
//
// "$Id: Enumerations.H,v 1.18.2.14.2.33 2003/02/13 21:58:03 easysw Exp $"
// "$Id: Enumerations.H,v 1.18.2.14.2.34 2003/05/18 22:12:19 easysw Exp $"
//
// Enumerations for the Fast Light Tool Kit (FLTK).
//
@ -173,6 +173,7 @@ enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
_FL_OVAL_FRAME, _FL_OFLAT_BOX,
_FL_PLASTIC_UP_BOX, _FL_PLASTIC_DOWN_BOX,
_FL_PLASTIC_UP_FRAME, _FL_PLASTIC_DOWN_FRAME,
_FL_PLASTIC_THIN_UP_BOX, _FL_PLASTIC_THIN_DOWN_BOX,
FL_FREE_BOXTYPE
};
extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
@ -202,6 +203,8 @@ extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX();
#define FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+1)
#define FL_PLASTIC_UP_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+2)
#define FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+3)
#define FL_PLASTIC_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+4)
#define FL_PLASTIC_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+5)
// conversions of box types to other boxtypes:
inline Fl_Boxtype fl_down(Fl_Boxtype b) {return (Fl_Boxtype)(b|1);}
@ -414,5 +417,5 @@ enum Fl_Damage {
#endif
//
// End of "$Id: Enumerations.H,v 1.18.2.14.2.33 2003/02/13 21:58:03 easysw Exp $".
// End of "$Id: Enumerations.H,v 1.18.2.14.2.34 2003/05/18 22:12:19 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.23 2003/03/26 01:16:36 easysw Exp $"
// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.24 2003/05/18 22:12:19 easysw Exp $"
//
// Widget type code for the Fast Light Tool Kit (FLTK).
//
@ -501,6 +501,8 @@ Fl_Menu_Item boxmenu[] = {
{"OFLAT_BOX",0,0,(void *)FL_OFLAT_BOX},
{"PLASTIC_UP_BOX",0,0,(void *)FL_PLASTIC_UP_BOX},
{"PLASTIC_DOWN_BOX",0,0,(void *)FL_PLASTIC_DOWN_BOX},
{"PLASTIC_THIN_UP_BOX",0,0,(void *)FL_PLASTIC_THIN_UP_BOX},
{"PLASTIC_THIN_DOWN_BOX",0,0,(void *)FL_PLASTIC_THIN_DOWN_BOX},
{0},
{"frames",0,0,0,FL_SUBMENU},
{"UP_FRAME",0,0,(void *)FL_UP_FRAME},
@ -1976,5 +1978,5 @@ int Fl_Widget_Type::read_fdesign(const char* propname, const char* value) {
}
//
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.23 2003/03/26 01:16:36 easysw Exp $".
// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.24 2003/05/18 22:12:19 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.23 2003/01/30 21:42:05 easysw Exp $"
// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.24 2003/05/18 22:12:20 easysw Exp $"
//
// Menu code for the Fast Light Tool Kit (FLTK).
//
@ -341,8 +341,14 @@ void menuwindow::drawentry(const Fl_Menu_Item* m, int n, int eraseit) {
int hh = itemheight - LEADING;
if (eraseit && n != selected) {
fl_color(button && !Fl::scheme() ? button->color() : FL_GRAY);
fl_rectf(xx+1, yy-(LEADING-2)/2, ww-2, hh+(LEADING-2));
if (Fl::scheme()) {
fl_push_clip(xx+1, yy-(LEADING-2)/2, ww-2, hh+(LEADING-2));
draw_box(box(), 0, 0, w(), h(), color());
fl_pop_clip();
} else {
fl_color(button ? button->color() : FL_GRAY);
fl_rectf(xx+1, yy-(LEADING-2)/2, ww-2, hh+(LEADING-2));
}
}
m->draw(xx, yy, ww, hh, button, n==selected);
@ -784,5 +790,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
}
//
// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.23 2003/01/30 21:42:05 easysw Exp $".
// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.24 2003/05/18 22:12:20 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.18 2003/05/16 02:19:46 easysw Exp $"
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.19 2003/05/18 22:12:21 easysw Exp $"
//
// System color support for the Fast Light Tool Kit (FLTK).
//
@ -283,8 +283,8 @@ int Fl::reload_scheme() {
set_boxtype(FL_UP_BOX, FL_PLASTIC_UP_BOX);
set_boxtype(FL_DOWN_BOX, FL_PLASTIC_DOWN_BOX);
set_boxtype(FL_THIN_UP_BOX, FL_PLASTIC_UP_BOX);
set_boxtype(FL_THIN_DOWN_BOX, FL_PLASTIC_DOWN_BOX);
set_boxtype(FL_THIN_UP_BOX, FL_PLASTIC_THIN_UP_BOX);
set_boxtype(FL_THIN_DOWN_BOX, FL_PLASTIC_THIN_DOWN_BOX);
set_boxtype(_FL_ROUND_UP_BOX, FL_PLASTIC_UP_BOX);
set_boxtype(_FL_ROUND_DOWN_BOX, FL_PLASTIC_UP_BOX);
} else {
@ -320,5 +320,5 @@ int Fl::reload_scheme() {
//
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.18 2003/05/16 02:19:46 easysw Exp $".
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.19 2003/05/18 22:12:21 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_boxtype.cxx,v 1.8.2.4.2.12 2003/01/30 21:43:27 easysw Exp $"
// "$Id: fl_boxtype.cxx,v 1.8.2.4.2.13 2003/05/18 22:12:24 easysw Exp $"
//
// Box drawing code for the Fast Light Tool Kit (FLTK).
//
@ -226,6 +226,8 @@ static struct {
{fl_down_box, 2,2,4,4,0}, // _FL_PLASTIC_DOWN_BOX,
{fl_up_frame, 2,2,4,4,0}, // _FL_PLASTIC_UP_FRAME,
{fl_down_frame, 2,2,4,4,0}, // _FL_PLASTIC_DOWN_FRAME,
{fl_up_box, 2,2,4,4,0}, // _FL_PLASTIC_THIN_UP_BOX,
{fl_down_box, 2,2,4,4,0}, // _FL_PLASTIC_THIN_DOWN_BOX,
{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
@ -295,5 +297,5 @@ const {
}
//
// End of "$Id: fl_boxtype.cxx,v 1.8.2.4.2.12 2003/01/30 21:43:27 easysw Exp $".
// End of "$Id: fl_boxtype.cxx,v 1.8.2.4.2.13 2003/05/18 22:12:24 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_plastic.cxx,v 1.1.2.17 2003/05/16 18:33:03 easysw Exp $"
// "$Id: fl_plastic.cxx,v 1.1.2.18 2003/05/18 22:12:24 easysw Exp $"
//
// "Plastic" drawing routines for the Fast Light Tool Kit (FLTK).
//
@ -34,13 +34,48 @@
#include <FL/fl_draw.H>
#include "flstring.h"
//
// Uncomment the following line to restore the old plastic box type
// appearance.
//
//#define USE_OLD_PLASTIC_BOX
extern uchar *fl_gray_ramp();
inline Fl_Color shade_color(uchar gc, Fl_Color bc) {
#ifdef USE_OLD_PLASTIC_BOX
return fl_color_average((Fl_Color)gc, bc, 0.75f);
#else
unsigned grgb = Fl::get_color((Fl_Color)gc),
brgb = Fl::get_color(bc);
int red, green, blue, gray;
gray = ((grgb >> 24) & 255);
red = gray * ((brgb >> 24) & 255) / 255 + gray * gray / 510;
gray = ((grgb >> 16) & 255);
green = gray * ((brgb >> 16) & 255) / 255 + gray * gray / 510;
gray = ((grgb >> 8) & 255);
blue = gray * ((brgb >> 8) & 255) / 255 + gray * gray / 510;
if (red > 255)
red = 255;
if (green > 255)
green = 255;
if (blue > 255)
blue = 255;
if (Fl::draw_box_active())
return fl_rgb_color(red, green, blue);
else
return fl_color_average(FL_GRAY, fl_rgb_color(red, green, blue), 0.75f);
#endif // USE_OLD_PLASTIC_BOX
}
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;
@ -141,13 +176,24 @@ static void up_frame(int x, int y, int w, int h, Fl_Color c) {
static void up_box(int x, int y, int w, int h, Fl_Color c) {
#if 0 // OLD UP BOX
#ifdef USE_OLD_PLASTIC_BOX
shade_rect(x + 2, y + 2, w - 4, h - 5, "RVQNOPQRSTUVWVQ", c);
up_frame(x, y, w, h, c);
#else // NEW UP BOX
#else
shade_rect(x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c);
shade_frame(x, y, w, h - 1, "IJLM", c);
#endif // 0
#endif // USE_OLD_PLASTIC_BOX
}
static void thin_up_box(int x, int y, int w, int h, Fl_Color c) {
#ifdef USE_OLD_PLASTIC_BOX
shade_rect(x + 2, y + 2, w - 4, h - 5, "RVQNOPQRSTUVWVQ", c);
up_frame(x, y, w, h, c);
#else
shade_rect(x + 1, y + 1, w - 2, h - 3, "RQOQSUWQ", c);
shade_frame(x, y, w, h - 1, "IJLM", c);
#endif // USE_OLD_PLASTIC_BOX
}
@ -171,11 +217,13 @@ Fl_Boxtype fl_define_FL_PLASTIC_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);
fl_internal_boxtype(_FL_PLASTIC_THIN_UP_BOX, thin_up_box);
fl_internal_boxtype(_FL_PLASTIC_THIN_DOWN_BOX, down_box);
return _FL_PLASTIC_UP_BOX;
}
//
// End of "$Id: fl_plastic.cxx,v 1.1.2.17 2003/05/16 18:33:03 easysw Exp $".
// End of "$Id: fl_plastic.cxx,v 1.1.2.18 2003/05/18 22:12:24 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: boxtype.cxx,v 1.4.2.3.2.3 2003/01/30 21:44:56 easysw Exp $"
// "$Id: boxtype.cxx,v 1.4.2.3.2.4 2003/05/18 22:12:24 easysw Exp $"
//
// Boxtype test program for the Fast Light Tool Kit (FLTK).
//
@ -30,9 +30,9 @@
#include <FL/Fl_Box.H>
int N = 0;
#define W 150
#define W 200
#define H 50
#define ROWS 9
#define ROWS 10
Fl_Window *window;
@ -86,12 +86,15 @@ int main(int argc, char ** argv) {
bt("FL_PLASTIC_DOWN_BOX",FL_PLASTIC_DOWN_BOX);
bt("FL_PLASTIC_UP_FRAME",FL_PLASTIC_UP_FRAME);
bt("FL_PLASTIC_DOWN_FRAME",FL_PLASTIC_DOWN_FRAME);
bt("FL_PLASTIC_THIN_UP_BOX",FL_PLASTIC_THIN_UP_BOX);
bt("FL_PLASTIC_THIN_DOWN_BOX",FL_PLASTIC_THIN_DOWN_BOX);
window->resizable(window);
window->end();
window->show(argc,argv);
// window->show(argc,argv);
window->show();
return Fl::run();
}
//
// End of "$Id: boxtype.cxx,v 1.4.2.3.2.3 2003/01/30 21:44:56 easysw Exp $".
// End of "$Id: boxtype.cxx,v 1.4.2.3.2.4 2003/05/18 22:12:24 easysw Exp $".
//