本文整理汇总了C++中GetToolBarCtrl函数的典型用法代码示例。如果您正苦于以下问题:C++ GetToolBarCtrl函数的具体用法?C++ GetToolBarCtrl怎么用?C++ GetToolBarCtrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetToolBarCtrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadString
void CMyToolBar::InsertLabel(int nPos, UINT nID, CFont* pFont)
{
Label label;
label.nID = nID;
label.strText = LoadString(nID);
label.pFont = pFont;
m_labels.push_back(label);
CScreenDC dcScreen;
CFont* pOldFont = dcScreen.SelectObject(pFont);
int nWidth = dcScreen.GetTextExtent(label.strText).cx + 3;
dcScreen.SelectObject(pOldFont);
TBBUTTON btn;
ZeroMemory(&btn, sizeof(btn));
btn.idCommand = nID;
btn.fsStyle = TBSTYLE_BUTTON;
TBBUTTONINFO info;
ZeroMemory(&info, sizeof(info));
info.cbSize = sizeof(info);
info.dwMask = TBIF_SIZE;
info.cx = nWidth;
GetToolBarCtrl().InsertButton(nPos, &btn);
GetToolBarCtrl().SetButtonInfo(nID, &info);
}
示例2: ASSERT_VALID
CWnd* CToolBarEx::InsertControl(CWnd* pCtrl, RECT& rect, UINT nID)
{
ASSERT_VALID(pCtrl);
// make sure the id is valid, and set the button style for a seperator.
int nState, nIndex = CommandToIndex(nID);
if (nIndex > -1)
{
ASSERT(nIndex >= 0);
SetButtonInfo(nIndex, nID, TBBS_SEPARATOR, rect.right - rect.left);
// insert the control into the toolbar.
GetItemRect(nIndex, &rect);
pCtrl->SetWindowPos(0, rect.left, rect.top, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS);
pCtrl->SetFont(GetFont());
BOOL bVert = (m_dwStyle & CBRS_ORIENT_VERT) != 0;
if (bVert)
{
nState = GetToolBarCtrl().GetState(nIndex);
GetToolBarCtrl().SetState(nID,(nState | TBSTATE_HIDDEN));
pCtrl->ShowWindow(SW_HIDE);
}
else
{
nState = GetToolBarCtrl().GetState(nIndex);
GetToolBarCtrl().SetState(nIndex,(nState & ~TBSTATE_HIDDEN));
pCtrl->ShowWindow(SW_SHOW);
}
}
else pCtrl->ShowWindow(SW_HIDE);
return pCtrl;
}
示例3: GetDlgCtrlID
void CFormatBar::SyncToView()
{
// get the current font from the view and update
CHARHDR fh;
CHARFORMAT& cf = fh.cf;
cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | CFM_FACE | CFM_SIZE;
fh.hwndFrom = m_hWnd;
fh.idFrom = GetDlgCtrlID();
fh.code = FN_GETFORMAT;
CWnd *pWnd = GetOwner();
VERIFY(GetOwner()->SendMessage(WM_NOTIFY, fh.idFrom, (LPARAM)&fh));
GetToolBarCtrl().CheckButton(ID_CHAR_BOLD, cf.dwEffects & CFE_BOLD);
GetToolBarCtrl().CheckButton(ID_CHAR_ITALIC, cf.dwEffects & CFE_ITALIC);
GetToolBarCtrl().CheckButton(ID_CHAR_UNDERLINE, cf.dwEffects & CFE_UNDERLINE);
// the selection must be same font and charset to display correctly
if ((cf.dwMask & (CFM_FACE|CFM_CHARSET)) == (CFM_FACE|CFM_CHARSET))
m_comboFontName.MatchFont(cf.szFaceName, cf.bCharSet);
else
m_comboFontName.SetTheText(_T(""));
// SetTwipSize only updates if different
// -1 means selection is not a single point size
m_comboFontSize.SetTwipSize( (cf.dwMask & CFM_SIZE) ? cf.yHeight : -1);
}
示例4: GetToolBarCtrl
BOOL CToolBarEx::ShowGroup(int iGrp, int iWhere)
{
if (iGrp >= m_vGroups.size ())
return FALSE;
fs::list <fsTBInfo> *pGroup = &m_vGroups [iGrp];
for (int i = 0; i < pGroup->size (); i++)
{
fsTBInfo *tb = &pGroup->at (i);
TBBUTTON btn;
btn.dwData = iGrp;
btn.fsState = TBSTATE_ENABLED;
btn.fsStyle = tb->bStyle;
btn.iBitmap = tb->iImage;
btn.idCommand = tb->idCommand;
btn.iString = tb->iName;
GetToolBarCtrl ().InsertButton (iWhere++, &btn);
}
GetToolBarCtrl().AutoSize();
UpdateSize ();
return TRUE;
}
示例5: ZeroMemory
void CDkToolBar::UpdateButtonImage()
{
TBBUTTONINFO tbbi;
ZeroMemory(&tbbi, sizeof(TBBUTTONINFO));
tbbi.cbSize = sizeof(TBBUTTONINFO);
tbbi.dwMask = TBIF_IMAGE;
GetToolBarCtrl().GetButtonInfo(ID_CONV_FORMAT_USER, &tbbi);
tbbi.iImage = nDyImageIndex + g_nUserConvFormatType;
GetToolBarCtrl().SetButtonInfo(ID_CONV_FORMAT_USER, &tbbi);
}
示例6: DefWindowProc
CSize CToolBarXP::CalcDynamicLayout (int nLength, DWORD dwMode)
{
bool bHideControls = (dwMode & LM_VERTDOCK) == LM_VERTDOCK;
m_bCheckVisibility = (BYTE)(bHideControls ? 1 : 2);
CSize size = CToolBar::CalcDynamicLayout (nLength, dwMode);
m_bCheckVisibility = false;
if ( dwMode & LM_COMMIT )
{
TBBUTTON tbbutton;
int nCount = DefWindowProc (TB_BUTTONCOUNT, 0, 0);
for ( int i = 0; i < nCount; i++ )
{
VERIFY(DefWindowProc (TB_GETBUTTON, i, (LPARAM)&tbbutton));
if ( !IS_CONTROL(tbbutton) )
{
continue;
}
CWnd* pWnd = GetDlgItem (tbbutton.idCommand);
if ( pWnd == NULL )
{
continue;
}
if ( bHideControls )
{
GetToolBarCtrl().HideButton (tbbutton.idCommand, true);
pWnd->ShowWindow (SW_HIDE);
}
else
{
GetToolBarCtrl().HideButton (tbbutton.idCommand, false);
// Update control position
CRect rcControl;
VERIFY (DefWindowProc (TB_GETITEMRECT, i, (LPARAM)&rcControl));
rcControl.DeflateRect (1, 1);
CWindowRect rcCtrl (pWnd);
int nNoSize = 0;
if ( rcControl.Width() == rcCtrl.Width() )
{
nNoSize = SWP_NOSIZE;
}
pWnd->SetWindowPos (NULL, rcControl.left, rcControl.top, rcControl.Width(), rcControl.Height(),
nNoSize|SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW);
}
}
}
return size;
}
示例7: GetToolBarCtrl
int CSearchBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CToolBar::OnCreate(lpCreateStruct) == -1)
return -1;
GetToolBarCtrl().SetBitmapSize(CSize(16, 16));
LPCTSTR cls_name;
if (riched20)
cls_name = "RichEdit20A";
else
cls_name = "EDIT";
hedit = CreateWindowEx(WS_EX_CLIENTEDGE, cls_name, NULL, ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE,
0, 0, 0, 0, m_hWnd, NULL, AfxGetInstanceHandle(), NULL);
if (riched20)
{
::SendMessage(hedit, EM_SETTEXTMODE, TM_PLAINTEXT | TM_MULTICODEPAGE, 0);
::SendMessage(hedit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELPARAM(2, 2));
::SendMessage(hedit, EM_SETUNDOLIMIT, 1, 0);
}
old_search_bar_proc = (WNDPROC)::GetWindowLong(hedit, GWL_WNDPROC);
::SetWindowLong(hedit, GWL_WNDPROC, (LONG)EditProc);
::SetWindowLong(hedit, GWL_USERDATA, (LONG)this);
CToolBarCtrl& toolbar = GetToolBarCtrl();
toolbar.AddButtons(1, searchbar_btns);
toolbar.SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
toolbar.SetIndent(100);
toolbar.AutoSize();
int n = SearchPluginCollection.GetCount();
if (n > 0)
{
for (int i = 0; i < n; ++i)
{
HBITMAP hbmp = SearchPluginCollection.GetImage(i);
if (hbmp)
{
TBADDBITMAP tbab;
tbab.hInst = NULL;
tbab.nID = (UINT)hbmp;
::SendMessage(toolbar.m_hWnd, TB_ADDBITMAP, 1, (LPARAM)&tbab);
}
}
}
UpdateBtn();
EnableToolTips();
return 0;
}
示例8: GetToolBarCtrl
void CRRECToolBar::OnSize(UINT nType, int cx, int cy)
{
GetToolBarCtrl().SetButtonSize(m_sizeButton);
CEnToolBar::OnSize(nType, cx, cy);
CSize size(GetToolBarCtrl().GetButtonSize());
if (m_font.GetSafeHwnd())
{
CRect rDiv;
// calc length after which we want to start shortening ctrls
GetItemRect(1, &rDiv); // divider
const int DEFCTRLSWIDTH = FONT_COMBO_WIDTH + SIZE_COMBO_WIDTH +
(5 * rDiv.Width()) / 2; // 2.5 separators
// if the toolbar length is less than the default
// width of the embedded widgets we reduce the
// font combo as far as we can.
TBBUTTONINFO tbi;
tbi.cbSize = sizeof( TBBUTTONINFO );
tbi.dwMask = TBIF_SIZE; // By index
CRect rect;
GetItemRect( FONT_NAME_POS, &rect );
rect.left++;
rect.top++;
rect.bottom += COMBO_HEIGHT;
int nNewWidth = FONT_COMBO_WIDTH - max(0, DEFCTRLSWIDTH - cx);
nNewWidth = max(nNewWidth, MIN_FONT_COMBO_WIDTH);
if (nNewWidth != rect.Width())
{
rect.right = rect.left + nNewWidth;
rect.bottom += COMBO_HEIGHT;
m_font.MoveWindow(rect);
// update toolbar item size also
tbi.cx = (WORD)rect.Width();
GetToolBarCtrl().SetButtonInfo(FONT_NAME_ID, &tbi);
// move the other two items to suit their toolbar rects
GetItemRect(FONT_SIZE_POS, &rect);
rect.top++;
rect.bottom += COMBO_HEIGHT;
m_size.MoveWindow(rect);
}
}
}
示例9: GetToolBarCtrl
int CMainToolBar::HitTestButton(CPoint &pt) {
int index = GetToolBarCtrl().HitTest(&pt);
if (index >= 0)
return GetItemID(index);
return index;
}
示例10: AFX_MANAGE_STATE
HRESULT CTRiASToolBar::DeleteItem (int iIndex)
{
AFX_MANAGE_STATE(AfxGetModuleState());
ASSERT_VALID(this);
ASSERT(::IsWindow(m_hWnd));
TBBUTTON button;
_GetButtonEx (iIndex, &button);
if (0 != button.idCommand && !m_Owners.erase (button.idCommand))
return E_FAIL;
#if !defined(_USE_SEC_CLASSES)
CToolBarCtrl &rTB = GetToolBarCtrl();
HRESULT hr = rTB.DeleteButton (iIndex) ? NOERROR : S_FALSE;
#else
HRESULT hr = m_pMainFrm -> DeleteButton (this, iIndex);
#endif // _USE_SEC_CLASSES
if (S_OK == hr && IsWindowVisible())
m_pMainFrm -> DelayRecalcLayout();
return hr;
}
示例11: GetToolBarCtrl
void CPWFindToolBar::ChangeImages(const int toolbarMode)
{
CToolBarCtrl& tbCtrl = GetToolBarCtrl();
m_toolbarMode = toolbarMode;
const int nImageListNum = (m_toolbarMode == ID_MENUITEM_OLD_TOOLBAR) ? 0 : m_bitmode;
tbCtrl.SetImageList(&m_ImageLists[nImageListNum]);
}
示例12: GetToolBarCtrl
void CToolBarEx::OnReset( NMHDR* /*pNMHDR*/, LRESULT* pResult )
{
// Delete all buttons
CToolBarCtrl& tbCtrl = GetToolBarCtrl();
while ( tbCtrl.DeleteButton( 0 ) );
// Load buttons from internal cache
for ( int nIndex = 0; nIndex <= m_aButtons.GetUpperBound(); nIndex++ )
{
if ( m_aButtons[ nIndex ].bInitiallyVisible )
{
VERIFY( tbCtrl.AddButtons( 1, &m_aButtons[ nIndex ].tbinfo ) );
}
}
// Set default text & icon options
SetIconOptions( m_eIconOptionsDefault, false );
SetTextOptions( m_eTextOptionsDefault, false );
ReloadButtons();
UpdateParentBandInfo();
// Synchronize with Customize dialog
ASSERT( m_pCustomizeDlg != 0 );
m_pCustomizeDlg->SetTextOptions( m_eTextOptions, true );
m_pCustomizeDlg->SetIconOptions( m_eIconOptions, true );
*pResult = 0;
}
示例13: GetToolBarCtrl
BOOL CPlayerToolBar::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
{
TOOLTIPTEXT* pTTT = (TOOLTIPTEXT*)pNMHDR;
UINT_PTR nID = pNMHDR->idFrom;
if (pTTT->uFlags & TTF_IDISHWND) {
nID = ::GetDlgCtrlID((HWND)nID);
}
if (nID != ID_VOLUME_MUTE) {
return FALSE;
}
CToolBarCtrl& tb = GetToolBarCtrl();
TBBUTTONINFO bi;
bi.cbSize = sizeof(bi);
bi.dwMask = TBIF_IMAGE;
tb.GetButtonInfo(ID_VOLUME_MUTE, &bi);
static CString strTipText;
if (bi.iImage == 12) {
strTipText.LoadString(ID_VOLUME_MUTE);
} else if (bi.iImage == 13) {
strTipText.LoadString(ID_VOLUME_MUTE_ON);
} else if (bi.iImage == 14) {
strTipText.LoadString(ID_VOLUME_MUTE_DISABLED);
} else {
return FALSE;
}
pTTT->lpszText = (LPWSTR)(LPCWSTR)strTipText;
*pResult = 0;
return TRUE; // message was handled
}
示例14: GetCursorPos
xpr_bool_t BookmarkToolBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR *pnmhdr = (NMHDR *)lParam;
if (pnmhdr->code == TTN_GETDISPINFO)
{
if (gOpt->mConfig.mBookmarkTooltip == XPR_TRUE)
{
LPNMTTDISPINFO sNmTtDispInfo = (LPNMTTDISPINFO)pnmhdr;
CPoint sPoint;
GetCursorPos(&sPoint);
ScreenToClient(&sPoint);
xpr_sint_t sIndex = GetToolBarCtrl().HitTest(&sPoint);
BookmarkItem *sBookmarkItem = BookmarkMgr::instance().getBookmark(sIndex);
if (sBookmarkItem == XPR_NULL)
return XPR_FALSE;
sBookmarkItem->getTooltip(mToolTipText, !gOpt->mMain.mBookmarkBarText, XPR_TRUE);
sNmTtDispInfo->lpszText = mToolTipText;
}
}
return super::OnNotify(wParam, lParam, pResult);
}
示例15: GetToolBarCtrl
void CDynToolBar::ChangeButtonIDS(UINT ID1, UINT ID2, UINT IDRQD)
{
if (bCanConfigure)
{
CToolBarCtrl& bc = GetToolBarCtrl();
int Cnt = bc.GetButtonCount();
BOOL Chngd = FALSE;
UINT* NewIDs = new UINT[Cnt];
Strng Item;
for (int i=0; i<Cnt; i++)
{
TBBUTTON B;
bc.GetButton(i, &B);
NewIDs[i]=B.idCommand;
if (B.idCommand==(int)ID1 || B.idCommand==(int)ID2)
{
Chngd=true;
NewIDs[i]=IDRQD;
}
}
if (Chngd)
ChangeButtons(NewIDs, Cnt);
delete []NewIDs;
}
// the toolbar has changed
}