Fixed inactive drawing code...

git-svn-id: file:///fltk/svn/fltk/trunk@121 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 1998-12-02 18:43:28 +00:00
parent e4c69fd44a
commit 9c208650bf
4 changed files with 67 additions and 54 deletions

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Adjuster.cxx,v 1.3 1998/10/21 14:19:54 mike Exp $"
// "$Id: Fl_Adjuster.cxx,v 1.4 1998/12/02 18:43:26 mike Exp $"
//
// Adjuster widget for the Fast Light Tool Kit (FLTK).
//
@ -51,7 +51,10 @@ void Fl_Adjuster::draw() {
draw_box(drag==1?FL_DOWN_BOX:box(), x(), y()+2*dy, W, H, color());
draw_box(drag==2?FL_DOWN_BOX:box(), x()+dx, y()+dy, W, H, color());
draw_box(drag==3?FL_DOWN_BOX:box(), x()+2*dx, y(), W, H, color());
fl_color(selection_color());
if (active_r())
fl_color(selection_color());
else
fl_color(inactive(selection_color()));
fastarrow.draw(x()+(W-fastarrow_width)/2,
y()+2*dy+(H-fastarrow_height)/2, W, H);
mediumarrow.draw(x()+dx+(W-mediumarrow_width)/2,
@ -127,5 +130,5 @@ Fl_Adjuster::Fl_Adjuster(int x, int y, int w, int h, const char* l)
}
//
// End of "$Id: Fl_Adjuster.cxx,v 1.3 1998/10/21 14:19:54 mike Exp $".
// End of "$Id: Fl_Adjuster.cxx,v 1.4 1998/12/02 18:43:26 mike Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Counter.cxx,v 1.5 1998/12/02 15:39:30 mike Exp $"
// "$Id: Fl_Counter.cxx,v 1.6 1998/12/02 18:43:27 mike Exp $"
//
// Counter widget for the Fast Light Tool Kit (FLTK).
//
@ -29,6 +29,7 @@
void Fl_Counter::draw() {
int i; Fl_Boxtype boxtype[5];
Fl_Color selcolor;
boxtype[0] = box();
if (boxtype[0] == FL_UP_BOX) boxtype[0] = FL_DOWN_BOX;
@ -60,17 +61,22 @@ void Fl_Counter::draw() {
fl_draw(str, xx[0], y(), ww[0], h(), FL_ALIGN_CENTER);
if (!(damage()&FL_DAMAGE_ALL)) return; // only need to redraw text
if (active_r())
selcolor = selection_color();
else
selcolor = inactive(selection_color());
if (type() == FL_NORMAL_COUNTER) {
draw_box(boxtype[1], xx[1], y(), ww[1], h(), color());
fl_draw_symbol("@-4<<", xx[1], y(), ww[1], h(), selection_color());
fl_draw_symbol("@-4<<", xx[1], y(), ww[1], h(), selcolor);
}
draw_box(boxtype[2], xx[2], y(), ww[2], h(), color());
fl_draw_symbol("@-4<", xx[2], y(), ww[2], h(), selection_color());
fl_draw_symbol("@-4<", xx[2], y(), ww[2], h(), selcolor);
draw_box(boxtype[3], xx[3], y(), ww[3], h(), color());
fl_draw_symbol("@-4>", xx[3], y(), ww[3], h(), selection_color());
fl_draw_symbol("@-4>", xx[3], y(), ww[3], h(), selcolor);
if (type() == FL_NORMAL_COUNTER) {
draw_box(boxtype[4], xx[4], y(), ww[4], h(), color());
fl_draw_symbol("@-4>>", xx[4], y(), ww[4], h(), selection_color());
fl_draw_symbol("@-4>>", xx[4], y(), ww[4], h(), selcolor);
}
}
@ -159,5 +165,5 @@ Fl_Counter::Fl_Counter(int x, int y, int w, int h, const char* l)
}
//
// End of "$Id: Fl_Counter.cxx,v 1.5 1998/12/02 15:39:30 mike Exp $".
// End of "$Id: Fl_Counter.cxx,v 1.6 1998/12/02 18:43:27 mike Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Roller.cxx,v 1.4 1998/10/21 14:20:19 mike Exp $"
// "$Id: Fl_Roller.cxx,v 1.5 1998/12/02 18:43:27 mike Exp $"
//
// Roller widget for the Fast Light Tool Kit (FLTK).
//
@ -69,27 +69,29 @@ void Fl_Roller::draw() {
fl_rectf(X+W-h1,Y,h1-h2,H);
h1 = h2;
}
// draw ridges:
double junk;
for (double y = -ARC+modf(offset*sin(ARC)/(W/2)/delta,&junk)*delta;;
y += delta) {
int y1 = int((sin(y)/sin(ARC)+1)*W/2);
if (y1 <= 0) continue; else if (y1 >= W-1) break;
fl_color(FL_DARK3); fl_yxline(X+y1,Y+1,Y+H-1);
if (y < 0) y1--; else y1++;
fl_color(FL_LIGHT1);fl_yxline(X+y1,Y+1,Y+H-1);
if (active_r()) {
// draw ridges:
double junk;
for (double y = -ARC+modf(offset*sin(ARC)/(W/2)/delta,&junk)*delta;;
y += delta) {
int y1 = int((sin(y)/sin(ARC)+1)*W/2);
if (y1 <= 0) continue; else if (y1 >= W-1) break;
fl_color(FL_DARK3); fl_yxline(X+y1,Y+1,Y+H-1);
if (y < 0) y1--; else y1++;
fl_color(FL_LIGHT1);fl_yxline(X+y1,Y+1,Y+H-1);
}
// draw edges:
h1 = W/8+1; // distance from end the color inverts
fl_color(FL_DARK2);
fl_xyline(X+h1,Y+H-1,X+W-h1);
fl_color(FL_DARK3);
fl_yxline(X,Y+H,Y,X+h1);
fl_xyline(X+W-h1,Y,X+W);
fl_color(FL_LIGHT2);
fl_xyline(X+h1,Y-1,X+W-h1);
fl_yxline(X+W,Y,Y+H,X+W-h1);
fl_xyline(X+h1,Y+H,X);
}
// draw edges:
h1 = W/8+1; // distance from end the color inverts
fl_color(FL_DARK2);
fl_xyline(X+h1,Y+H-1,X+W-h1);
fl_color(FL_DARK3);
fl_yxline(X,Y+H,Y,X+h1);
fl_xyline(X+W-h1,Y,X+W);
fl_color(FL_LIGHT2);
fl_xyline(X+h1,Y-1,X+W-h1);
fl_yxline(X+W,Y,Y+H,X+W-h1);
fl_xyline(X+h1,Y+H,X);
} else { // vertical one
// draw shaded ends of wheel:
int h1 = H/4+1; // distance from end that shading starts
@ -101,27 +103,29 @@ void Fl_Roller::draw() {
fl_rectf(X,Y+H-h1,W,h1-h2);
h1 = h2;
}
// draw ridges:
double junk;
for (double y = -ARC+modf(offset*sin(ARC)/(H/2)/delta,&junk)*delta;
; y += delta) {
int y1 = int((sin(y)/sin(ARC)+1)*H/2);
if (y1 <= 0) continue; else if (y1 >= H-1) break;
fl_color(FL_DARK3); fl_xyline(X+1,Y+y1,X+W-1);
if (y < 0) y1--; else y1++;
fl_color(FL_LIGHT1);fl_xyline(X+1,Y+y1,X+W-1);
if (active_r()) {
// draw ridges:
double junk;
for (double y = -ARC+modf(offset*sin(ARC)/(H/2)/delta,&junk)*delta;
; y += delta) {
int y1 = int((sin(y)/sin(ARC)+1)*H/2);
if (y1 <= 0) continue; else if (y1 >= H-1) break;
fl_color(FL_DARK3); fl_xyline(X+1,Y+y1,X+W-1);
if (y < 0) y1--; else y1++;
fl_color(FL_LIGHT1);fl_xyline(X+1,Y+y1,X+W-1);
}
// draw edges:
h1 = H/8+1; // distance from end the color inverts
fl_color(FL_DARK2);
fl_yxline(X+W-1,Y+h1,Y+H-h1);
fl_color(FL_DARK3);
fl_xyline(X+W,Y,X,Y+h1);
fl_yxline(X,Y+H-h1,Y+H);
fl_color(FL_LIGHT2);
fl_yxline(X,Y+h1,Y+H-h1);
fl_xyline(X,Y+H,X+W,Y+H-h1);
fl_yxline(X+W,Y+h1,Y);
}
// draw edges:
h1 = H/8+1; // distance from end the color inverts
fl_color(FL_DARK2);
fl_yxline(X+W-1,Y+h1,Y+H-h1);
fl_color(FL_DARK3);
fl_xyline(X+W,Y,X,Y+h1);
fl_yxline(X,Y+H-h1,Y+H);
fl_color(FL_LIGHT2);
fl_yxline(X,Y+h1,Y+H-h1);
fl_xyline(X,Y+H,X+W,Y+H-h1);
fl_yxline(X+W,Y+h1,Y);
}
}
@ -132,5 +136,5 @@ Fl_Roller::Fl_Roller(int X,int Y,int W,int H,const char* L)
}
//
// End of "$Id: Fl_Roller.cxx,v 1.4 1998/10/21 14:20:19 mike Exp $".
// End of "$Id: Fl_Roller.cxx,v 1.5 1998/12/02 18:43:27 mike Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Scrollbar.cxx,v 1.5 1998/10/21 17:53:13 mike Exp $"
// "$Id: Fl_Scrollbar.cxx,v 1.6 1998/12/02 18:43:28 mike Exp $"
//
// Scroll bar widget for the Fast Light Tool Kit (FLTK).
//
@ -143,7 +143,7 @@ void Fl_Scrollbar::draw() {
if (active_r())
fl_color(labelcolor());
else
fl_color(labelcolor() | 8);
fl_color(inactive(labelcolor()));
int w1 = (h()-1)|1; // use odd sizes only
int Y = y()+w1/2;
int W = w1/3;
@ -187,5 +187,5 @@ Fl_Scrollbar::Fl_Scrollbar(int X, int Y, int W, int H, const char* L)
}
//
// End of "$Id: Fl_Scrollbar.cxx,v 1.5 1998/10/21 17:53:13 mike Exp $".
// End of "$Id: Fl_Scrollbar.cxx,v 1.6 1998/12/02 18:43:28 mike Exp $".
//