summaryrefslogtreecommitdiff
path: root/src/fl_plastic.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-11-07 08:09:23 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-11-07 08:09:23 +0000
commit1fe85a8c181587a6f6f88fab08c7f9a316d4759d (patch)
tree47f11cb1c74455aee98819a47319562988eeb49e /src/fl_plastic.cxx
parent595879b3006f958929c896403b9934d40430f52d (diff)
STR #1063: Applied Allesandro's plastic box patch. Looking great.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4642 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_plastic.cxx')
-rw-r--r--src/fl_plastic.cxx42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/fl_plastic.cxx b/src/fl_plastic.cxx
index 5c2dd99a8..c3f5f1d34 100644
--- a/src/fl_plastic.cxx
+++ b/src/fl_plastic.cxx
@@ -283,25 +283,50 @@ static void up_frame(int x, int y, int w, int h, Fl_Color c) {
frame_rect(x, y, w, h - 1, "KLDIIJLM", c);
}
+void thin_up_box(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) {
#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, "RVQNOPQRSTUVWVQ", c);
- frame_rect(x, y, w, h - 1, "IJLM", c);
+ 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 narrow_thin_box(int x, int y, int w, int h, Fl_Color c) {
+ 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
- shade_rect(x + 1, y + 1, w - 2, h - 3, "RQOQSUWQ", c);
- frame_rect(x, y, w, h - 1, "IJLM", c);
+ 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
}
@@ -318,8 +343,13 @@ static void down_frame(int x, int y, int w, int h, Fl_Color c) {
static void down_box(int x, int y, int w, int h, Fl_Color c) {
- shade_rect(x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c);
- down_frame(x, y, w, h, 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);
+ }
}