summaryrefslogtreecommitdiff
path: root/src/Fl_Widget.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2016-02-01 23:06:14 +0000
committerMatthias Melcher <fltk@matthiasm.com>2016-02-01 23:06:14 +0000
commit6e16d033aefffab71e2674143bbb722bf43df7c0 (patch)
treecc99b67fde50b1ce2a76780168e42c573ec39d70 /src/Fl_Widget.cxx
parent5af1344b80335a73f20d372b993eae188d8ecdec (diff)
Add fl_focus_rect function to driver.
Focus rectangles are dotted lines. The default implementation uses the dotted line style, However, for systems without line stye, we draw many dots instead. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11110 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Widget.cxx')
-rw-r--r--src/Fl_Widget.cxx34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx
index c8db04ab8..717f8efb9 100644
--- a/src/Fl_Widget.cxx
+++ b/src/Fl_Widget.cxx
@@ -206,37 +206,13 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
default:
break;
}
-
- fl_color(fl_contrast(FL_BLACK, color()));
-
-#if defined(USE_X11) || defined(__APPLE_QUARTZ__)
- fl_line_style(FL_DOT);
- fl_rect(X + Fl::box_dx(B), Y + Fl::box_dy(B),
- W - Fl::box_dw(B) - 1, H - Fl::box_dh(B) - 1);
- fl_line_style(FL_SOLID);
-#elif defined(WIN32)
- // Windows 95/98/ME do not implement the dotted line style, so draw
- // every other pixel around the focus area...
- //
- // Also, QuickDraw (MacOS) does not support line styles specifically,
- // and the hack we use in fl_line_style() will not draw horizontal lines
- // on odd-numbered rows...
- int i, xx, yy;
-
X += Fl::box_dx(B);
Y += Fl::box_dy(B);
- W -= Fl::box_dw(B) + 2;
- H -= Fl::box_dh(B) + 2;
-
- for (xx = 0, i = 1; xx < W; xx ++, i ++) if (i & 1) fl_point(X + xx, Y);
- for (yy = 0; yy < H; yy ++, i ++) if (i & 1) fl_point(X + W, Y + yy);
- for (xx = W; xx > 0; xx --, i ++) if (i & 1) fl_point(X + xx, Y + H);
- for (yy = H; yy > 0; yy --, i ++) if (i & 1) fl_point(X, Y + yy);
-#elif defined(FL_PORTING)
-# pragma message "handle focus drawing"
-#else
-# error unsupported platform
-#endif // WIN32
+ W -= Fl::box_dw(B)+1;
+ H -= Fl::box_dh(B)+1;
+
+ fl_color(fl_contrast(FL_BLACK, color()));
+ fl_focus_rect(X, Y, W, H);
}