From 28206ce84e226d703d99c03bdaf493d4cd2f07ca Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sun, 8 Oct 2006 21:30:36 +0000 Subject: [PATCH] Use system colours for ownerdrawn highlighting (patch #1555426). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41749 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 9 +++------ src/os2/ownerdrw.cpp | 22 ++++++++++++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 98e88bc911..efcb76c04d 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -2704,15 +2704,12 @@ typedef unsigned long HGLOBAL; /* WIN32 graphics types for OS/2 GPI */ /* RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def */ -/* WARNING: The OS/2 headers typedef BYTE simply as 'char'; if the default is signed, all */ -/* hell will break loose! */ -/* #define OS2RGB(r,g,b) ((DWORD ((BYTE) (b) | ((WORD) (g) << 8)) | (((DWORD)(BYTE)(r)) << 16))) */ #define OS2RGB(r,g,b) ((DWORD)((unsigned char)(b) | ((unsigned char)(g) << 8)) | ((unsigned char)(r) << 16)) typedef unsigned long COLORREF; -#define GetBValue(rgb) ((BYTE)((rgb) >> 16)) -#define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8)) -#define GetRValue(rgb) ((BYTE)(rgb)) +#define GetRValue(rgb) ((unsigned char)((rgb) >> 16)) +#define GetGValue(rgb) ((unsigned char)(((unsigned short)(rgb)) >> 8)) +#define GetBValue(rgb) ((unsigned char)(rgb)) #define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) #define PALETTERGB(r,g,b) (0x02000000 | OS2RGB(r,g,b)) /* OS2's RGB/RGB2 is backwards from this */ diff --git a/src/os2/ownerdrw.cpp b/src/os2/ownerdrw.cpp index 64abe8b8ce..93742e8279 100644 --- a/src/os2/ownerdrw.cpp +++ b/src/os2/ownerdrw.cpp @@ -204,12 +204,22 @@ bool wxOwnerDrawn::OnDrawItem( wxDC& rDC, // if (eStatus & wxODSelected) { - wxColour vCol2(wxT("WHITE")); - vColBack.Set( (unsigned char)0 - ,(unsigned char)0 - ,(unsigned char)160 - ); // no dark blue in color table - vColText = vCol2; + vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP + ,SYSCLR_MENUHILITEBGND + ,0L + ); + vColBack.Set( GetRValue(vRef) + ,GetGValue(vRef) + ,GetBValue(vRef) + ); + vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP + ,SYSCLR_MENUHILITE + ,0L + ); + vColText.Set( GetRValue(vRef) + ,GetGValue(vRef) + ,GetBValue(vRef) + ); } else if (eStatus & wxODDisabled) { -- 2.45.2