Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Custom themes
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Custom themes

 Post Reply Post Reply
Author
Message
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Topic: Custom themes
    Posted: 15 April 2004 at 10:22pm

This theme worked in 8.61 to simulate the blue XP theme colors for win2000 and below, but no longer fully worked in 8.70:

class CXTPOffice2003ThemeEx : public CXTPOffice2003Theme
{
public:
    CXTPOffice2003ThemeEx(BOOL bGreyToBlue = TRUE, BOOL bYellowHighlight = FALSE);
    BOOL m_bGreyToBlue, m_bYellowHighlight;
protected:
    virtual void RefreshMetrics();
};

CXTPOffice2003ThemeEx::CXTPOffice2003ThemeEx(BOOL bGreyToBlue, BOOL bYellowHighlight)
{
    m_bGreyToBlue = bGreyToBlue;
    m_bYellowHighlight = bYellowHighlight;
    RefreshMetrics();
}

void CXTPOffice2003ThemeEx::RefreshMetrics()
{
    CXTPOffice2003Theme::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_clrDockBarDark = RGB(158, 190, 245);
            m_clrDockBarLight = RGB(196, 218, 250);
            m_clrCommandBarDark = RGB(129, 169, 226);
            m_clrCommandBarLight = RGB(221, 236, 254);
            m_clrPopupDark = RGB(227, 239, 255);
            m_clrPopupLight = RGB(147, 181, 231);
            m_crlToolbarShadow = RGB(59, 97, 156);
            m_crlFloatingGripper = RGB(42, 102, 201);
            m_crlExpandNormalDark = RGB(0, 53, 145);
            m_crlExpandNormalLight = RGB(117, 166, 241);
            m_clrMenuExpandedDark = RGB(121, 161, 220);
            m_clrMenuExpandedLight = RGB(203, 221, 246);
            m_clrCircleDark = RGB(129, 169, 226);
            m_clrCircleLight = RGB(227, 239, 254);
            m_clrStatusPane = RGB(221, 221, 221);
            m_bLunaTheme = TRUE;

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

I would use it as:
    CXTPPaintManager::SetCustomTheme(new CXTPOffice2003ThemeEx());
in place of:
    CXTPPaintManager::SetTheme(xtpThemeOffice2003);

Most of the colors still work, but greyed out toolbar items and the orange color for menu mouse hover no longer works right. What changed in 8.70 and how can I fix this?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2004 at 7:44am

In th 8.70 Colors for CommandBars owned to PaintManager.

You need call:

SetColors(...)

or

m_arrColor[...] = ...

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2004 at 9:57pm

I'm not following completely, what do I nee to call SetColor() for ? I'm using CXTPColorManager *pClrMgr = XTPColorManager();
is there a second XTPColorManager now?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2004 at 10:32pm

instead pClrMgr->SetColor(55, RGB(196, 218, 250));

write

m_arrColor[55] = RGB(196, 218, 250);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2004 at 10:36pm

I'm confused as to why that should work, I thought SetColor was implemented as:
void CXTPColorManager::SetColor(int nIndex, COLORREF clrValue)
{
    m_arrColor[nIndex] = clrValue;
}

and while SetColor is public, m_arrColor is protected.

Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2004 at 11:55pm
It does work, for anybody else who wants to use it:

class CXTPOffice2003ThemeEx : public CXTPOffice2003Theme
{
public:
    CXTPOffice2003ThemeEx(BOOL bGreyToBlue = TRUE, BOOL bYellowHighlight = FALSE);
    BOOL m_bGreyToBlue, m_bYellowHighlight;
protected:
    virtual void RefreshMetrics();
};

CXTPOffice2003ThemeEx::CXTPOffice2003ThemeEx(BOOL bGreyToBlue, BOOL bYellowHighlight)
{
    m_bGreyToBlue = bGreyToBlue;
    m_bYellowHighlight = bYellowHighlight;
    RefreshMetrics();
}

void CXTPOffice2003ThemeEx::RefreshMetrics()
{
    CXTPOffice2003Theme::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_clrDockBarDark = RGB(158, 190, 245);
            m_clrDockBarLight = RGB(196, 218, 250);
            m_clrCommandBarDark = RGB(129, 169, 226);
            m_clrCommandBarLight = RGB(221, 236, 254);
            m_clrPopupDark = RGB(227, 239, 255);
            m_clrPopupLight = RGB(147, 181, 231);
            m_crlToolbarShadow = RGB(59, 97, 156);
            m_crlFloatingGripper = RGB(42, 102, 201);
            m_crlExpandNormalDark = RGB(0, 53, 145);
            m_crlExpandNormalLight = RGB(117, 166, 241);
            m_clrMenuExpandedDark = RGB(121, 161, 220);
            m_clrMenuExpandedLight = RGB(203, 221, 246);
            m_clrCircleDark = RGB(129, 169, 226);
            m_clrCircleLight = RGB(227, 239, 254);
            m_clrStatusPane = RGB(221, 221, 221);
            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[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);
        } else if(m_bYellowHighlight) {
            m_arrColor[31] = RGB(255, 238, 194);
            m_arrColor[33] = RGB(254, 128, 62);
            m_arrColor[36] = RGB(255, 192, 111);
            m_bLunaTheme = TRUE;
        }
    }
}
Back to Top
Frode View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Location: Norway
Status: Offline
Points: 42
Post Options Post Options   Thanks (0) Thanks(0)   Quote Frode Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2004 at 8:37am

Great functionality!

Questions:

Should this code only be included when running Windows 2000 and below - or can it be included for Windows XP too? Do I have to check what type of operating system the user is running, and then use your code if it's not Windows XP...?

What about the other functions in the CXTPOffice2003Theme class (like FillDockBar, ExcludeCorners etc.) - should these be implemented in your CXTPOffice2003ThemeEx class too?

Best regards,
Frode Gorseth

 

Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2004 at 9:48am

It works fine under XP, you don't need any special detection.  The  if( !m_bLunaTheme ) check will make the class fall back to 100% the normal Office2003 theme class if you have XP themes on.  If it runs under XP when XP is set to the classic mode, the class here will still emulate the blue colors for the toolbars.
I don't think any of the other functions need to be implemented, they will be used in the base class and all I am doing is hard-coding the XP Luna blue color scheme, which all the other functions should use.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.