summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2006-10-03 02:35:12 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2006-10-03 02:35:12 +0000
commit7febae3f9e6f340f775eac5bee3e783fdd361aaa (patch)
tree52e2b15a231fefb78c189971b7fae602cdd2ce59 /src
parentad4a4ea0db2df3aa6befe601f48ec3f80434fe95 (diff)
Add GTK thin up/down box/frame types.
Update the GTK round up/down box types. Update radio/check box drawing for gtk+ scheme. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5505 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Light_Button.cxx22
-rw-r--r--src/Fl_get_system_colors.cxx8
-rw-r--r--src/fl_boxtype.cxx4
-rw-r--r--src/fl_gtk.cxx74
-rw-r--r--src/fl_set_fonts_xft.cxx2
5 files changed, 99 insertions, 11 deletions
diff --git a/src/Fl_Light_Button.cxx b/src/Fl_Light_Button.cxx
index 14943419f..1fc5e0636 100644
--- a/src/Fl_Light_Button.cxx
+++ b/src/Fl_Light_Button.cxx
@@ -3,7 +3,7 @@
//
// Lighted button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2006 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -59,7 +59,11 @@ void Fl_Light_Button::draw() {
// Check box...
draw_box(down_box(), x()+dx, y()+dy, W, W, FL_BACKGROUND2_COLOR);
if (value()) {
- fl_color(col);
+ if (Fl::scheme() && !strcmp(Fl::scheme(), "gtk+")) {
+ fl_color(FL_SELECTION_COLOR);
+ } else {
+ fl_color(col);
+ }
int tx = x() + dx + 3;
int tw = W - 6;
int d1 = tw/3;
@@ -76,12 +80,19 @@ void Fl_Light_Button::draw() {
// Radio button...
draw_box(down_box(), x()+dx, y()+dy, W, W, FL_BACKGROUND2_COLOR);
if (value()) {
- fl_color(col);
int tW = (W - Fl::box_dw(down_box())) / 2 + 1;
if ((W - tW) & 1) tW++; // Make sure difference is even to center
int tdx = dx + (W - tW) / 2;
int tdy = dy + (W - tW) / 2;
+ if (Fl::scheme() && !strcmp(Fl::scheme(), "gtk+")) {
+ fl_color(FL_SELECTION_COLOR);
+ tW --;
+ fl_pie(x() + tdx - 1, y() + tdy - 1, tW + 3, tW + 3, 0.0, 360.0);
+ fl_arc(x() + tdx - 1, y() + tdy - 1, tW + 3, tW + 3, 0.0, 360.0);
+ fl_color(fl_color_average(FL_WHITE, FL_SELECTION_COLOR, 0.2));
+ } else fl_color(col);
+
switch (tW) {
// Larger circles draw fine...
default :
@@ -107,6 +118,11 @@ void Fl_Light_Button::draw() {
fl_rectf(x() + tdx, y() + tdy, tW, tW);
break;
}
+
+ if (Fl::scheme() && !strcmp(Fl::scheme(), "gtk+")) {
+ fl_color(fl_color_average(FL_WHITE, FL_SELECTION_COLOR, 0.5));
+ fl_arc(x() + tdx, y() + tdy, tW + 1, tW + 1, 60.0, 180.0);
+ } else fl_color(col);
}
break;
default :
diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx
index bce9e2cbe..1f1f90fb0 100644
--- a/src/Fl_get_system_colors.cxx
+++ b/src/Fl_get_system_colors.cxx
@@ -331,13 +331,13 @@ int Fl::reload_scheme() {
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_UP_FRAME);
- set_boxtype(FL_THIN_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_UP_BOX);
- set_boxtype(FL_THIN_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);
} else {
diff --git a/src/fl_boxtype.cxx b/src/fl_boxtype.cxx
index 5e8f5e45c..e8099efab 100644
--- a/src/fl_boxtype.cxx
+++ b/src/fl_boxtype.cxx
@@ -243,6 +243,10 @@ static struct {
{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
diff --git a/src/fl_gtk.cxx b/src/fl_gtk.cxx
index fc6ca6160..9925dac97 100644
--- a/src/fl_gtk.cxx
+++ b/src/fl_gtk.cxx
@@ -115,10 +115,74 @@ static void gtk_down_box(int x, int y, int w, int h, Fl_Color c) {
}
-static void gtk_round_box(int x, int y, int w, int h, Fl_Color c) {
+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.5));
+ 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.5));
+ 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.4));
+ fl_xyline(x + 1, y + 1, x + w - 2);
+ gtk_color(fl_color_average(FL_WHITE, c, 0.2));
+ fl_xyline(x + 1, y + 2, x + w - 2);
+ gtk_color(fl_color_average(FL_WHITE, c, 0.1));
+ 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.025));
+ fl_xyline(x + 1, y + h - 4, x + w - 2);
+ gtk_color(fl_color_average(FL_BLACK, c, 0.05));
+ fl_xyline(x + 1, y + h - 3, x + w - 2);
+ gtk_color(fl_color_average(FL_BLACK, c, 0.1));
+ 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.5));
+ 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.5));
+ 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);
+}
+
+
+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.5));
+ fl_arc(x, y, w, h, 45.0, 180.0);
+ gtk_color(fl_color_average(FL_WHITE, c, 0.25));
+ fl_arc(x, y, w, h, 180.0, 405.0);
gtk_color(fl_color_average(FL_BLACK, c, 0.5));
+ 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);
}
@@ -128,8 +192,12 @@ Fl_Boxtype fl_define_FL_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_ROUND_UP_BOX, gtk_round_box);
- fl_internal_boxtype(_FL_GTK_ROUND_DOWN_BOX, gtk_round_box);
+ 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;
}
diff --git a/src/fl_set_fonts_xft.cxx b/src/fl_set_fonts_xft.cxx
index e95412e8d..b12ab2dee 100644
--- a/src/fl_set_fonts_xft.cxx
+++ b/src/fl_set_fonts_xft.cxx
@@ -3,7 +3,7 @@
//
// More font utilities for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2006 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public