Print Page | Close Window

Wrong tab height with ribbon bar and 32x32 icons

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=15934
Printed Date: 16 November 2024 at 1:14pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Wrong tab height with ribbon bar and 32x32 icons
Posted By: cmarsura
Subject: Wrong tab height with ribbon bar and 32x32 icons
Date Posted: 29 December 2009 at 5:44am
With ribbonbar, the tab manager does not supports icons of size different by 16x16. This fact is due to use of hardcoded size of icons height during tab size computation.

If you want use icons more larger than 16x16 in the tabs of ribbonbar you must modify some source files as explained here:

File XTPRibbonBar.cpp
- Change function body CXTPRibbonBar::GetTabsHeight() to:
int CXTPRibbonBar::GetTabsHeight() const
{
     return m_bTabsVisible ? GetRibbonPaintManager()->GetTabsHeight(const_cast<CXTPRibbonBar *>(this)) : 2;
}


File XTPRibbonTheme.cpp
- Add:
#include "XTPRibbonControlTab.h"


- In class CXTPRibbonTheme::CRibbonAppearanceSet : public CXTPTabPaintManager::CAppearanceSetPropertyPageFlat change the inline GetButtonHeight() to:
     int GetButtonHeight(const CXTPTabManager* pTabManager)
     {
          return CAppearanceSetPropertyPageFlat::GetButtonHeight(pTabManager);
     }


- In the CXTPRibbonTheme::FillRibbonBar() change the row:
     CRect rcRibbonTabs(rcRibbonClient.left, rcRibbonClient.top, rcRibbonClient.right, rcRibbonClient.top + m_nTabsHeight);

to the following:
     CRect rcRibbonTabs(rcRibbonClient.left, rcRibbonClient.top, rcRibbonClient.right, rcRibbonClient.top + this->GetTabsHeight(pRibbonBar));


- Add the function:
int CXTPRibbonTheme::GetTabsHeight(CXTPRibbonBar* pRibbonBar) const
{
     int nTabsHeight = 0;
     ASSERT(pRibbonBar);

     CXTPTabManager* pTabManager = pRibbonBar->GetControlTab();
     int nRowcount = pTabManager->GetRowCount();
     nTabsHeight = nRowcount * (GetTabPaintManager()->GetAppearanceSet()->GetButtonHeight(pTabManager) -1);
     return nTabsHeight;
}


File XTPRibbonTheme.h
- Add to class CXTPRibbonTheme following public declaration:
virtual int GetTabsHeight(CXTPRibbonBar* pRibbonBar) const;


PS: Message to Codejock developers: Can you add support to ribbonbar for icon size different by 16x16?

Carlo


-------------
Product: Xtreme ToolkitPro v 11.1 / Xtreme SuitePro v 10.4.2
Platform: Windows XP (32bit) - SP 3
Language: Visual Studio 2008, Visual Studio 6, Visual Basic 6.0



Replies:
Posted By: znakeeye
Date Posted: 02 January 2010 at 10:18pm
I believe the whole idea of the paintmanager-design is to allow you to derive and change the drawing behavior in runtime.
 
clas CMyRibbonTheme : public CXTPRibbonTheme { ... };
 
pRibbon->SetTheme(new CMyRibbonTheme);


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: cmarsura
Date Posted: 04 January 2010 at 11:53am
You are right, however you must have to change the CXTPRibbonBar::GetTabsHeight() to call a function that computes at runtime the height by function call instead of accessing the member variable m_nTabsHeight that is initialized one time only.

Carlo.

-------------
Product: Xtreme ToolkitPro v 11.1 / Xtreme SuitePro v 10.4.2
Platform: Windows XP (32bit) - SP 3
Language: Visual Studio 2008, Visual Studio 6, Visual Basic 6.0



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