Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Wrong tab height with ribbon bar and 32x32 icons
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Wrong tab height with ribbon bar and 32x32 icons

 Post Reply Post Reply
Author
Message
cmarsura View Drop Down
Newbie
Newbie


Joined: 14 September 2009
Location: Italy
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmarsura Quote  Post ReplyReply Direct Link To This Post Topic: Wrong tab height with ribbon bar and 32x32 icons
    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
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
cmarsura View Drop Down
Newbie
Newbie


Joined: 14 September 2009
Location: Italy
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmarsura Quote  Post ReplyReply Direct Link To This Post 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
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.109 seconds.