diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2016-02-01 23:06:14 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2016-02-01 23:06:14 +0000 |
| commit | 6e16d033aefffab71e2674143bbb722bf43df7c0 (patch) | |
| tree | cc99b67fde50b1ce2a76780168e42c573ec39d70 /src/drivers/GDI | |
| parent | 5af1344b80335a73f20d372b993eae188d8ecdec (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/drivers/GDI')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.h | 1 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.h b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h index 1e8ff72d7..06e040f1a 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.h +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h @@ -69,6 +69,7 @@ protected: // --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/gdi_rect.cxx void point(int x, int y); void rect(int x, int y, int w, int h); + void focus_rect(int x, int y, int w, int h); void rectf(int x, int y, int w, int h); void line(int x, int y, int x1, int y1); void line(int x, int y, int x1, int y1, int x2, int y2); diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx index 553d7c043..796896cdd 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx @@ -48,6 +48,17 @@ void Fl_GDI_Graphics_Driver::rect(int x, int y, int w, int h) { LineTo(fl_gc, x, y); } +void Fl_GDI_Graphics_Driver::focus_rect(int x, int y, int w, int h) { + // Windows 95/98/ME do not implement the dotted line style, so draw + // every other pixel around the focus area... + w--; h--; + int i=1, xx, yy; + for (xx = 0; xx < w; xx++, i++) if (i & 1) point(x + xx, y); + for (yy = 0; yy < h; yy++, i++) if (i & 1) point(x + w, y + yy); + for (xx = w; xx > 0; xx--, i++) if (i & 1) point(x + xx, y + h); + for (yy = h; yy > 0; yy--, i++) if (i & 1) point(x, y + yy); +} + void Fl_GDI_Graphics_Driver::rectf(int x, int y, int w, int h) { if (w<=0 || h<=0) return; RECT rect; |
