From a93a8031f17f258f7b4b6b569c26aed6e3d14649 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <michael.r.sweet@gmail.com>
Date: Fri, 7 Dec 2001 16:28:38 +0000
Subject: [PATCH] Line style and focus boxes.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1821 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
---
 src/Fl_Widget.cxx     | 10 +++++++---
 src/fl_line_style.cxx | 19 +++++++++++++++----
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx
index 7a3b4a3ef..717f75e84 100644
--- a/src/Fl_Widget.cxx
+++ b/src/Fl_Widget.cxx
@@ -1,5 +1,5 @@
 //
-// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.8 2001/11/28 20:43:44 easysw Exp $"
+// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.9 2001/12/07 16:28:38 easysw Exp $"
 //
 // Base widget class for the Fast Light Tool Kit (FLTK).
 //
@@ -147,9 +147,13 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
 
   fl_color(fl_contrast(FL_BLACK, color()));
 
-#ifdef WIN32
+#if defined(WIN32) || defined(__APPLE__)
   // 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 horizontal lines
+  // on odd-numbered rows...
   int i, xx, yy;
 
   X += Fl::box_dx(B);
@@ -244,5 +248,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const {
 }
 
 //
-// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.8 2001/11/28 20:43:44 easysw Exp $".
+// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.9 2001/12/07 16:28:38 easysw Exp $".
 //
diff --git a/src/fl_line_style.cxx b/src/fl_line_style.cxx
index 05901b29d..043aaa8e7 100644
--- a/src/fl_line_style.cxx
+++ b/src/fl_line_style.cxx
@@ -1,5 +1,5 @@
 //
-// "$Id: fl_line_style.cxx,v 1.3.2.3.2.6 2001/11/27 17:44:08 easysw Exp $"
+// "$Id: fl_line_style.cxx,v 1.3.2.3.2.7 2001/12/07 16:28:38 easysw Exp $"
 //
 // Line style code for the Fast Light Tool Kit (FLTK).
 //
@@ -55,8 +55,19 @@ void fl_line_style(int style, int width, char* dashes) {
   DeleteObject(oldpen);
   fl_current_xmap->pen = newpen;
 #elif defined(__APPLE__)
-  //++
-  // Use PenPat, PenSize
+  // QuickDraw supports pen size and pattern, but no arbitrary line styles.
+  static Pattern	styles[] = {
+    { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } },	// FL_SOLID
+    { { 0xcc, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0x00, 0x00 } },	// FL_DASH
+    { { 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00 } }	// FL_DOT
+  };
+
+  if (!width) width = 1;
+  PenSize(width, width);
+
+  style &= 0xff;
+  if (style > 2) style = 2;
+  PenPat(styles + style);
 #else
   int ndashes = dashes ? strlen(dashes) : 0;
   // emulate the WIN32 dash patterns on X
@@ -93,5 +104,5 @@ void fl_line_style(int style, int width, char* dashes) {
 
 
 //
-// End of "$Id: fl_line_style.cxx,v 1.3.2.3.2.6 2001/11/27 17:44:08 easysw Exp $".
+// End of "$Id: fl_line_style.cxx,v 1.3.2.3.2.7 2001/12/07 16:28:38 easysw Exp $".
 //
-- 
GitLab