Exemple #1
0
void CItemList::DefaultColors()
{
	SetBckCol(	GetSysColor( COLOR_3DFACE ), GetSysColor( COLOR_3DFACE ) );
	SetSelCol(	CGrDC::ScaleColor( GetSysColor( COLOR_HIGHLIGHT ), 40 ),
				CGrDC::ScaleColor( GetSysColor( COLOR_HIGHLIGHT ), -40 ) );
	SetTextCol(	GetSysColor( COLOR_BTNTEXT ) );
	SetSelTextCol(	GetSysColor( COLOR_HIGHLIGHTTEXT ) );
	SetBarCol(	CGrDC::ScaleColor( GetSysColor( COLOR_INACTIVECAPTION ), 40 ),
				CGrDC::ScaleColor( GetSysColor( COLOR_INACTIVECAPTION ), -40 ) );
}
void UpdateTocColors(WindowInfo *win)
{
    COLORREF labelBgCol = GetSysColor(COLOR_BTNFACE);
    COLORREF labelTxtCol = GetSysColor(COLOR_BTNTEXT);
    COLORREF treeBgCol = (DWORD)-1;
    COLORREF splitterCol = GetSysColor(COLOR_BTNFACE);
    bool flatTreeWnd = false;

    if (win->AsEbook() && !gGlobalPrefs->useSysColors) {
        labelBgCol = gGlobalPrefs->ebookUI.backgroundColor;
        labelTxtCol = gGlobalPrefs->ebookUI.textColor;
        treeBgCol = labelBgCol;
        float factor = 14.f;
        int sign = GetLightness(labelBgCol) + factor > 255 ? 1 : -1;
        splitterCol = AdjustLightness2(labelBgCol, sign * factor);
        flatTreeWnd = true;
    }

    TreeView_SetBkColor(win->hwndTocTree, treeBgCol);
    SetBgCol(win->tocLabelWithClose, labelBgCol);
    SetTextCol(win->tocLabelWithClose, labelTxtCol);
    SetBgCol(win->sidebarSplitter, splitterCol);
    ToggleWindowStyle(win->hwndTocTree, WS_EX_STATICEDGE, !flatTreeWnd, GWL_EXSTYLE);
    SetWindowPos(win->hwndTocTree, nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);

    // TODO: if we have favorites in ebook view, we'll need this
    //SetBgCol(win->favLabelWithClose, labelBgCol);
    //SetTextCol(win->favLabelWithClose, labelTxtCol);
    //SetBgCol(win->favSplitter, labelTxtCol);

    // TODO: more work needed to to ensure consistent look of the ebook window:
    // - tab bar should match the color
    // - change the tree item text color
    // - change the tree item background color when selected (for both focused and non-focused cases)
    // - ultimately implement owner-drawn scrollbars in a simpler style (like Chrome or VS 2013)
    //   and match their colors as well
}