Print Page | Close Window

How to apply Skins to Ribbon Bar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=16543
Printed Date: 22 November 2024 at 1:36pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to apply Skins to Ribbon Bar
Posted By: Makarand
Subject: How to apply Skins to Ribbon Bar
Date 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



Replies:
Posted By: Smucker
Date 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)




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