The behavior of each button in the ribbon button is controlled by two informativeness levels (info levels for short): effective and visual.
The visual info level determines the appearance of the button and can be one of the following values:
__EXT_RIBBON_ILV_SIMPLE_SMALL
(=0) displays a small icon only.
__EXT_RIBBON_ILV_SIMPLE_NORMAL
(=1) displays a small icon and text.
__EXT_RIBBON_ILV_SIMPLE_LARGE
(=2) displays a large icon and text.
The effective info level determines the button’s weight, which specifies when a button changes its visual appearance as the ribbon is resized. You can customize the behavior of the ribbon button programmatically by setting up a map that tells on which effective level the button changes its appearance. The effective levels are graded on a scale of 0
to __EXT_RIBBON_ILE_MAX
(which is now 10). So, if you have two buttons and add to the map of the first button the pair
__EXT_RIBBON_ILE_MAX - 5
--- __EXT_RIBBON_ILV_SIMPLE_SMALL
and for the second button
__EXT_RIBBON_ILE_MAX - 3
--- __EXT_RIBBON_ILV_SIMPLE_SMALL
,
then when making the ribbon smaller, the first button will get small first, the second later.
If you specify only one visual info level for the button, it will do not change its look when you resize the ribbon. Here is how the Paste button is initialized in the RibbonBar sample:
CExtRibbonNode * pNodePaste =
new CExtRibbonNode( ID_EDIT_PASTE, 0, NULL, 0, _T("Paste") );
pNodePaste->RibbonILE_RuleArrayGet().RemoveAll();
VERIFY( pNodePaste->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_EDIT_PASTE_BIG) ) );
pNodePaste->m_iconBig.m_bmpNormal.Make32();
pNodePaste->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pRibbonGroup->InsertNode( NULL, pNodePaste );
It will be constantly large because we removed all the default mapping rules using
pNodePaste->RibbonILE_RuleArrayGet().RemoveAll()
(when the map is empty, the button always has the large size). To make it always small, add this rule entry:
pNodePaste->RibbonILE_RuleArrayGet().Add(
__EXT_RIBBON_MAKE_RULE_ARRAY_ENTRY(
__EXT_RIBBON_ILE_MAX,
__EXT_RIBBON_ILV_SIMPLE_SMALL,
false
)
);
The
__EXT_RIBBON_MAKE_RULE_ARRAY_ENTRY
preprocessor function creates a mapping rule which contains the
__EXT_RIBBON_ILE_MAX
maximum effective info level, the
__EXT_RIBBON_ILV_SIMPLE_SMALL
small visual info level and a boolean wrap flag which determines whether the ribbon button is the last button it its column or row of buttons.