@@ -493,24 +493,6 @@ enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C): | |||||
_FL_OSHADOW_BOX, ///< see figure 1 | _FL_OSHADOW_BOX, ///< see figure 1 | ||||
_FL_OVAL_FRAME, ///< see figure 1 | _FL_OVAL_FRAME, ///< see figure 1 | ||||
_FL_OFLAT_BOX, ///< see figure 1 | _FL_OFLAT_BOX, ///< see figure 1 | ||||
_FL_PLASTIC_UP_BOX, ///< plastic version of FL_UP_BOX | |||||
_FL_PLASTIC_DOWN_BOX, ///< plastic version of FL_DOWN_BOX | |||||
_FL_PLASTIC_UP_FRAME, ///< plastic version of FL_UP_FRAME | |||||
_FL_PLASTIC_DOWN_FRAME, ///< plastic version of FL_DOWN_FRAME | |||||
_FL_PLASTIC_THIN_UP_BOX, ///< plastic version of FL_THIN_UP_BOX | |||||
_FL_PLASTIC_THIN_DOWN_BOX, ///< plastic version of FL_THIN_DOWN_BOX | |||||
_FL_PLASTIC_ROUND_UP_BOX, ///< plastic version of FL_ROUND_UP_BOX | |||||
_FL_PLASTIC_ROUND_DOWN_BOX, ///< plastic version of FL_ROUND_DOWN_BOX | |||||
_FL_GTK_UP_BOX, ///< gtk+ version of FL_UP_BOX | |||||
_FL_GTK_DOWN_BOX, ///< gtk+ version of FL_DOWN_BOX | |||||
_FL_GTK_UP_FRAME, ///< gtk+ version of FL_UP_FRAME | |||||
_FL_GTK_DOWN_FRAME, ///< gtk+ version of FL_DOWN_RAME | |||||
_FL_GTK_THIN_UP_BOX, ///< gtk+ version of FL_THIN_UP_BOX | |||||
_FL_GTK_THIN_DOWN_BOX, ///< gtk+ version of FL_THIN_DOWN_BOX | |||||
_FL_GTK_THIN_UP_FRAME, ///< gtk+ version of FL_UP_FRAME | |||||
_FL_GTK_THIN_DOWN_FRAME, ///< gtk+ version of FL_THIN_DOWN_FRAME | |||||
_FL_GTK_ROUND_UP_BOX, ///< gtk+ version of FL_ROUND_UP_BOX | |||||
_FL_GTK_ROUND_DOWN_BOX, ///< gtk+ version of FL_ROUND_DOWN_BOX | |||||
FL_FREE_BOXTYPE ///< the first free box type for creation of new box types | FL_FREE_BOXTYPE ///< the first free box type for creation of new box types | ||||
}; | }; | ||||
extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX(); | extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX(); | ||||
@@ -535,27 +517,25 @@ extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX(); | |||||
#define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2) | #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2) | ||||
#define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3) | #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3) | ||||
extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX(); | |||||
#define FL_PLASTIC_UP_BOX 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) | |||||
#define FL_PLASTIC_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+6) | |||||
#define FL_PLASTIC_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+7) | |||||
extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX(); | |||||
#define FL_GTK_UP_BOX fl_define_FL_GTK_UP_BOX() | |||||
#define FL_GTK_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+1) | |||||
#define FL_GTK_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+2) | |||||
#define FL_GTK_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+3) | |||||
#define FL_GTK_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+4) | |||||
#define FL_GTK_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+5) | |||||
#define FL_GTK_THIN_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+6) | |||||
#define FL_GTK_THIN_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+7) | |||||
#define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8) | |||||
#define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9) | |||||
#define FL_PLASTIC_UP_BOX FL_UP_BOX | |||||
#define FL_PLASTIC_DOWN_BOX FL_DOWN_BOX | |||||
#define FL_PLASTIC_UP_FRAME FL_UP_FRAME | |||||
#define FL_PLASTIC_DOWN_FRAME FL_DOWN_FRAME | |||||
#define FL_PLASTIC_THIN_UP_BOX FL_THIN_UP_BOX | |||||
#define FL_PLASTIC_THIN_DOWN_BOX FL_THIN_DOWN_BOX | |||||
#define FL_PLASTIC_ROUND_UP_BOX FL_ROUND_UP_BOX | |||||
#define FL_PLASTIC_ROUND_DOWN_BOX FL_ROUND_DOWN_BOX | |||||
#define FL_GTK_UP_BOX FL_UP_BOX | |||||
#define FL_GTK_DOWN_BOX FL_DOWN_BOX | |||||
#define FL_GTK_UP_FRAME FL_UP_FRAME | |||||
#define FL_GTK_DOWN_FRAME FL_DOWN_FRAME | |||||
#define FL_GTK_THIN_UP_BOX FL_THIN_UP_BOX | |||||
#define FL_GTK_THIN_UP_FRAME FL_THIN_UP_FRAME | |||||
#define FL_GTK_THIN_DOWN_FRAME FL_THIN_DOWN_FRAME | |||||
#define FL_GTK_THIN_DOWN_BOX FL_THIN_DOWN_BOX | |||||
#define FL_GTK_ROUND_UP_BOX FL_ROUND_UP_BOX | |||||
#define FL_GTK_ROUND_DOWN_BOX FL_ROUND_DOWN_BOX | |||||
// conversions of box types to other boxtypes: | // conversions of box types to other boxtypes: | ||||
/** | /** | ||||
@@ -54,8 +54,6 @@ void Fl_Light_Button::draw() { | |||||
switch (down_box()) { | switch (down_box()) { | ||||
case FL_DOWN_BOX : | case FL_DOWN_BOX : | ||||
case FL_UP_BOX : | case FL_UP_BOX : | ||||
case _FL_PLASTIC_DOWN_BOX : | |||||
case _FL_PLASTIC_UP_BOX : | |||||
// Check box... | // Check box... | ||||
draw_box(down_box(), x()+dx, y()+dy, W, W, FL_BACKGROUND2_COLOR); | draw_box(down_box(), x()+dx, y()+dy, W, W, FL_BACKGROUND2_COLOR); | ||||
if (value()) { | if (value()) { | ||||
@@ -135,13 +133,13 @@ void Fl_Light_Button::draw() { | |||||
int ww = W/2+1; | int ww = W/2+1; | ||||
int xx = dx; | int xx = dx; | ||||
if (w()<ww+2*xx) xx = (w()-ww)/2; | if (w()<ww+2*xx) xx = (w()-ww)/2; | ||||
if (Fl::scheme() && !strcmp(Fl::scheme(), "plastic")) { | |||||
col = active_r() ? selection_color() : fl_inactive(selection_color()); | |||||
fl_color(value() ? col : fl_color_average(col, FL_BLACK, 0.5f)); | |||||
fl_pie(x()+xx, y()+dy+1, ww, hh, 0, 360); | |||||
} else { | |||||
/* if (Fl::scheme() && !strcmp(Fl::scheme(), "plastic")) { */ | |||||
/* col = active_r() ? selection_color() : fl_inactive(selection_color()); */ | |||||
/* fl_color(value() ? col : fl_color_average(col, FL_BLACK, 0.5f)); */ | |||||
/* fl_pie(x()+xx, y()+dy+1, ww, hh, 0, 360); */ | |||||
/* } else { */ | |||||
draw_box(FL_THIN_DOWN_BOX, x()+xx, y()+dy+1, ww, hh, col); | draw_box(FL_THIN_DOWN_BOX, x()+xx, y()+dy+1, ww, hh, col); | ||||
} | |||||
/* } */ | |||||
dx = (ww + 2 * dx - W) / 2; | dx = (ww + 2 * dx - W) / 2; | ||||
} | } | ||||
draw_label(x()+W+2*dx, y(), w()-W-2*dx, h()); | draw_label(x()+W+2*dx, y(), w()-W-2*dx, h()); | ||||
@@ -74,8 +74,6 @@ void Fl_Scroll::draw_clip(void* v,int X, int Y, int W, int H) { | |||||
case _FL_SHADOW_FRAME : | case _FL_SHADOW_FRAME : | ||||
case _FL_ROUNDED_FRAME : | case _FL_ROUNDED_FRAME : | ||||
case _FL_OVAL_FRAME : | case _FL_OVAL_FRAME : | ||||
case _FL_PLASTIC_UP_FRAME : | |||||
case _FL_PLASTIC_DOWN_FRAME : | |||||
if (s->parent() == (Fl_Group *)s->window() && Fl::scheme_bg_) { | if (s->parent() == (Fl_Group *)s->window() && Fl::scheme_bg_) { | ||||
Fl::scheme_bg_->draw(X-(X%((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->w()), | Fl::scheme_bg_->draw(X-(X%((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->w()), | ||||
Y-(Y%((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->h()), | Y-(Y%((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->h()), | ||||
@@ -153,14 +153,6 @@ Fl_Tree_Prefs::Fl_Tree_Prefs() { | |||||
_sortorder = FL_TREE_SORT_NONE; | _sortorder = FL_TREE_SORT_NONE; | ||||
_selectbox = FL_FLAT_BOX; | _selectbox = FL_FLAT_BOX; | ||||
_selectmode = FL_TREE_SELECT_SINGLE; | _selectmode = FL_TREE_SELECT_SINGLE; | ||||
// Let fltk's current 'scheme' affect defaults | |||||
if ( Fl::scheme() ) { | |||||
if ( strcmp(Fl::scheme(), "gtk+") == 0 ) { | |||||
_selectbox = _FL_GTK_THIN_UP_BOX; | |||||
} else if ( strcmp(Fl::scheme(), "plastic") == 0 ) { | |||||
_selectbox = _FL_PLASTIC_THIN_UP_BOX; | |||||
} | |||||
} | |||||
} | } | ||||
// | // | ||||
@@ -266,158 +266,46 @@ Fl_Image *Fl::scheme_bg_ = (Fl_Image *)0; // current background image for the | |||||
static Fl_Pixmap tile(tile_xpm); | static Fl_Pixmap tile(tile_xpm); | ||||
/** | |||||
Gets or sets the current widget scheme. NULL will use | |||||
the scheme defined in the FLTK_SCHEME environment | |||||
variable or the scheme resource under X11. Otherwise, | |||||
any of the following schemes can be used:</P> | |||||
<ul> | |||||
<li>"none" - This is the default look-n-feel which resembles old | |||||
Windows (95/98/Me/NT/2000) and old GTK/KDE</li> | |||||
<li>"plastic" - This scheme is inspired by the Aqua user interface | |||||
on Mac OS X</li> | |||||
<li>"gtk+" - This scheme is inspired by the Red Hat Bluecurve | |||||
theme</li> | |||||
</ul> | |||||
*/ | |||||
int Fl::scheme(const char *s) { | int Fl::scheme(const char *s) { | ||||
if (!s) { | |||||
if ((s = getenv("FLTK_SCHEME")) == NULL) { | |||||
#if !defined(WIN32) && !defined(__APPLE__) | |||||
const char* key = 0; | |||||
if (Fl::first_window()) key = Fl::first_window()->xclass(); | |||||
if (!key) key = "fltk"; | |||||
fl_open_display(); | |||||
s = XGetDefault(fl_display, key, "scheme"); | |||||
#endif // !WIN32 && !__APPLE__ | |||||
} | |||||
} | |||||
if (s) { | |||||
if (!strcasecmp(s, "none") || !strcasecmp(s, "base") || !*s) s = 0; | |||||
else s = strdup(s); | |||||
} | |||||
if (scheme_) free((void*)scheme_); | |||||
scheme_ = s; | |||||
// Save the new scheme in the FLTK_SCHEME env var so that child processes | |||||
// inherit it... | |||||
static char e[1024]; | |||||
strcpy(e,"FLTK_SCHEME="); | |||||
if (s) strlcat(e,s,sizeof(e)); | |||||
putenv(e); | |||||
printf( "Setting Fl::scheme() is obsolete" ); | |||||
// Load the scheme... | // Load the scheme... | ||||
return reload_scheme(); | return reload_scheme(); | ||||
} | } | ||||
int Fl::reload_scheme() { | int Fl::reload_scheme() { | ||||
Fl_Window *win; | |||||
if (scheme_ && !strcasecmp(scheme_, "plastic")) { | |||||
// Update the tile image to match the background color... | |||||
uchar r, g, b; | |||||
int nr, ng, nb; | |||||
int i; | |||||
// static uchar levels[3] = { 0xff, 0xef, 0xe8 }; | |||||
// OSX 10.3 and higher use a background with less contrast... | |||||
static uchar levels[3] = { 0xff, 0xf8, 0xf4 }; | |||||
get_color(FL_GRAY, r, g, b); | |||||
// printf("FL_GRAY = 0x%02x 0x%02x 0x%02x\n", r, g, b); | |||||
for (i = 0; i < 3; i ++) { | |||||
nr = levels[i] * r / 0xe8; | |||||
if (nr > 255) nr = 255; | |||||
ng = levels[i] * g / 0xe8; | |||||
if (ng > 255) ng = 255; | |||||
nb = levels[i] * b / 0xe8; | |||||
if (nb > 255) nb = 255; | |||||
sprintf(tile_cmap[i], "%c c #%02x%02x%02x", "Oo."[i], nr, ng, nb); | |||||
// puts(tile_cmap[i]); | |||||
} | |||||
tile.uncache(); | |||||
if (!scheme_bg_) scheme_bg_ = new Fl_Tiled_Image(&tile, w(), h()); | |||||
Fl_Window *win; | |||||
// Load plastic buttons, etc... | |||||
set_boxtype(FL_UP_FRAME, FL_PLASTIC_UP_FRAME); | |||||
set_boxtype(FL_DOWN_FRAME, FL_PLASTIC_DOWN_FRAME); | |||||
set_boxtype(FL_THIN_UP_FRAME, FL_PLASTIC_UP_FRAME); | |||||
set_boxtype(FL_THIN_DOWN_FRAME, FL_PLASTIC_DOWN_FRAME); | |||||
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_THIN_UP_BOX); | |||||
set_boxtype(FL_THIN_DOWN_BOX, FL_PLASTIC_THIN_DOWN_BOX); | |||||
set_boxtype(_FL_ROUND_UP_BOX, FL_PLASTIC_ROUND_UP_BOX); | |||||
set_boxtype(_FL_ROUND_DOWN_BOX, FL_PLASTIC_ROUND_DOWN_BOX); | |||||
// Use standard size scrollbars... | |||||
Fl::scrollbar_size(16); | |||||
} else if (scheme_ && !strcasecmp(scheme_, "gtk+")) { | |||||
// Use a GTK+ inspired look-n-feel... | |||||
if (scheme_bg_) { | |||||
delete scheme_bg_; | |||||
scheme_bg_ = (Fl_Image *)0; | |||||
} | |||||
set_boxtype(FL_UP_FRAME, FL_GTK_UP_FRAME); | |||||
set_boxtype(FL_DOWN_FRAME, FL_GTK_DOWN_FRAME); | |||||
set_boxtype(FL_THIN_UP_FRAME, FL_GTK_THIN_UP_FRAME); | |||||
set_boxtype(FL_THIN_DOWN_FRAME, FL_GTK_THIN_DOWN_FRAME); | |||||
set_boxtype(FL_UP_BOX, FL_GTK_UP_BOX); | |||||
set_boxtype(FL_DOWN_BOX, FL_GTK_DOWN_BOX); | |||||
set_boxtype(FL_THIN_UP_BOX, FL_GTK_THIN_UP_BOX); | |||||
set_boxtype(FL_THIN_DOWN_BOX, FL_GTK_THIN_DOWN_BOX); | |||||
set_boxtype(_FL_ROUND_UP_BOX, FL_GTK_ROUND_UP_BOX); | |||||
set_boxtype(_FL_ROUND_DOWN_BOX, FL_GTK_ROUND_DOWN_BOX); | |||||
// Use slightly thinner scrollbars... | |||||
Fl::scrollbar_size(15); | |||||
} else { | |||||
// Use the standard FLTK look-n-feel... | // Use the standard FLTK look-n-feel... | ||||
if (scheme_bg_) { | if (scheme_bg_) { | ||||
delete scheme_bg_; | |||||
scheme_bg_ = (Fl_Image *)0; | |||||
delete scheme_bg_; | |||||
scheme_bg_ = (Fl_Image *)0; | |||||
} | } | ||||
set_boxtype(FL_UP_FRAME, fl_up_frame, D1, D1, D2, D2); | set_boxtype(FL_UP_FRAME, fl_up_frame, D1, D1, D2, D2); | ||||
set_boxtype(FL_DOWN_FRAME, fl_down_frame, D1, D1, D2, D2); | set_boxtype(FL_DOWN_FRAME, fl_down_frame, D1, D1, D2, D2); | ||||
set_boxtype(FL_THIN_UP_FRAME, fl_thin_up_frame, 1, 1, 2, 2); | set_boxtype(FL_THIN_UP_FRAME, fl_thin_up_frame, 1, 1, 2, 2); | ||||
set_boxtype(FL_THIN_DOWN_FRAME, fl_thin_down_frame, 1, 1, 2, 2); | set_boxtype(FL_THIN_DOWN_FRAME, fl_thin_down_frame, 1, 1, 2, 2); | ||||
set_boxtype(FL_UP_BOX, fl_up_box, D1, D1, D2, D2); | set_boxtype(FL_UP_BOX, fl_up_box, D1, D1, D2, D2); | ||||
set_boxtype(FL_DOWN_BOX, fl_down_box, D1, D1, D2, D2); | set_boxtype(FL_DOWN_BOX, fl_down_box, D1, D1, D2, D2); | ||||
set_boxtype(FL_THIN_UP_BOX, fl_thin_up_box, 1, 1, 2, 2); | set_boxtype(FL_THIN_UP_BOX, fl_thin_up_box, 1, 1, 2, 2); | ||||
set_boxtype(FL_THIN_DOWN_BOX, fl_thin_down_box, 1, 1, 2, 2); | set_boxtype(FL_THIN_DOWN_BOX, fl_thin_down_box, 1, 1, 2, 2); | ||||
set_boxtype(_FL_ROUND_UP_BOX, fl_round_up_box, 3, 3, 6, 6); | set_boxtype(_FL_ROUND_UP_BOX, fl_round_up_box, 3, 3, 6, 6); | ||||
set_boxtype(_FL_ROUND_DOWN_BOX, fl_round_down_box, 3, 3, 6, 6); | set_boxtype(_FL_ROUND_DOWN_BOX, fl_round_down_box, 3, 3, 6, 6); | ||||
// Use standard size scrollbars... | // Use standard size scrollbars... | ||||
Fl::scrollbar_size(16); | Fl::scrollbar_size(16); | ||||
} | |||||
// Set (or clear) the background tile for all windows... | |||||
for (win = first_window(); win; win = next_window(win)) { | |||||
win->labeltype(scheme_bg_ ? FL_NORMAL_LABEL : FL_NO_LABEL); | |||||
win->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); | |||||
win->image(scheme_bg_); | |||||
win->redraw(); | |||||
} | |||||
// Set (or clear) the background tile for all windows... | |||||
for (win = first_window(); win; win = next_window(win)) { | |||||
win->labeltype(scheme_bg_ ? FL_NORMAL_LABEL : FL_NO_LABEL); | |||||
win->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); | |||||
win->image(scheme_bg_); | |||||
win->redraw(); | |||||
} | |||||
return 1; | |||||
return 1; | |||||
} | } | ||||
@@ -145,13 +145,11 @@ CPPFILES = \ | |||||
fl_engraved_label.cxx \ | fl_engraved_label.cxx \ | ||||
fl_file_dir.cxx \ | fl_file_dir.cxx \ | ||||
fl_font.cxx \ | fl_font.cxx \ | ||||
fl_gtk.cxx \ | |||||
fl_labeltype.cxx \ | fl_labeltype.cxx \ | ||||
fl_line_style.cxx \ | fl_line_style.cxx \ | ||||
fl_open_uri.cxx \ | fl_open_uri.cxx \ | ||||
fl_oval_box.cxx \ | fl_oval_box.cxx \ | ||||
fl_overlay.cxx \ | fl_overlay.cxx \ | ||||
fl_plastic.cxx \ | |||||
fl_read_image.cxx \ | fl_read_image.cxx \ | ||||
fl_rect.cxx \ | fl_rect.cxx \ | ||||
fl_round_box.cxx \ | fl_round_box.cxx \ | ||||
@@ -284,24 +284,6 @@ static struct { | |||||
{fl_border_box, 1,1,2,2,0}, // _FL_OVAL_SHADOW_BOX, | {fl_border_box, 1,1,2,2,0}, // _FL_OVAL_SHADOW_BOX, | ||||
{fl_border_frame, 1,1,2,2,0}, // _FL_OVAL_FRAME | {fl_border_frame, 1,1,2,2,0}, // _FL_OVAL_FRAME | ||||
{fl_rectf, 0,0,0,0,0}, // _FL_OVAL_FLAT_BOX, | {fl_rectf, 0,0,0,0,0}, // _FL_OVAL_FLAT_BOX, | ||||
{fl_up_box, 4,4,8,8,0}, // _FL_PLASTIC_UP_BOX, | |||||
{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, 2,2,4,4,0}, // _FL_PLASTIC_ROUND_UP_BOX, | |||||
{fl_down_box, 2,2,4,4,0}, // _FL_PLASTIC_ROUND_DOWN_BOX, | |||||
{fl_up_box, 2,2,4,4,0}, // _FL_GTK_UP_BOX, | |||||
{fl_down_box, 2,2,4,4,0}, // _FL_GTK_DOWN_BOX, | |||||
{fl_up_frame, 2,2,4,4,0}, // _FL_GTK_UP_FRAME, | |||||
{fl_down_frame, 2,2,4,4,0}, // _FL_GTK_DOWN_FRAME, | |||||
{fl_up_frame, 1,1,2,2,0}, // _FL_GTK_THIN_UP_FRAME, | |||||
{fl_down_frame, 1,1,2,2,0}, // _FL_GTK_THIN_DOWN_FRAME, | |||||
{fl_up_box, 1,1,2,2,0}, // _FL_GTK_THIN_ROUND_UP_BOX, | |||||
{fl_down_box, 1,1,2,2,0}, // _FL_GTK_THIN_ROUND_DOWN_BOX, | |||||
{fl_up_box, 2,2,4,4,0}, // _FL_GTK_ROUND_UP_BOX, | |||||
{fl_down_box, 2,2,4,4,0}, // _FL_GTK_ROUND_DOWN_BOX, | |||||
{fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+0 | {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_down_box, 3,3,6,6,0}, // FL_FREE_BOX+1 | ||||
{fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+2 | {fl_up_box, 3,3,6,6,0}, // FL_FREE_BOX+2 | ||||
@@ -1,304 +0,0 @@ | |||||
// | |||||
// "$Id: fl_gtk.cxx 7903 2010-11-28 21:06:39Z matt $" | |||||
// | |||||
// "GTK" drawing routines for the Fast Light Tool Kit (FLTK). | |||||
// | |||||
// These box types provide a GTK+ look, based on Red Hat's Bluecurve | |||||
// theme... | |||||
// | |||||
// Copyright 2006-2010 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 on the following page: | |||||
// | |||||
// http://www.fltk.org/str.php | |||||
// | |||||
// Box drawing code for an obscure box type. | |||||
// These box types are in separate files so they are not linked | |||||
// in if not used. | |||||
#include <FL/Fl.H> | |||||
#include <FL/fl_draw.H> | |||||
extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*); | |||||
static void gtk_color(Fl_Color c) { | |||||
if (Fl::draw_box_active()) fl_color(c); | |||||
else fl_color(fl_inactive(c)); | |||||
} | |||||
static void gtk_up_frame(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.5)); | |||||
fl_xyline(x + 2, y + 1, x + w - 3); | |||||
fl_yxline(x + 1, y + 2, y + h - 3); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.5)); | |||||
fl_begin_loop(); | |||||
fl_vertex(x, y + 2); | |||||
fl_vertex(x + 2, y); | |||||
fl_vertex(x + w - 3, y); | |||||
fl_vertex(x + w - 1, y + 2); | |||||
fl_vertex(x + w - 1, y + h - 3); | |||||
fl_vertex(x + w - 3, y + h - 1); | |||||
fl_vertex(x + 2, y + h - 1); | |||||
fl_vertex(x, y + h - 3); | |||||
fl_end_loop(); | |||||
} | |||||
static void gtk_up_box(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_up_frame(x, y, w, h, c); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.4f)); | |||||
fl_xyline(x + 2, y + 2, x + w - 3); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.2f)); | |||||
fl_xyline(x + 2, y + 3, x + w - 3); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.1f)); | |||||
fl_xyline(x + 2, y + 4, x + w - 3); | |||||
gtk_color(c); | |||||
fl_rectf(x + 2, y + 5, w - 4, h - 7); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.025f)); | |||||
fl_xyline(x + 2, y + h - 4, x + w - 3); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.05f)); | |||||
fl_xyline(x + 2, y + h - 3, x + w - 3); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.1f)); | |||||
fl_xyline(x + 2, y + h - 2, x + w - 3); | |||||
fl_yxline(x + w - 2, y + 2, y + h - 3); | |||||
} | |||||
static void gtk_down_frame(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.5)); | |||||
fl_begin_loop(); | |||||
fl_vertex(x, y + 2); | |||||
fl_vertex(x + 2, y); | |||||
fl_vertex(x + w - 3, y); | |||||
fl_vertex(x + w - 1, y + 2); | |||||
fl_vertex(x + w - 1, y + h - 3); | |||||
fl_vertex(x + w - 3, y + h - 1); | |||||
fl_vertex(x + 2, y + h - 1); | |||||
fl_vertex(x, y + h - 3); | |||||
fl_end_loop(); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.1f)); | |||||
fl_xyline(x + 2, y + 1, x + w - 3); | |||||
fl_yxline(x + 1, y + 2, y + h - 3); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.05f)); | |||||
fl_yxline(x + 2, y + h - 2, y + 2, x + w - 2); | |||||
} | |||||
static void gtk_down_box(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_down_frame(x, y, w, h, c); | |||||
gtk_color(c); | |||||
fl_rectf(x + 3, y + 3, w - 5, h - 4); | |||||
fl_yxline(x + w - 2, y + 3, y + h - 3); | |||||
} | |||||
static void gtk_thin_up_frame(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.6f)); | |||||
fl_xyline(x + 1, y, x + w - 2); | |||||
fl_yxline(x, y + 1, y + h - 2); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.4f)); | |||||
fl_xyline(x + 1, y + h - 1, x + w - 2); | |||||
fl_yxline(x + w - 1, y + 1, y + h - 2); | |||||
} | |||||
static void gtk_thin_up_box(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_thin_up_frame(x, y, w, h, c); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.4f)); | |||||
fl_xyline(x + 1, y + 1, x + w - 2); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.2f)); | |||||
fl_xyline(x + 1, y + 2, x + w - 2); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.1f)); | |||||
fl_xyline(x + 1, y + 3, x + w - 2); | |||||
gtk_color(c); | |||||
fl_rectf(x + 1, y + 4, w - 2, h - 8); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.025f)); | |||||
fl_xyline(x + 1, y + h - 4, x + w - 2); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.05f)); | |||||
fl_xyline(x + 1, y + h - 3, x + w - 2); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.1f)); | |||||
fl_xyline(x + 1, y + h - 2, x + w - 2); | |||||
} | |||||
static void gtk_thin_down_frame(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.4f)); | |||||
fl_xyline(x + 1, y, x + w - 2); | |||||
fl_yxline(x, y + 1, y + h - 2); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.6f)); | |||||
fl_xyline(x + 1, y + h - 1, x + w - 2); | |||||
fl_yxline(x + w - 1, y + 1, y + h - 2); | |||||
} | |||||
static void gtk_thin_down_box(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_thin_down_frame(x, y, w, h, c); | |||||
gtk_color(c); | |||||
fl_rectf(x + 1, y + 1, w - 2, h - 2); | |||||
} | |||||
//------------------------ | |||||
// new GTK+ style for round buttons | |||||
#if 1 | |||||
static void fl_arc_i(int x,int y,int w,int h,double a1,double a2) { | |||||
fl_arc(x,y,w,h,a1,a2); | |||||
} | |||||
enum {UPPER_LEFT, LOWER_RIGHT, CLOSED, FILL}; | |||||
static void draw(int which, int x,int y,int w,int h, int inset) | |||||
{ | |||||
if (inset*2 >= w) inset = (w-1)/2; | |||||
if (inset*2 >= h) inset = (h-1)/2; | |||||
x += inset; | |||||
y += inset; | |||||
w -= 2*inset; | |||||
h -= 2*inset; | |||||
int d = w <= h ? w : h; | |||||
if (d <= 1) return; | |||||
void (*f)(int,int,int,int,double,double); | |||||
f = (which==FILL) ? fl_pie : fl_arc_i; | |||||
if (which >= CLOSED) { | |||||
f(x+w-d, y, d, d, w<=h ? 0 : -90, w<=h ? 180 : 90); | |||||
f(x, y+h-d, d, d, w<=h ? 180 : 90, w<=h ? 360 : 270); | |||||
} else if (which == UPPER_LEFT) { | |||||
f(x+w-d, y, d, d, 45, w<=h ? 180 : 90); | |||||
f(x, y+h-d, d, d, w<=h ? 180 : 90, 225); | |||||
} else { // LOWER_RIGHT | |||||
f(x, y+h-d, d, d, 225, w<=h ? 360 : 270); | |||||
f(x+w-d, y, d, d, w<=h ? 360 : 270, 360+45); | |||||
} | |||||
if (which == FILL) { | |||||
if (w < h) | |||||
fl_rectf(x, y+d/2, w, h-(d&-2)); | |||||
else if (w > h) | |||||
fl_rectf(x+d/2, y, w-(d&-2), h); | |||||
} else { | |||||
if (w < h) { | |||||
if (which != UPPER_LEFT) fl_yxline(x+w-1, y+d/2-1, y+h-d/2+1); | |||||
if (which != LOWER_RIGHT) fl_yxline(x, y+d/2-1, y+h-d/2+1); | |||||
} else if (w > h) { | |||||
if (which != UPPER_LEFT) fl_xyline(x+d/2-1, y+h-1, x+w-d/2+1); | |||||
if (which != LOWER_RIGHT) fl_xyline(x+d/2-1, y, x+w-d/2+1); | |||||
} | |||||
} | |||||
} | |||||
void gtk_round_up_box(int x, int y, int w, int h, Fl_Color c) { | |||||
fl_color(c); | |||||
draw(FILL, x, y, w, h, 2); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.025f)); | |||||
draw(LOWER_RIGHT, x+1, y, w-2, h, 2); | |||||
draw(LOWER_RIGHT, x, y, w, h, 3); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.05f)); | |||||
draw(LOWER_RIGHT, x+1, y, w-2, h, 1); | |||||
draw(LOWER_RIGHT, x, y, w, h, 2); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.1f)); | |||||
draw(LOWER_RIGHT, x+1, y, w-2, h, 0); | |||||
draw(LOWER_RIGHT, x, y, w, h, 1); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.1f)); | |||||
draw(UPPER_LEFT, x, y, w, h, 4); | |||||
draw(UPPER_LEFT, x+1, y, w-2, h, 3); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.2f)); | |||||
draw(UPPER_LEFT, x, y, w, h, 3); | |||||
draw(UPPER_LEFT, x+1, y, w-2, h, 2); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.4f)); | |||||
draw(UPPER_LEFT, x, y, w, h, 2); | |||||
draw(UPPER_LEFT, x+1, y, w-2, h, 1); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.5f)); | |||||
draw(UPPER_LEFT, x, y, w, h, 1); | |||||
draw(UPPER_LEFT, x+1, y, w-2, h, 0); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.5f)); | |||||
draw(CLOSED, x, y, w, h, 0); | |||||
} | |||||
void gtk_round_down_box(int x, int y, int w, int h, Fl_Color c) { | |||||
fl_color(c); | |||||
draw(FILL, x, y, w, h, 2); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.05f)); | |||||
draw(UPPER_LEFT, x, y, w, h, 2); | |||||
draw(UPPER_LEFT, x+1, y, w-2, h, 1); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.1f)); | |||||
draw(UPPER_LEFT, x, y, w, h, 1); | |||||
draw(UPPER_LEFT, x+1, y, w-2, h, 0); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.5f)); | |||||
draw(CLOSED, x, y, w, h, 0); | |||||
} | |||||
#else | |||||
static void gtk_round_up_box(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_color(c); | |||||
fl_pie(x, y, w, h, 0.0, 360.0); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.5f)); | |||||
fl_arc(x, y, w, h, 45.0, 180.0); | |||||
gtk_color(fl_color_average(FL_WHITE, c, 0.25f)); | |||||
fl_arc(x, y, w, h, 180.0, 405.0); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.5f)); | |||||
fl_arc(x, y, w, h, 225.0, 360.0); | |||||
} | |||||
static void gtk_round_down_box(int x, int y, int w, int h, Fl_Color c) { | |||||
gtk_color(c); | |||||
fl_pie(x, y, w, h, 0.0, 360.0); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.2)); | |||||
fl_arc(x + 1, y, w, h, 90.0, 210.0); | |||||
gtk_color(fl_color_average(FL_BLACK, c, 0.6)); | |||||
fl_arc(x, y, w, h, 0.0, 360.0); | |||||
} | |||||
#endif | |||||
Fl_Boxtype fl_define_FL_GTK_UP_BOX() { | |||||
fl_internal_boxtype(_FL_GTK_UP_BOX, gtk_up_box); | |||||
fl_internal_boxtype(_FL_GTK_DOWN_BOX, gtk_down_box); | |||||
fl_internal_boxtype(_FL_GTK_UP_FRAME, gtk_up_frame); | |||||
fl_internal_boxtype(_FL_GTK_DOWN_FRAME, gtk_down_frame); | |||||
fl_internal_boxtype(_FL_GTK_THIN_UP_BOX, gtk_thin_up_box); | |||||
fl_internal_boxtype(_FL_GTK_THIN_DOWN_BOX, gtk_thin_down_box); | |||||
fl_internal_boxtype(_FL_GTK_THIN_UP_FRAME, gtk_thin_up_frame); | |||||
fl_internal_boxtype(_FL_GTK_THIN_DOWN_FRAME, gtk_thin_down_frame); | |||||
fl_internal_boxtype(_FL_GTK_ROUND_UP_BOX, gtk_round_up_box); | |||||
fl_internal_boxtype(_FL_GTK_ROUND_DOWN_BOX, gtk_round_down_box); | |||||
return _FL_GTK_UP_BOX; | |||||
} | |||||
// | |||||
// End of "$Id: fl_gtk.cxx 7903 2010-11-28 21:06:39Z matt $". | |||||
// |
@@ -1,381 +0,0 @@ | |||||
// | |||||
// "$Id: fl_plastic.cxx 7903 2010-11-28 21:06:39Z matt $" | |||||
// | |||||
// "Plastic" drawing routines for the Fast Light Tool Kit (FLTK). | |||||
// | |||||
// These box types provide a cross between Aqua and KDE buttons; kindof | |||||
// like translucent plastic buttons... | |||||
// | |||||
// Copyright 2001-2010 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 on the following page: | |||||
// | |||||
// http://www.fltk.org/str.php | |||||
// | |||||
// Box drawing code for an obscure box type. | |||||
// These box types are in separate files so they are not linked | |||||
// in if not used. | |||||
#include <FL/Fl.H> | |||||
#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 | |||||
#define USE_OLD_PLASTIC_COLOR | |||||
extern uchar *fl_gray_ramp(); | |||||
inline Fl_Color shade_color(uchar gc, Fl_Color bc) { | |||||
#ifdef USE_OLD_PLASTIC_COLOR | |||||
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_COLOR | |||||
} | |||||
static void frame_rect(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 --) | |||||
{ | |||||
// Draw lines around the perimeter of the button, 4 colors per | |||||
// circuit. | |||||
fl_color(shade_color(g[(int)*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[(int)*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[(int)*c++], bc)); | |||||
fl_line(x + w - 1, y - b, x, y - b, x - b, y); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_line(x - b, y, x - b, y + h, x, y + h + b); | |||||
} | |||||
} | |||||
static void frame_round(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; | |||||
if (w==h) { | |||||
for (; b > 1; b --, x ++, y ++, w -= 2, h -= 2) | |||||
{ | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y, w, h, 45.0, 135.0); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y, w, h, 315.0, 405.0); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y, w, h, 225.0, 315.0); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y, w, h, 135.0, 225.0); | |||||
} | |||||
} else if (w>h) { | |||||
int d = h/2; | |||||
for (; b > 1; d--, b --, x ++, y ++, w -= 2, h -= 2) | |||||
{ | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y, h, h, 90.0, 135.0); | |||||
fl_xyline(x+d, y, x+w-d); | |||||
fl_arc(x+w-h, y, h, h, 45.0, 90.0); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x+w-h, y, h, h, 315.0, 405.0); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x+w-h, y, h, h, 270.0, 315.0); | |||||
fl_xyline(x+d, y+h-1, x+w-d); | |||||
fl_arc(x, y, h, h, 225.0, 270.0); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y, h, h, 135.0, 225.0); | |||||
} | |||||
} else if (w<h) { | |||||
int d = w/2; | |||||
for (; b > 1; d--, b --, x ++, y ++, w -= 2, h -= 2) | |||||
{ | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y, w, w, 45.0, 135.0); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y, w, w, 0.0, 45.0); | |||||
fl_yxline(x+w-1, y+d, y+h-d); | |||||
fl_arc(x, y+h-w, w, w, 315.0, 360.0); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y+h-w, w, w, 225.0, 315.0); | |||||
fl_color(shade_color(g[(int)*c++], bc)); | |||||
fl_arc(x, y+h-w, w, w, 180.0, 225.0); | |||||
fl_yxline(x, y+d, y+h-d); | |||||
fl_arc(x, y, w, w, 135.0, 180.0); | |||||
} | |||||
} | |||||
} | |||||
static void shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) { | |||||
uchar *g = fl_gray_ramp(); | |||||
int i, j; | |||||
int clen = strlen(c) - 1; | |||||
int chalf = clen / 2; | |||||
int cstep = 1; | |||||
if (h < (w * 2)) { | |||||
// Horizontal shading... | |||||
if (clen >= h) cstep = 2; | |||||
for (i = 0, j = 0; j < chalf; i ++, j += cstep) { | |||||
// Draw the top line and points... | |||||
fl_color(shade_color(g[(int)c[i]], bc)); | |||||
fl_xyline(x + 1, y + i, x + w - 2); | |||||
fl_color(shade_color(g[c[i] - 2], bc)); | |||||
fl_point(x, y + i + 1); | |||||
fl_point(x + w - 1, y + i + 1); | |||||
// Draw the bottom line and points... | |||||
fl_color(shade_color(g[(int)c[clen - i]], bc)); | |||||
fl_xyline(x + 1, y + h - i, x + w - 2); | |||||
fl_color(shade_color(g[c[clen - i] - 2], bc)); | |||||
fl_point(x, y + h - i); | |||||
fl_point(x + w - 1, y + h - i); | |||||
} | |||||
// Draw the interior and sides... | |||||
i = chalf / cstep; | |||||
fl_color(shade_color(g[(int)c[chalf]], bc)); | |||||
fl_rectf(x + 1, y + i, w - 2, h - 2 * i + 1); | |||||
fl_color(shade_color(g[c[chalf] - 2], bc)); | |||||
fl_yxline(x, y + i, y + h - i); | |||||
fl_yxline(x + w - 1, y + i, y + h - i); | |||||
} else { | |||||
// Vertical shading... | |||||
if (clen >= w) cstep = 2; | |||||
for (i = 0, j = 0; j < chalf; i ++, j += cstep) { | |||||
// Draw the left line and points... | |||||
fl_color(shade_color(g[(int)c[i]], bc)); | |||||
fl_yxline(x + i, y + 1, y + h - 1); | |||||
fl_color(shade_color(g[c[i] - 2], bc)); | |||||
fl_point(x + i + 1, y); | |||||
fl_point(x + i + 1, y + h); | |||||
// Draw the right line and points... | |||||
fl_color(shade_color(g[(int)c[clen - i]], bc)); | |||||
fl_yxline(x + w - 1 - i, y + 1, y + h - 1); | |||||
fl_color(shade_color(g[c[clen - i] - 2], bc)); | |||||
fl_point(x + w - 2 - i, y); | |||||
fl_point(x + w - 2 - i, y + h); | |||||
} | |||||
// Draw the interior, top, and bottom... | |||||
i = chalf / cstep; | |||||
fl_color(shade_color(g[(int)c[chalf]], bc)); | |||||
fl_rectf(x + i, y + 1, w - 2 * i, h - 1); | |||||
fl_color(shade_color(g[c[chalf] - 2], bc)); | |||||
fl_xyline(x + i, y, x + w - i); | |||||
fl_xyline(x + i, y + h, x + w - i); | |||||
} | |||||
} | |||||
static void shade_round(int x, int y, int w, int h, const char *c, Fl_Color bc) { | |||||
uchar *g = fl_gray_ramp(); | |||||
int i; | |||||
int clen = strlen(c) - 1; | |||||
int chalf = clen / 2; | |||||
if (w>h) { | |||||
int d = h/2; | |||||
const int na = 8; | |||||
for (i=0; i<chalf; i++, d--, x++, y++, w-=2, h-=2) | |||||
{ | |||||
fl_color(shade_color(g[(int)c[i]], bc)); | |||||
fl_pie(x, y, h, h, 90.0, 135.0+i*na); | |||||
fl_xyline(x+d, y, x+w-d); | |||||
fl_pie(x+w-h, y, h, h, 45.0+i*na, 90.0); | |||||
fl_color(shade_color(g[(int)c[i] - 2], bc)); | |||||
fl_pie(x+w-h, y, h, h, 315.0+i*na, 405.0+i*na); | |||||
fl_color(shade_color(g[(int)c[clen - i]], bc)); | |||||
fl_pie(x+w-h, y, h, h, 270.0, 315.0+i*na); | |||||
fl_xyline(x+d, y+h-1, x+w-d); | |||||
fl_pie(x, y, h, h, 225.0+i*na, 270.0); | |||||
fl_color(shade_color(g[c[(int)clen - i] - 2], bc)); | |||||
fl_pie(x, y, h, h, 135.0+i*na, 225.0+i*na); | |||||
} | |||||
fl_color(shade_color(g[(int)c[chalf]], bc)); | |||||
fl_rectf(x+d, y, w-h+1, h+1); | |||||
fl_pie(x, y, h, h, 90.0, 270.0); | |||||
fl_pie(x+w-h, y, h, h, 270.0, 90.0); | |||||
} else { | |||||
int d = w/2; | |||||
const int na = 8; | |||||
for (i=0; i<chalf; i++, d--, x++, y++, w-=2, h-=2) | |||||
{ | |||||
fl_color(shade_color(g[(int)c[i]], bc)); | |||||
fl_pie(x, y, w, w, 45.0+i*na, 135.0+i*na); | |||||
fl_color(shade_color(g[c[i] - 2], bc)); | |||||
fl_pie(x, y, w, w, 0.0, 45.0+i*na); | |||||
fl_yxline(x+w-1, y+d, y+h-d); | |||||
fl_pie(x, y+h-w, w, w, 315.0+i*na, 360.0); | |||||
fl_color(shade_color(g[(int)c[clen - i]], bc)); | |||||
fl_pie(x, y+h-w, w, w, 225.0+i*na, 315.0+i*na); | |||||
fl_color(shade_color(g[c[clen - i] - 2], bc)); | |||||
fl_pie(x, y+h-w, w, w, 180.0, 225.0+i*na); | |||||
fl_yxline(x, y+d, y+h-d); | |||||
fl_pie(x, y, w, w, 135.0+i*na, 180.0); | |||||
} | |||||
fl_color(shade_color(g[(int)c[chalf]], bc)); | |||||
fl_rectf(x, y+d, w+1, h-w+1); | |||||
fl_pie(x, y, w, w, 0.0, 180.0); | |||||
fl_pie(x, y+h-w, w, w, 180.0, 360.0); | |||||
} | |||||
} | |||||
static void up_frame(int x, int y, int w, int h, Fl_Color c) { | |||||
frame_rect(x, y, w, h - 1, "KLDIIJLM", c); | |||||
} | |||||
static void narrow_thin_box(int x, int y, int w, int h, Fl_Color c) { | |||||
if (h<=0 || w<=0) return; | |||||
uchar *g = fl_gray_ramp(); | |||||
fl_color(shade_color(g['R'], c)); | |||||
fl_rectf(x+1, y+1, w-2, h-2); | |||||
fl_color(shade_color(g['I'], c)); | |||||
if (w > 1) { | |||||
fl_xyline(x+1, y, x+w-2); | |||||
fl_xyline(x+1, y+h-1, x+w-2); | |||||
} | |||||
if (h > 1) { | |||||
fl_yxline(x, y+1, y+h-2); | |||||
fl_yxline(x+w-1, y+1, y+h-2); | |||||
} | |||||
} | |||||
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 | |||||
if (w > 4 && h > 4) { | |||||
shade_rect(x + 1, y + 1, w - 2, h - 3, "RQOQSUWQ", c); | |||||
frame_rect(x, y, w, h - 1, "IJLM", c); | |||||
} else { | |||||
narrow_thin_box(x, y, w, h, c); | |||||
} | |||||
#endif // USE_OLD_PLASTIC_BOX | |||||
} | |||||
static void 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 | |||||
if (w > 8 && h > 8) { | |||||
shade_rect(x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c); | |||||
frame_rect(x, y, w, h - 1, "IJLM", c); | |||||
} else { | |||||
thin_up_box(x, y, w, h, c); | |||||
} | |||||
#endif // USE_OLD_PLASTIC_BOX | |||||
} | |||||
static void up_round(int x, int y, int w, int h, Fl_Color c) { | |||||
shade_round(x, y, w, h, "RVQNOPQRSTUVWVQ", c); | |||||
frame_round(x, y, w, h, "IJLM", c); | |||||
} | |||||
static void down_frame(int x, int y, int w, int h, Fl_Color c) { | |||||
frame_rect(x, y, w, h - 1, "LLLLTTRR", c); | |||||
} | |||||
static void down_box(int x, int y, int w, int h, Fl_Color c) { | |||||
if (w > 6 && h > 6) { | |||||
shade_rect(x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c); | |||||
down_frame(x, y, w, h, c); | |||||
} | |||||
else { | |||||
narrow_thin_box(x, y, w, h, c); | |||||
} | |||||
} | |||||
static void down_round(int x, int y, int w, int h, Fl_Color c) { | |||||
shade_round(x, y, w, h, "STUVWWWVT", c); | |||||
frame_round(x, y, w, h, "IJLM", c); | |||||
} | |||||
extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*); | |||||
Fl_Boxtype fl_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); | |||||
fl_internal_boxtype(_FL_PLASTIC_THIN_UP_BOX, thin_up_box); | |||||
fl_internal_boxtype(_FL_PLASTIC_THIN_DOWN_BOX, down_box); | |||||
fl_internal_boxtype(_FL_PLASTIC_ROUND_UP_BOX, up_round); | |||||
fl_internal_boxtype(_FL_PLASTIC_ROUND_DOWN_BOX, down_round); | |||||
return _FL_PLASTIC_UP_BOX; | |||||
} | |||||
// | |||||
// End of "$Id: fl_plastic.cxx 7903 2010-11-28 21:06:39Z matt $". | |||||
// |