当前位置: 首页>>代码示例>>C++>>正文


C++ GetToolBarCtrl函数代码示例

本文整理汇总了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);
}
开发者ID:ijprest,项目名称:WinDjVu,代码行数:27,代码来源:MyToolBar.cpp

示例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;	
}
开发者ID:BlackMoon,项目名称:logread,代码行数:31,代码来源:ctrl.cpp

示例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);
}
开发者ID:BackupTheBerlios,项目名称:sfsipua-svn,代码行数:26,代码来源:FormatBar.cpp

示例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;
}
开发者ID:pedia,项目名称:raidget,代码行数:30,代码来源:toolbarex.cpp

示例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);
}
开发者ID:leiqunni,项目名称:STEP_Unicode,代码行数:10,代码来源:DkToolBar.cpp

示例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;
}
开发者ID:likebeta,项目名称:code-snippets,代码行数:55,代码来源:ToolBarXP.cpp

示例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;
}
开发者ID:Kerlifw,项目名称:pcman-windows,代码行数:54,代码来源:SearchBar.cpp

示例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);
        }
    }
}
开发者ID:jithuin,项目名称:infogeezer,代码行数:52,代码来源:RRECToolbar.cpp

示例9: GetToolBarCtrl

int CMainToolBar::HitTestButton(CPoint &pt) {
  int index = GetToolBarCtrl().HitTest(&pt);
  if (index >= 0)
    return GetItemID(index);

  return index;
}
开发者ID:avrionov,项目名称:explorerxp,代码行数:7,代码来源:MainToolBar.cpp

示例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;
}
开发者ID:hkaiser,项目名称:TRiAS,代码行数:25,代码来源:TRiASToolBar.cpp

示例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]);
}
开发者ID:pwsafe,项目名称:pwsafe,代码行数:7,代码来源:PWFindToolBar.cpp

示例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;
}
开发者ID:moodboom,项目名称:Reusable,代码行数:28,代码来源:ToolBarEx.cpp

示例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
}
开发者ID:KyleSanderson,项目名称:mpc-hc,代码行数:35,代码来源:PlayerToolBar.cpp

示例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);
}
开发者ID:fxfile,项目名称:fxfile,代码行数:28,代码来源:bookmark_toolbar.cpp

示例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
  }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:26,代码来源:Toolbars.cpp


注:本文中的GetToolBarCtrl函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。