(wParam, lParam uintptr)
| 2261 | } |
| 2262 | |
| 2263 | func (wb *WindowBase) handleWMCTLCOLOR(wParam, lParam uintptr) uintptr { |
| 2264 | hwnd := win.HWND(lParam) |
| 2265 | hdc := win.HDC(wParam) |
| 2266 | |
| 2267 | type TextColorer interface { |
| 2268 | TextColor() Color |
| 2269 | } |
| 2270 | |
| 2271 | wnd := windowFromHandle(hwnd) |
| 2272 | if wnd == nil { |
| 2273 | switch windowFromHandle(win.GetParent(hwnd)).(type) { |
| 2274 | case *ComboBox: |
| 2275 | // nop |
| 2276 | return 0 |
| 2277 | } |
| 2278 | |
| 2279 | wnd = wb |
| 2280 | } else if tc, ok := wnd.(TextColorer); ok { |
| 2281 | color := tc.TextColor() |
| 2282 | if color == 0 { |
| 2283 | color = Color(win.GetSysColor(win.COLOR_WINDOWTEXT)) |
| 2284 | } |
| 2285 | win.SetTextColor(hdc, win.COLORREF(color)) |
| 2286 | } |
| 2287 | |
| 2288 | if bg, wnd := wnd.AsWindowBase().backgroundEffective(); bg != nil { |
| 2289 | wb.prepareDCForBackground(hdc, hwnd, wnd) |
| 2290 | |
| 2291 | type Colorer interface { |
| 2292 | Color() Color |
| 2293 | } |
| 2294 | |
| 2295 | if c, ok := bg.(Colorer); ok { |
| 2296 | win.SetBkColor(hdc, win.COLORREF(c.Color())) |
| 2297 | } |
| 2298 | |
| 2299 | return uintptr(bg.handle()) |
| 2300 | } |
| 2301 | |
| 2302 | switch wnd.(type) { |
| 2303 | case *LineEdit, *numberLineEdit, *TextEdit: |
| 2304 | type ReadOnlyer interface { |
| 2305 | ReadOnly() bool |
| 2306 | } |
| 2307 | |
| 2308 | var sysColor int |
| 2309 | if ro, ok := wnd.(ReadOnlyer); ok && ro.ReadOnly() { |
| 2310 | sysColor = win.COLOR_BTNFACE |
| 2311 | } else { |
| 2312 | sysColor = win.COLOR_WINDOW |
| 2313 | } |
| 2314 | |
| 2315 | win.SetBkColor(hdc, win.COLORREF(win.GetSysColor(sysColor))) |
| 2316 | |
| 2317 | return uintptr(win.GetSysColorBrush(sysColor)) |
| 2318 | } |
| 2319 | |
| 2320 | return 0 |
no test coverage detected