Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - How to apply Skins to Ribbon Bar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to apply Skins to Ribbon Bar

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

Joined: 27 February 2007
Location: India
Status: Offline
Points: 140
Post Options Post Options   Thanks (0) Thanks(0)   Quote Makarand Quote  Post ReplyReply Direct Link To This Post Topic: How to apply Skins to Ribbon Bar
    Posted: 31 March 2010 at 6:30am
Hello CJ Team,


We have implemented Ribbon bar in our application previously we are using normal toolbar where we can apply different skin to the application (Code as follow).

-------------------------------------------------

switch (iStyleNo)
   {
   case None:
      XTPSkinManager()->LoadSkin(_T(""), _T(""));          
      break;
   case Office2007Style:
      XTPSkinManager()->LoadSkin(m_strStylesPath + _T("Office2007.cjstyles"), _T("NormalBlue.INI"));
      break;
   case WindowsVistaStyle:
      XTPSkinManager()->LoadSkin(m_strStylesPath + _T("Vista.cjstyles"), _T("NormalBlue.INI"));
      break;
   case WindowsVistaStyleBlack:
      XTPSkinManager()->LoadSkin(m_strStylesPath + _T("Vista.cjstyles"), _T("NormalBlack.INI"));
      break;
     case WindowsXPLunaStyle:
      XTPSkinManager()->LoadSkin(m_strStylesPath + _T("WinXP.Luna.cjstyles"), _T("NormalBlue.INI"));
      break;       
   case WindowsXPRoyalStyle:
      XTPSkinManager()->LoadSkin(m_strStylesPath + _T("WinXP.Royale.cjstyles"), _T("NormalRoyale.INI"));
      break;
}

XTPSkinManager()->SetApplyOptions(XTPSkinManager()->GetApplyOptions() | xtpSkinApplyMetrics);   
   XTPPaintManager()->RefreshMetrics();

-------------------------------------------------------


Now we have ribbon bar with the replacement of toolbar in that case we are not able to set the skin to the Ribon bar.

Is it possible to set the style to the Ribbon bar? if yes then How can we apply?

-Mak
Back to Top
Smucker View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 February 2008
Status: Offline
Points: 156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Smucker Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2010 at 1:50pm
If ribbons work the same as regular command bars, you just need set the style to NativeWinXP. The code below is copied from a routine I use to keep command bar themes, pane themes, and grid themes in synch, along with allowing for skins:

  if (XTPSkinManager()->LoadSkin(filename) ) {
    CXTPCommandBars* pbars = GetCommandBars();             // From main frame
    XTPPaintManager()->SetTheme(xtpThemeNativeWinXP);
    pbars->GetImageManager()->RefreshAll();
    pbars->UpdateCommandBars();
    pbars->RedrawCommandBars();
    ApplySkin();
  }


ApplySkin() looks like this:

void CMainFrame::ApplySkin()
{
    DWORD options = xtpSkinApplyColors;

    XTPPaintManager()->RefreshMetrics();
    if (m_skinning) {
        if (m_skinframe)
            options |= xtpSkinApplyFrame; //|xtpSkinApplyMetrics;
        XTPSkinManager()->SetApplyOptions(options);
    }
    XTPSkinManager()->SetAutoApplyNewWindows(TRUE);
    XTPSkinManager()->SetAutoApplyNewThreads(TRUE);
    XTPSkinManager()->EnableCurrentThread();
    XTPSkinManager()->ApplyWindow(GetSafeHwnd());
    XTPSkinManager()->RedrawAllControls();
    ExcludeSkinModules(XTPSkinManager());
    OnSysColorChange();
    RedrawWindow(0, 0, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ALLCHILDREN);       
}


I'm probably doing some unnecessary repainting, but this isn't something that happens that often, so I'm not worried about it.

Product: Xtreme Toolkit Pro version 13.2 (Unicode, static build)

Platform: Windows 200x/XP/Vista/Win7 (32/64 bit)

Language: Visual C++ 9.0 (Studio 2008)

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.141 seconds.