use system colors instead of hardcoded constants for drive panes

svn path=/trunk/; revision=6089
This commit is contained in:
Martin Fuchs 2003-09-16 21:54:24 +00:00
parent d1e179a339
commit b4f1ad8ce1
2 changed files with 17 additions and 8 deletions

View file

@ -189,6 +189,17 @@ void Pane::init()
SetWindowFont(_hwnd, _out_wrkr._hfont, FALSE); SetWindowFont(_hwnd, _out_wrkr._hfont, FALSE);
// read the color for compressed files from registry
HKEY hkeyExplorer = 0;
DWORD len = sizeof(_clrCompressed);
if (RegOpenKey(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"), &hkeyExplorer) ||
RegQueryValueEx(hkeyExplorer, _T("AltColor"), 0, NULL, (LPBYTE)&_clrCompressed, &len) || len!=sizeof(_clrCompressed))
_clrCompressed = RGB(0,0,255);
if (hkeyExplorer)
RegCloseKey(hkeyExplorer);
// calculate column widths // calculate column widths
_out_wrkr.init_output(_hwnd); _out_wrkr.init_output(_hwnd);
calc_widths(true); calc_widths(true);
@ -447,15 +458,15 @@ void Pane::draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
focusRect.left = img_pos -2; focusRect.left = img_pos -2;
if (attrs & FILE_ATTRIBUTE_COMPRESSED) if (attrs & FILE_ATTRIBUTE_COMPRESSED)
textcolor = COLOR_COMPRESSED; textcolor = _clrCompressed;
else else
textcolor = RGB(0,0,0); textcolor = RGB(0,0,0);
if (dis->itemState & ODS_FOCUS) { if (dis->itemState & ODS_FOCUS) {
textcolor = RGB(255,255,255); textcolor = GetSysColor(COLOR_HIGHLIGHTTEXT);
bkcolor = COLOR_SELECTION; bkcolor = GetSysColor(COLOR_HIGHLIGHT);
} else { } else {
bkcolor = RGB(255,255,255); bkcolor = GetSysColor(COLOR_WINDOW);
} }
HBRUSH hbrush = CreateSolidBrush(bkcolor); HBRUSH hbrush = CreateSolidBrush(bkcolor);

View file

@ -26,10 +26,6 @@
// //
#define COLOR_COMPRESSED RGB(0,0,255)
#define COLOR_SELECTION RGB(0,0,128)
#define IDW_TREE_LEFT 3 #define IDW_TREE_LEFT 3
#define IDW_TREE_RIGHT 6 #define IDW_TREE_RIGHT 6
#define IDW_HEADER_LEFT 2 #define IDW_HEADER_LEFT 2
@ -80,6 +76,8 @@ struct Pane : public SubclassedWindow
Entry* _root; Entry* _root;
Entry* _cur; Entry* _cur;
COLORREF _clrCompressed;
void init(); void init();
void set_header(); void set_header();
bool create_header(HWND parent, int id); bool create_header(HWND parent, int id);