Update the radio button circle drawing code to take the boxtype borders

into account.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1852 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-12-16 13:05:39 +00:00
parent 10df511f73
commit fc008c96c3
2 changed files with 21 additions and 8 deletions

View File

@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.0b8
- Tweeked the radio button drawing code for better
circles with different boxtypes.
- The Fl_File_Chooser widget did not provide a shown()
method, and fl_file_chooser() and fl_dir_chooser() did
not wait on shown(); this would cause them to return

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.7 2001/11/28 21:37:35 easysw Exp $"
// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.8 2001/12/16 13:05:39 easysw Exp $"
//
// Lighted button widget for the Fast Light Tool Kit (FLTK).
//
@ -38,8 +38,17 @@ void Fl_Light_Button::draw() {
if (box()) draw_box(this==Fl::pushed() ? down(box()) : box(), color());
Fl_Color col = value() ? (active_r() ? selection_color() :
fl_inactive(selection_color())) : color();
int W = labelsize() - 1;
int d = ((w()<h()?w():h()) - W) / 2;
int W;
int d;
if (w() < h()) {
d = (w() - labelsize() + 1) / 2;
W = w() - 2 * d;
} else {
d = (h() - labelsize() + 1) / 2;
W = h() - 2 * d;
}
if (down_box()) {
// draw other down_box() styles:
switch (down_box()) {
@ -64,12 +73,14 @@ void Fl_Light_Button::draw() {
draw_box(down_box(), x()+d, y()+d+1, W, W, FL_WHITE);
if (value()) {
fl_color(col);
if (W > 12) {
fl_pie(x() + d + 4, y() + d + 5, W - 8, W - 8, 0.0, 360.0);
W -= Fl::box_dw(down_box()) + 3;
d += Fl::box_dx(down_box()) + 1;
if (W > 4) {
fl_pie(x() + d, y() + d, W, W + 1, 0.0, 360.0);
} else {
// Small circles don't draw well with some X servers...
fl_rectf(x() + d + 5, y() + d + 5, 2, 4);
fl_rectf(x() + d + 4, y() + d + 6, 4, 2);
fl_rectf(x() + d + 1, y() + d, 2, 4);
fl_rectf(x() + d, y() + d + 1, 4, 2);
}
}
break;
@ -107,5 +118,5 @@ Fl_Light_Button::Fl_Light_Button(int x, int y, int w, int h, const char* l)
}
//
// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.7 2001/11/28 21:37:35 easysw Exp $".
// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.8 2001/12/16 13:05:39 easysw Exp $".
//