Print Page | Close Window

Updated Office2003 theme - 2000 and below

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=981
Printed Date: 09 May 2024 at 7:07am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Updated Office2003 theme - 2000 and below
Posted By: Ark42
Subject: Updated Office2003 theme - 2000 and below
Date Posted: 25 July 2004 at 11:22pm

//////////////////////////////////////////////////////////// ////////////////
// CXTPDockingPaneOffice2003ThemeEx

class CXTPDockingPaneOffice2003ThemeEx : public CXTPDockingPaneOffice2003Theme
{
public:
    CXTPDockingPaneOffice2003ThemeEx(BOOL bGreyToBlue = TRUE);
    virtual void DrawCaption(CDC& dc, CXTPDockingPaneTabbedContainer* pPane, CRect rc);
    virtual void DrawFloatingFrame(CDC& dc, CXTPDockingPaneMiniWnd* pPane, CRect rc);
    BOOL m_bGreyToBlue;
protected:
    virtual void RefreshMetrics();
};

//////////////////////////////////////////////////////////// ////////////////
// CColorSetOffice2003Ex

class CColorSetOffice2003Ex : public CXTPTabPaintManager::CColorSetOffice2003
{
public:
    CColorSetOffice2003Ex(BOOL bGreyToBlue = TRUE);
    BOOL m_bGreyToBlue;
protected:
    virtual void RefreshMetrics();
};

//////////////////////////////////////////////////////////// ////////////////
// CXTPDockingPaneOffice2003ThemeEx

CXTPDockingPaneOffice2003ThemeEx::CXTPDockingPaneOffice2003T hemeEx(BOOL bGreyToBlue)
{
    m_bGreyToBlue = bGreyToBlue;
    RefreshMetrics();
}

void CXTPDockingPaneOffice2003ThemeEx::DrawCaption(CDC& dc, CXTPDockingPaneTabbedContainer* pPane, CRect rc)
{
    if( pPane->IsActive() ) {
        COLORREF oldDark = m_clrCommandBarDark,
            oldLight = m_clrCommandBarLight;
        if( m_bLunaTheme ) {
            m_clrCommandBarDark = RGB(255, 166, 76);
            m_clrCommandBarLight = RGB(255, 212, 139);
        } else {
            m_clrCommandBarDark = XTPColorManager()->LightColor(m_clrCommandBarDark, m_ clrCommandBarLight, 50);   
            m_clrCommandBarLight = m_clrCommandBarDark;
        }
        CXTPDockingPaneOffice2003Theme::DrawCaption(dc, pPane, rc);
        m_clrCommandBarDark = oldDark;
        m_clrCommandBarLight = oldLight;
    } else {
        CXTPDockingPaneOffice2003Theme::DrawCaption(dc, pPane, rc);
    }
}

void CXTPDockingPaneOffice2003ThemeEx::DrawFloatingFrame(CDC& dc, CXTPDockingPaneMiniWnd* pPane, CRect rc)
{
    if( pPane->IsActive() ) {
        COLORREF oldDark = m_clrCommandBarDark,
            oldLight = m_clrCommandBarLight;
        if( m_bLunaTheme ) {
            m_clrCommandBarDark = RGB(255, 166, 76);
            m_clrCommandBarLight = RGB(255, 212, 139);
        } else {
            m_clrCommandBarDark = XTPColorManager()->LightColor(m_clrCommandBarDark, m_ clrCommandBarLight, 50);   
            m_clrCommandBarLight = m_clrCommandBarDark;
        }
        CXTPDockingPaneOffice2003Theme::DrawFloatingFrame(dc, pPane, rc);
        m_clrCommandBarDark = oldDark;
        m_clrCommandBarLight = oldLight;
    } else {
        CXTPDockingPaneOffice2003Theme::DrawFloatingFrame(dc, pPane, rc);
    }
}

void CXTPDockingPaneOffice2003ThemeEx::RefreshMetrics()
{
    CXTPDockingPaneOffice2003Theme::RefreshMetrics();
    if( !m_bLunaTheme ) {
        CXTPColorManager *pClrMgr = XTPColorManager();
        COLORREF btn = pClrMgr->GetColor(COLOR_BTNFACE);
        if( m_bGreyToBlue && (btn == RGB(192, 192, 192) || btn == RGB(212, 208, 200)) ) {
            m_clrCommandBarDark = RGB(129, 169, 226);
            m_clrCommandBarLight = RGB(221, 236, 254);
            m_bLunaTheme = TRUE;

            m_arrColor[0] = RGB(0, 0, 0);
            m_arrColor[1] = RGB(0, 78, 152);
            m_arrColor[2] = RGB(0, 84, 227);
            m_arrColor[3] = RGB(122, 150, 223);
            m_arrColor[4] = RGB(255, 255, 255);
            m_arrColor[5] = RGB(255, 255, 255);
            m_arrColor[6] = RGB(0, 0, 0);
            m_arrColor[7] = RGB(0, 0, 0);
            m_arrColor[8] = RGB(0, 0, 0);
            m_arrColor[9] = RGB(255, 255, 255);
            m_arrColor[10] = RGB(212, 208, 200);
            m_arrColor[11] = RGB(212, 208, 200);
            m_arrColor[12] = RGB(128, 128, 128);
            m_arrColor[13] = RGB(49, 106, 197);
            m_arrColor[14] = RGB(255, 255, 255);
//            m_arrColor[15] = RGB(236, 233, 216);
            m_arrColor[15] = btn;
            m_arrColor[16] = RGB(172, 168, 153);
            m_arrColor[17] = RGB(172, 168, 153);
            m_arrColor[18] = RGB(0, 0, 0);
            m_arrColor[19] = RGB(216, 228, 248);
            m_arrColor[20] = RGB(255, 255, 255);
            m_arrColor[21] = RGB(113, 111, 100);
            m_arrColor[22] = RGB(251, 248, 231);
            m_arrColor[23] = RGB(0, 0, 0);
            m_arrColor[24] = RGB(255, 255, 225);
            m_arrColor[25] = RGB(181, 181, 181);
            m_arrColor[26] = RGB(0, 0, 128);
            m_arrColor[27] = RGB(61, 149, 255);
            m_arrColor[28] = RGB(0, 0, 0);
            m_arrColor[29] = RGB(0, 0, 0);
            m_arrColor[30] = RGB(158, 190, 245);
            m_arrColor[31] = RGB(255, 238, 194);
            m_arrColor[32] = RGB(0, 0, 128);
            m_arrColor[33] = RGB(254, 128, 62);
            m_arrColor[34] = RGB(144, 157, 178);
            m_arrColor[35] = RGB(197, 194, 184);
            m_arrColor[36] = RGB(255, 192, 111);
            m_arrColor[37] = RGB(0, 0, 128);
            m_arrColor[38] = RGB(39, 65, 118);
            m_arrColor[39] = RGB(106, 140, 203);
            m_arrColor[40] = RGB(109, 150, 208);
            m_arrColor[41] = RGB(246, 246, 246);
            m_arrColor[42] = RGB(230, 227, 210);
            m_arrColor[43] = RGB(0, 45, 150);
            m_arrColor[44] = RGB(0, 0, 0);
            m_arrColor[45] = RGB(0, 0, 0);
            m_arrColor[46] = RGB(0, 0, 0);
            m_arrColor[47] = RGB(0, 0, 0);
            m_arrColor[48] = RGB(218, 233, 255);
            m_arrColor[49] = RGB(129, 126, 114);
            m_arrColor[50] = RGB(0, 0, 128);
            m_arrColor[51] = RGB(216, 231, 252);
            m_arrColor[52] = RGB(158, 190, 245);
            m_arrColor[53] = RGB(203, 225, 252);
            m_arrColor[54] = RGB(0, 45, 150);
            m_arrColor[55] = RGB(196, 218, 250);
        }
    }
}

//////////////////////////////////////////////////////////// ////////////////
// CColorSetOffice2003Ex

CColorSetOffice2003Ex::CColorSetOffice2003Ex(BOOL bGreyToBlue)
{
    m_bGreyToBlue = bGreyToBlue;
//    RefreshMetrics();
}

void CColorSetOffice2003Ex::RefreshMetrics()
{
    CColorSetOffice2003::RefreshMetrics();
    if( !m_bLunaTheme ) {
        CXTPColorManager *pClrMgr = XTPColorManager();
        COLORREF btn = pClrMgr->GetColor(COLOR_BTNFACE);
        if( m_bGreyToBlue && (btn == RGB(192, 192, 192) || btn == RGB(212, 208, 200)) ) {
            m_clrHeaderFace.clrLight = RGB(196, 218, 250);
            m_clrHeaderFace.clrDark = RGB(252, 253, 254);
            m_clrAutoHideFace.clrLight = RGB(158, 190, 245);
            m_clrAutoHideFace.clrDark = RGB(196, 218, 250);
            m_clrFrameBorder = RGB(59, 97, 156);
            m_clrControlFace = RGB(236, 233, 216);
            m_clrHighlight = RGB(255, 255, 255);
            m_clrButtonSelected = RGB(255, 194, 115);
            m_clrButtonNormal = RGB(162, 192, 246);
            m_clrNormalText = RGB(0, 0, 0);
            m_clrInActiveText = RGB(0, 0, 0);
            m_clrSelectedText = RGB(0, 0, 0);
            m_clrHighlightText = RGB(0, 0, 0);
            m_clrDisabledText = RGB(172, 168, 153);
            m_clrButtonHighlighted = RGB(255, 240, 201);
            m_clrNavigateButtonBorder = RGB(0, 0, 128);
            m_bLunaTheme = TRUE;
        }
    }
}

Sample Usage:
    m_paneManager.InstallDockingPanes(this);
    m_paneManager.UseSplitterTracker(FALSE);
    m_paneManager.SetThemedFloatingFrames(TRUE);
    m_paneManager.SetAlphaDockingContext(TRUE);
    m_paneManager.SetCustomTheme(new CXTPDockingPaneOffice2003ThemeEx());
    m_paneManager.GetPaintManager()->m_pTabPaintManager->S etColorSet(new CColorSetOffice2003Ex());
    m_paneManager.GetPaintManager()->m_pPanelPaintManager-> ;SetColorSet(new CColorSetOffice2003Ex());


I also have a little hackish code that highlights the panes when they have focus by coloring the caption orange, similar to how Office 2003 actually does it sometimes. So you will see a pane go from to when it gets focus.  It works on the new SetThemedFloatingFrames style too.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net