| 1675 | |
| 1676 | |
| 1677 | void AssignColor(LPTSTR aColorName, COLORREF &aColor, HBRUSH &aBrush) |
| 1678 | // Assign the color indicated in aColorName (either a name or a hex RGB value) to both |
| 1679 | // aColor and aBrush, deleting any prior handle in aBrush first. If the color cannot |
| 1680 | // be determined, it will always be set to CLR_DEFAULT (and aBrush set to NULL to match). |
| 1681 | // It will never be set to CLR_NONE. |
| 1682 | { |
| 1683 | COLORREF color; |
| 1684 | if (!*aColorName) |
| 1685 | color = CLR_DEFAULT; |
| 1686 | else |
| 1687 | { |
| 1688 | color = ColorNameToBGR(aColorName); |
| 1689 | if (color == CLR_NONE) // A matching color name was not found, so assume it's a hex color value. |
| 1690 | // It seems strtol() automatically handles the optional leading "0x" if present: |
| 1691 | color = rgb_to_bgr(_tcstol(aColorName, NULL, 16)); |
| 1692 | // if aColorName does not contain something hex-numeric, black (0x00) will be assumed, |
| 1693 | // which seems okay given how rare such a problem would be. |
| 1694 | } |
| 1695 | AssignColor(color, aColor, aBrush); |
| 1696 | } |
| 1697 | |
| 1698 | void AssignColor(COLORREF color, COLORREF &aColor, HBRUSH &aBrush) |
| 1699 | { |
no test coverage detected