本文整理汇总了C++中ItemPtr::description方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemPtr::description方法的具体用法?C++ ItemPtr::description怎么用?C++ ItemPtr::description使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemPtr
的用法示例。
在下文中一共展示了ItemPtr::description方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAction
void Toolbar::updateAction( unsigned int& index, ItemPtr item, TBBUTTONINFO& info )
{
unsigned int mask = BTNS_SEP | BTNS_CHECK | BTNS_GROUP | BTNS_CHECKGROUP | BTNS_DROPDOWN;
if( ( info.fsStyle & mask ) != 0 || // not a push button
info.idCommand != item->commandID() ) // not for me
{
TBBUTTON button;
memset( &button, 0, sizeof(button) );
button.iBitmap = getImageIndex( item );
button.idCommand = item->commandID();
button.fsState = TBSTATE_ENABLED;
button.fsStyle = BTNS_BUTTON;
button.dwData = 0;
button.iString = -1;
sendMessage( TB_INSERTBUTTON, index, (LPARAM)&button );
}
TBBUTTONINFO buttonInfo = { sizeof( buttonInfo ), TBIF_TEXT | TBIF_BYINDEX | TBIF_STATE };
std::string tooltip = item->description(); // auto tooltip
if( item->shortcutKey().size() )
{
tooltip += " (";
tooltip += item->shortcutKey();
tooltip += ')';
}
buttonInfo.pszText = &tooltip[0];
buttonInfo.fsState = item->update() && isEnabled() ? TBSTATE_ENABLED : 0;
if ( sendMessage( WM_CGUITOOLBAR_USE_WRAP, 0, 0 ) &&
( info.fsState & TBSTATE_WRAP ) )
buttonInfo.fsState |= TBSTATE_WRAP;
if( forceChanged_ || info.pszText != tooltip || info.fsState != buttonInfo.fsState )
sendMessage( TB_SETBUTTONINFO, index, (LPARAM)&buttonInfo );
}
示例2: updateToggle
void Toolbar::updateToggle( unsigned int& index, ItemPtr item, TBBUTTONINFO& info )
{
if( ( info.fsStyle & BTNS_CHECK ) == 0 || // not a toggle button
info.idCommand != item->commandID() ) // not for me
{
TBBUTTON button;
memset( &button, 0, sizeof(button) );
button.iBitmap = getImageIndex( item );
button.idCommand = item->commandID();
button.fsState = TBSTATE_ENABLED;
button.fsStyle = BTNS_CHECK;
button.dwData = (DWORD)item.getObject();
button.iString = -1;
sendMessage( TB_INSERTBUTTON, index, (LPARAM)&button );
}
TBBUTTONINFO buttonInfo = { sizeof( buttonInfo ), TBIF_TEXT | TBIF_BYINDEX | TBIF_STATE };
std::string tooltip = item->description(); // auto tooltip
if( item->shortcutKey().size() )
{
tooltip += " (";
tooltip += item->shortcutKey();
tooltip += ')';
}
buttonInfo.pszText = &tooltip[0];
LPARAM enabled = item->update() && isEnabled() ? TBSTATE_ENABLED : 0;
LPARAM checked = ( *item )[ 0 ]->update() ? 0 : TBSTATE_CHECKED;
if( !enabled )
checked = 0;
buttonInfo.fsState = (BYTE)( enabled | checked );
if ( sendMessage( WM_CGUITOOLBAR_USE_WRAP, 0, 0 ) &&
( info.fsState & TBSTATE_WRAP ) )
buttonInfo.fsState |= TBSTATE_WRAP;
if( forceChanged_ || info.pszText != tooltip || info.fsState != buttonInfo.fsState )
sendMessage( TB_SETBUTTONINFO, index, (LPARAM)&buttonInfo );
}
示例3: updateChoice
void Toolbar::updateChoice( unsigned int& index, ItemPtr item, TBBUTTONINFO& info )
{
unsigned int i = 0;
while( index < (unsigned int)sendMessage( TB_BUTTONCOUNT, 0, 0 ) &&
i < item->num() )
{
static const unsigned int MAX_MENU_TEXT = 1024;
char txtBuf[ MAX_MENU_TEXT + 1 ];
TBBUTTONINFO info = { sizeof( info ), TBIF_BYINDEX | TBIF_COMMAND | TBIF_IMAGE
| TBIF_LPARAM | TBIF_SIZE | TBIF_STATE | TBIF_STYLE | TBIF_TEXT };
info.pszText = txtBuf;
info.cchText = MAX_MENU_TEXT;
sendMessage( TB_GETBUTTONINFO, index, (LPARAM)&info );
ItemPtr subItem = (*item)[ i ];
if( ( info.fsStyle & BTNS_CHECK ) == 0 || // not a toggle button
info.idCommand != subItem->commandID() ) // not for me
{
TBBUTTON button;
memset( &button, 0, sizeof(button) );
button.iBitmap = getImageIndex( subItem );
button.idCommand = subItem->commandID();
button.fsState = TBSTATE_ENABLED;
button.fsStyle = BTNS_CHECK;
button.dwData = 0;
button.iString = -1;
sendMessage( TB_INSERTBUTTON, index, (LPARAM)&button );
}
TBBUTTONINFO buttonInfo = { sizeof( buttonInfo ), TBIF_TEXT | TBIF_BYINDEX | TBIF_STATE };
std::string tooltip = subItem->description(); // auto tooltip
if( subItem->shortcutKey().size() || item->shortcutKey().size() )
{
if (subItem->shortcutKey().size() && item->shortcutKey().size())
{
tooltip =
L
(
"GUIMANAGER/GUI_TOOLBAR/TOOLTIP_FORM0",
subItem->description(),
subItem->shortcutKey(),
item->shortcutKey()
);
}
else if (subItem->shortcutKey().size())
{
tooltip =
L
(
"GUIMANAGER/GUI_TOOLBAR/TOOLTIP_FORM1",
subItem->description(),
subItem->shortcutKey()
);
}
else if (item->shortcutKey().size())
{
tooltip =
L
(
"GUIMANAGER/GUI_TOOLBAR/TOOLTIP_FORM2",
subItem->description(),
item->shortcutKey()
);
}
}
buttonInfo.pszText = &tooltip[0];
LPARAM enabled = item->update() && isEnabled() ? TBSTATE_ENABLED : 0;
LPARAM checked = subItem->update() ? TBSTATE_CHECKED : 0;
if( !enabled )
checked = 0;
buttonInfo.fsState = (BYTE)( enabled | checked );
if ( sendMessage( WM_CGUITOOLBAR_USE_WRAP, 0, 0 ) &&
( info.fsState & TBSTATE_WRAP ) )
buttonInfo.fsState |= TBSTATE_WRAP;
if( forceChanged_ || info.pszText != tooltip || info.fsState != buttonInfo.fsState )
sendMessage( TB_SETBUTTONINFO, index, (LPARAM)&buttonInfo );
++i;
++index;
}
while( i < item->num() )
{
ItemPtr subItem = (*item)[ i ];
TBBUTTON button;
memset( &button, 0, sizeof(button) );
button.iBitmap = getImageIndex( subItem );
button.idCommand = subItem->commandID();
button.fsState = TBSTATE_ENABLED;
button.fsStyle = BTNS_CHECK;
button.dwData = 0;
button.iString = -1;
sendMessage( TB_INSERTBUTTON, index, (LPARAM)&button );
TBBUTTONINFO buttonInfo = { sizeof( buttonInfo ), TBIF_TEXT | TBIF_BYINDEX | TBIF_STATE };
std::string tooltip = subItem->description(); // auto tooltip
if( subItem->shortcutKey().size() || item->shortcutKey().size() )
{
//.........这里部分代码省略.........