summaryrefslogtreecommitdiffstats
path: root/win/tkWinDraw.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2024-07-31 17:58:28 (GMT)
committerdgp <dgp@users.sourceforge.net>2024-07-31 17:58:28 (GMT)
commit849e8743a0a26f736f3179888535404b44c47181 (patch)
tree78f35d81fad7deefcd7684bad459d198778c0d66 /win/tkWinDraw.c
parent45d3973d64de534a885940f93f052d967a0d0b67 (diff)
parente626189b9df61e69de84156fc55368c0e0f35e8a (diff)
downloadtk-849e8743a0a26f736f3179888535404b44c47181.zip
tk-849e8743a0a26f736f3179888535404b44c47181.tar.gz
tk-849e8743a0a26f736f3179888535404b44c47181.tar.bz2
merge trunkcore-9-0-b3
Diffstat (limited to 'win/tkWinDraw.c')
-rw-r--r--win/tkWinDraw.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 1022be4..7f96164 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -1488,6 +1488,67 @@ Tk_DrawHighlightBorder(
/*
*----------------------------------------------------------------------
*
+ * TkWinDrawDottedRect --
+ *
+ * This function draws a dotted rectangle, used as focus ring of Ttk
+ * widgets and for rendering the active element of a listbox.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A dotted rectangle is drawn in the specified Drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWinDrawDottedRect(
+ Display *disp, /* Display containing the dotted rectangle. */
+ Drawable d, /* Where to draw the rectangle (typically a
+ * pixmap for double buffering). */
+ unsigned long pixel, /* color to use for drawing the rectangle. */
+ int x, int y, /* Coordinates of the top-left corner. */
+ int width, int height) /* Width & height, _including the border_. */
+{
+ TkWinDCState state;
+ HDC dc;
+ LOGBRUSH lb;
+ HPEN pen;
+ int widthMod2 = width % 2, heightMod2 = height % 2;
+ int x2 = x + width - 1, y2 = y + height - 1;
+
+ dc = TkWinGetDrawableDC(disp, d, &state);
+
+ lb.lbStyle = BS_SOLID;
+ lb.lbColor = (COLORREF)pixel;
+ lb.lbHatch = 0;
+
+ pen = ExtCreatePen(PS_COSMETIC | PS_ALTERNATE, 1, &lb, 0, NULL);
+ SelectObject(dc, pen);
+ SelectObject(dc, GetStockObject(NULL_BRUSH));
+
+ if (widthMod2 == 0 && heightMod2 == 0) {
+ MoveToEx(dc, x+1, y, NULL); LineTo(dc, x2, y); /* N */
+ MoveToEx(dc, x+2, y2, NULL); LineTo(dc, x2, y2+1); /* S */
+ MoveToEx(dc, x, y+2, NULL); LineTo(dc, x, y2+1); /* W */
+ MoveToEx(dc, x2, y+1, NULL); LineTo(dc, x2, y2); /* E */
+ } else {
+ int dx = widthMod2, dy = heightMod2;
+
+ MoveToEx(dc, x+1, y, NULL); LineTo(dc, x2+dx, y); /* N */
+ MoveToEx(dc, x+1, y2, NULL); LineTo(dc, x2+dx, y2); /* S */
+ MoveToEx(dc, x, y+1, NULL); LineTo(dc, x, y2+dy); /* W */
+ MoveToEx(dc, x2, y+1, NULL); LineTo(dc, x2, y2+dy); /* E */
+ }
+
+ DeleteObject(pen);
+ TkWinReleaseDrawableDC(d, dc, &state);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpDrawFrameEx --
*
* This function draws the rectangular frame area.