diff options
author | csaba <csaba> | 2024-07-31 15:08:04 (GMT) |
---|---|---|
committer | csaba <csaba> | 2024-07-31 15:08:04 (GMT) |
commit | e626189b9df61e69de84156fc55368c0e0f35e8a (patch) | |
tree | 78f35d81fad7deefcd7684bad459d198778c0d66 /win | |
parent | cdcc6a05ddb15fb2573299a6f72d2a15c9db4c91 (diff) | |
parent | fc10c5cff8d30c989ff8235ce43d222e1c6ab962 (diff) | |
download | tk-e626189b9df61e69de84156fc55368c0e0f35e8a.zip tk-e626189b9df61e69de84156fc55368c0e0f35e8a.tar.gz tk-e626189b9df61e69de84156fc55368c0e0f35e8a.tar.bz2 |
Merged core-8-branch into trunk.
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinDraw.c | 61 | ||||
-rw-r--r-- | win/tkWinInt.h | 34 |
2 files changed, 79 insertions, 16 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. diff --git a/win/tkWinInt.h b/win/tkWinInt.h index 03cd825..3f363cd 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -194,48 +194,50 @@ MODULE_SCOPE void TkWinSetupSystemFonts(TkMainInfo *mainPtr); * The following is implemented in tkWinWm and used by tkWinEmbed.c */ -MODULE_SCOPE void TkpWinToplevelWithDraw(TkWindow *winPtr); -MODULE_SCOPE void TkpWinToplevelIconify(TkWindow *winPtr); -MODULE_SCOPE void TkpWinToplevelDeiconify(TkWindow *winPtr); -MODULE_SCOPE long TkpWinToplevelIsControlledByWm(TkWindow *winPtr); -MODULE_SCOPE long TkpWinToplevelMove(TkWindow *winPtr, int x, int y); -MODULE_SCOPE long TkpWinToplevelOverrideRedirect(TkWindow *winPtr, +MODULE_SCOPE void TkpWinToplevelWithDraw(TkWindow *winPtr); +MODULE_SCOPE void TkpWinToplevelIconify(TkWindow *winPtr); +MODULE_SCOPE void TkpWinToplevelDeiconify(TkWindow *winPtr); +MODULE_SCOPE long TkpWinToplevelIsControlledByWm(TkWindow *winPtr); +MODULE_SCOPE long TkpWinToplevelMove(TkWindow *winPtr, int x, int y); +MODULE_SCOPE long TkpWinToplevelOverrideRedirect(TkWindow *winPtr, int reqValue); -MODULE_SCOPE void TkpWinToplevelDetachWindow(TkWindow *winPtr); -MODULE_SCOPE int TkpWmGetState(TkWindow *winPtr); +MODULE_SCOPE void TkpWinToplevelDetachWindow(TkWindow *winPtr); +MODULE_SCOPE int TkpWmGetState(TkWindow *winPtr); -MODULE_SCOPE int TkTranslateWinEvent(HWND hwnd, UINT message, +MODULE_SCOPE int TkTranslateWinEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); -MODULE_SCOPE void TkWinPointerEvent(HWND hwnd, int x, int y); +MODULE_SCOPE void TkWinPointerEvent(HWND hwnd, int x, int y); /* * The following is implemented in tkWinPointer.c and also used in tkWinWindow.c */ -MODULE_SCOPE void TkSetCursorPos(int x, int y); +MODULE_SCOPE void TkSetCursorPos(int x, int y); /* * The following is implemented in tkWinSysTray.c */ -MODULE_SCOPE int WinIcoInit (Tcl_Interp* interp); +MODULE_SCOPE int WinIcoInit (Tcl_Interp* interp); /* * The following is implemented in tkWinGDI.c */ -MODULE_SCOPE int Winprint_Init(Tcl_Interp* interp); +MODULE_SCOPE int Winprint_Init(Tcl_Interp* interp); /* - * The following is implemented in tkWinSysTray.c + * The following is implemented in tkWinDraw.c and used in tkUtil.c */ -MODULE_SCOPE int WinIcoInit (Tcl_Interp* interp); +MODULE_SCOPE void TkWinDrawDottedRect (Display *disp, Drawable d, + unsigned long pixel, int x, int y, + int width, int height); /* * Common routines used in Windows implementation */ -MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError); +MODULE_SCOPE Tcl_Obj * TkWin32ErrorObj(HRESULT hrError); /* |