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


C++ CXTPToolBar类代码示例

本文整理汇总了C++中CXTPToolBar的典型用法代码示例。如果您正苦于以下问题:C++ CXTPToolBar类的具体用法?C++ CXTPToolBar怎么用?C++ CXTPToolBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CXTPToolBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnSelectionChanged

void CXTPCustomizeToolbarsPage::OnSelectionChanged()
{
	int nIndex = m_checkList.GetCurSel();

	if (nIndex != LB_ERR)
	{
		CXTPCommandBars* pCommandBars = m_pSheet->GetCommandBars();
		int i = (int)m_checkList.GetItemData(nIndex);

		if (i >= 0 && i < pCommandBars->GetCount())
		{
			CXTPToolBar* pToolBar = pCommandBars->GetAt(i);

			BOOL bBuiltIn = pToolBar->IsBuiltIn();
			m_btnReset.EnableWindow(bBuiltIn);
			m_btnRename.EnableWindow(!bBuiltIn);
			m_btnDelete.EnableWindow(!bBuiltIn);

		}
	}
	else
	{
		m_btnReset.EnableWindow(FALSE);
		m_btnRename.EnableWindow(FALSE);
		m_btnDelete.EnableWindow(FALSE);
	}
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:27,代码来源:XTPCustomizeToolbarsPage.cpp

示例2: OnDeleteToolbar

void CXTPCustomizeToolbarsPage::OnDeleteToolbar()
{
	int nIndex = m_checkList.GetCurSel();
	if (nIndex == LB_ERR)
		return;

	CXTPCommandBars* pCommandBars = m_pSheet->GetCommandBars();

	int i = (int)m_checkList.GetItemData(nIndex);
	if (i < 0 || i >= pCommandBars->GetCount())
		return;

	CXTPToolBar* pToolBar = pCommandBars->GetAt(i);

	if (pToolBar->IsBuiltIn())
		return;

	CString strMessage;

	CString strDelete;
	CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strDelete, XTP_IDS_CONFIRM_DELETE));
	strMessage.Format(strDelete, (LPCTSTR)pToolBar->GetTitle());

	if (m_pSheet->MessageBox(strMessage, MB_ICONWARNING | MB_OKCANCEL) == IDOK)
	{
		pCommandBars->GetSite()->SendMessage(WM_XTP_CUSTOMIZATION_DELETETOOLBAR, 0, (LPARAM)pToolBar);

		pCommandBars->Remove(pToolBar);
		RefreshToolbarsList();
	}
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:31,代码来源:XTPCustomizeToolbarsPage.cpp

示例3: OnRenameToolbar

void CXTPCustomizeToolbarsPage::OnRenameToolbar()
{
	int nIndex = m_checkList.GetCurSel();
	if (nIndex == LB_ERR)
		return;

	CXTPCommandBars* pCommandBars = m_pSheet->GetCommandBars();

	int i = (int)m_checkList.GetItemData(nIndex);
	if (i < 0 || i >= pCommandBars->GetCount())
		return;

	CXTPToolBar* pToolBar = pCommandBars->GetAt(i);

	if (pToolBar->IsBuiltIn())
		return;


	CXTPNewToolbarDlg dlg(m_pSheet, pCommandBars, pToolBar);
	if (dlg.DoModal() == IDOK)
	{
		pToolBar->SetTitle(dlg.m_strToolbar);

		m_checkList.DeleteString(nIndex);
		nIndex = m_checkList.InsertString(nIndex, pToolBar->GetTitle());
		m_checkList.SetCheck(nIndex, pToolBar->IsVisible());
		m_checkList.SetItemData(nIndex, i);
		m_checkList.SetCurSel(nIndex);

	}
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:31,代码来源:XTPCustomizeToolbarsPage.cpp

示例4: XTPResourceManager

void CXTPNewToolbarDlg::SetSuggestedName()
{
	CString szMsg;
	XTPResourceManager()->LoadString(&szMsg, XTP_IDS_CUSTOM_BAR);

	int iNewID = 1;
	CString strCustom;
	strCustom.Format(szMsg, iNewID);

	int nCount = m_pCommandBars->GetCount();
	int nIndex = 0;
	while (nIndex < nCount)
	{
		CXTPToolBar* pBar = m_pCommandBars->GetAt(nIndex);
		ASSERT(pBar != NULL);

		if (pBar && strCustom.Compare(pBar->GetTitle()) == 0)
		{
			strCustom.Format(szMsg, iNewID++);
			nIndex = 0;
			continue;
		}
		nIndex++;
	}

	m_strToolbar = strCustom;
	UpdateData(FALSE);
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:28,代码来源:XTPCustomizeTools.cpp

示例5: UpdateData

void CXTPNewToolbarDlg::OnOK()
{
	UpdateData();

	// If no text was entered, alert user.
	if (m_strToolbar.IsEmpty())
	{
		XTPResourceManager()->ShowMessageBox(XTP_IDS_ERROR_BLANKNAME, MB_ICONSTOP);
		return;
	}

	m_nNewID = AFX_IDW_CONTROLBAR_FIRST;

	// Loop through all of the existing control bars to find
	// an available ID to use.
	int nCount = m_pCommandBars->GetCount();
	int nIndex = 0;
	while (nIndex < nCount)
	{
		CXTPToolBar* pBar = m_pCommandBars->GetAt(nIndex);
		ASSERT(pBar != NULL);

		// We found a control bar with the same ID as m_nNewID, increment
		// m_nNewID and reset the position back to the head.
		if (pBar && m_pCommandBar == NULL && pBar->GetBarID() == m_nNewID)
		{
			m_nNewID++;

			// If m_nNewID is greater than the maximum number of allowed
			// custom commands, alert the user and abort.
			if ((int)m_nNewID >= AFX_IDW_CONTROLBAR_LAST)
			{
				XTPResourceManager()->ShowMessageBox(XTP_IDS_ERROR_LIMIT, MB_ICONSTOP);
				CDialog::OnCancel();
				return;
			}

			nIndex = 0;
			continue;
		}


		// Now check to see if the title for the toolbar has already
		// been used, if so, alert the user and return.
		if (pBar && m_pCommandBar != pBar && m_strToolbar.Compare(pBar->GetTitle()) == 0)
		{
			CString strName, strError;

			CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strError, XTP_IDS_ERROR_EXISTS));
			strName.Format(strError, (LPCTSTR)m_strToolbar);

			XTPResourceManager()->ShowMessageBox(strName, MB_ICONSTOP);
			return;
		}

		nIndex++;
	}

	CDialog::OnOK(); // success!
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:60,代码来源:XTPCustomizeTools.cpp

示例6: OnResetToolbar

void CXTPCustomizeToolbarsPage::OnResetToolbar()
{
	int nIndex = m_checkList.GetCurSel();
	if (nIndex == LB_ERR)
		return;

	CXTPCommandBars* pCommandBars = m_pSheet->GetCommandBars();

	int i = (int)m_checkList.GetItemData(nIndex);
	if (i < 0 || i >= pCommandBars->GetCount())
		return;

	CXTPToolBar* pToolBar = pCommandBars->GetAt(i);

	if (!pToolBar->IsBuiltIn())
		return;

	CString strMessage, strTitle = pToolBar->GetTitle(), strReset;

	CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strReset, XTP_IDS_CONFIRM_RESET));
	strMessage.Format(strReset, (LPCTSTR)strTitle);

	if (m_pSheet->MessageBox(strMessage, MB_ICONWARNING | MB_OKCANCEL) != IDOK)
		return;

	pToolBar->Reset(FALSE);
	RefreshToolbarsList();
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:28,代码来源:XTPCustomizeToolbarsPage.cpp

示例7: ASSERT

void CXTPDockBar::GetVisibleToolbars(int nPos, CToolBarArray& arrBars)
{
	ASSERT(nPos != -1);
	ASSERT(m_arrBars[nPos]);

	while (m_arrBars[nPos] != NULL && nPos > 0)
	{
		nPos--;
	}
	nPos++;

	CDockInfoArray arrInfo;

	while (m_arrBars[nPos] != NULL)
	{
		CXTPToolBar* pBar = m_arrBars[nPos++];
		if (pBar->IsVisible())
		{
			DOCK_INFO dockInfo(pBar, CXTPWindowRect(pBar), nPos);
			arrInfo.Add(dockInfo);
		}
	}

	if (m_dwStyle & CBRS_LEFT || m_dwStyle & CBRS_RIGHT) arrInfo.InvertRects();
	arrInfo.Sort();

	for (int i = 0; i < arrInfo.GetSize(); i++)
	{
		arrBars.Add(arrInfo[i].pBar);
	}

}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:32,代码来源:XTPDockBar.cpp

示例8: OnChkChange

void CXTPCustomizeToolbarsPage::OnChkChange()
{
	int nIndex = m_checkList.GetCurSel();
	if (nIndex == LB_ERR)
		return;

	CXTPCommandBars* pCommandBars = m_pSheet->GetCommandBars();
	int i = (int)m_checkList.GetItemData(nIndex);
	if (i >= 0 && i < pCommandBars->GetCount())
	{
		CXTPToolBar* pToolBar = pCommandBars->GetAt(i);
		if (!pToolBar->IsCloseable())
		{
			m_checkList.SetCheck(nIndex, 1);
			MessageBeep(0);

		}
		else
		{
			BOOL bVisible = m_checkList.GetCheck(nIndex);
			pToolBar->SetVisible(bVisible);
		}
	}
	RefreshToolbarsList();
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:25,代码来源:XTPCustomizeToolbarsPage.cpp

示例9: sizeFixed

CSize CXTPDockBar::CalcDynamicLayout(int nLength, DWORD nMode, AFX_SIZEPARENTPARAMS* lpLayout)
{
	BOOL bHorz = nMode & LM_HORZ;
	BOOL bStretch = nMode & LM_STRETCH;

	CSize sizeFixed (bStretch && bHorz ? 32767 : 0, bStretch && !bHorz ? 32767 : 0);

	BOOL bLayoutQuery = (lpLayout->hDWP == NULL);

	// prepare for layout
	AFX_SIZEPARENTPARAMS layout;
	layout.hDWP = bLayoutQuery ? 0 : ::BeginDeferWindowPos((int)m_arrBars.GetSize());

	CPoint pt(0, 0);
	// layout all the control bars
	for (int nPos = 0; nPos < m_arrBars.GetSize(); nPos++)
	{
		CToolBarArray lst;
		CXTPToolBar* pBar = GetDockedCommandBar(nPos);

		while (pBar)
		{
			if (pBar->IsVisible()) lst.Add(pBar);
			pBar = GetDockedCommandBar(++nPos);
		}

		int nWidth = 0;

		if (lst.GetSize() != 0)
		{
			nWidth = AdjustRow(lst, pt, nLength, bHorz, &layout);
			lst.RemoveAll();
		}
		if (pBar == NULL && nWidth != 0)
		{
			// end of row because pBar == NULL
			if (bHorz)
			{
				pt.y += nWidth;
				sizeFixed.cy = max(sizeFixed.cy, pt.y);
			}
			else
			{
				pt.x += nWidth;
				sizeFixed.cx = max(sizeFixed.cx, pt.x);
			}
		}
	}
	if (!bLayoutQuery)
	{
		// move and resize all the windows at once!
		if (layout.hDWP == NULL || !::EndDeferWindowPos(layout.hDWP))
			TRACE0("Warning: DeferWindowPos failed - low system resources.\n");
	}

	return sizeFixed;
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:57,代码来源:XTPDockBar.cpp

示例10: GetDockedCommandBar

int CXTPDockBar::GetDockedVisibleCount() const
{
	int nCount = 0;
	for (int i = 0; i < m_arrBars.GetSize(); i++)
	{
		CXTPToolBar* pBar = GetDockedCommandBar(i);
		if (pBar != NULL && pBar->IsVisible())
			nCount++;
	}
	return nCount;
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:11,代码来源:XTPDockBar.cpp

示例11: ASSERT_VALID

int CXTPDockBar::Insert(CXTPToolBar* pBarIns, CRect /*rect*/, CPoint ptMid)
{
	ASSERT_VALID(this);
	ASSERT(pBarIns != NULL);

	int nPos = 0;
	int nPosInsAfter = 0;
	int nWidth = 0;
	int nTotalWidth = 0;
	//int nPosInsBefore = 0;
	BOOL bHorz = m_dwStyle & CBRS_ORIENT_HORZ;
	BOOL bAllowTopMost = pBarIns->IsRibbonBar() || m_pCommandBars->GetMenuBar() == NULL ||
		!m_pCommandBars->GetMenuBar()->IsRibbonBar() || FindBar(m_pCommandBars->GetMenuBar()) == -1;

	for (nPos = 0; nPos < m_arrBars.GetSize(); nPos++)
	{
		CXTPToolBar* pBar = GetDockedCommandBar(nPos);
		if (pBar && !pBar->IsVisible())
			continue;

		if (pBar != NULL)
		{
			CRect rectBar;
			pBar->GetWindowRect(&rectBar);
			ScreenToClient(&rectBar);
			nWidth = max(nWidth,
				bHorz ? rectBar.bottom : rectBar.right);
		}
		else // end of row because pBar == NULL
		{
			if ((bHorz ? ptMid.y : ptMid.x) < nWidth && (bAllowTopMost || nPosInsAfter > 1))
			{
				if (nPos == 0 || ((bHorz ? ptMid.y : ptMid.x) == nTotalWidth)) // first section
					m_arrBars.InsertAt(nPosInsAfter + 1, (CXTPToolBar*)NULL);
				m_arrBars.InsertAt(nPosInsAfter + 1, pBarIns);

				return nPosInsAfter + 1;
			}
			nTotalWidth = nWidth;
			nWidth = 0;
			nPosInsAfter = nPos;
		}
	}

	// create a new row
	m_arrBars.InsertAt(nPosInsAfter + 1, (CXTPToolBar*)NULL);
	m_arrBars.InsertAt(nPosInsAfter + 1, pBarIns);

	return nPosInsAfter + 1;
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:50,代码来源:XTPDockBar.cpp

示例12: FindChildWindow

CWnd* CXTPControlCustom::FindChildWindow(CXTPCommandBars* pCommandBars, UINT nID)
{
	CWnd* pWndSite = pCommandBars->GetSite();

	if (pWndSite->GetDlgItem(nID) != NULL)
		return pWndSite->GetDlgItem(nID);

	for (int i = 0; i < pCommandBars->GetCount(); i++)
	{
		CXTPToolBar* pToolBar = pCommandBars->GetAt(i);

		if (pToolBar->GetDlgItem(nID) != NULL)
			return pToolBar->GetDlgItem(nID);
	}


	return NULL;
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:18,代码来源:XTPControlCustom.cpp

示例13: VERIFY

void gkToolBarPaneBase::InitToolBar( const TCHAR* toolbarname, DWORD nId )
{
	//////////////////////////////////////////////////////////////////////////
	// ToolBar Initilizing
	VERIFY(InitCommandBars());

	CXTPCommandBars* pCommandBars = GetCommandBars();
	pCommandBars->GetImageManager()->SetIcons(nId);
	pCommandBars->SetTheme(xtpThemeWhidbey);
	//pCommandBars->SetQuickCustomizeMode(FALSE);

	//TCHAR toolbarname = 
	CXTPToolBar* pToolBar = pCommandBars->Add(toolbarname, xtpBarTop);
	pToolBar->SetDefaultButtonStyle(xtpButtonIcon);
	pToolBar->LoadToolBar(nId);

 	pToolBar->SetCloseable(FALSE);
 	pToolBar->EnableCustomization();

	pToolBar->GetControls()->CreateOriginalControls();
	pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues(xtpKeyboardCuesShowWindowsDefault);
	pCommandBars->GetToolTipContext()->SetStyle(xtpToolTipOffice2007);

	RecalcLayout();
	//////////////////////////////////////////////////////////////////////////
}
开发者ID:CheryJazz,项目名称:gkEngine,代码行数:26,代码来源:gkToolBarPaneBase.cpp

示例14: ASSERT

void CAlphaIconsPage::OnActivate()
{
	CXTPFrameWnd* pFrame = (CXTPFrameWnd*)AfxGetMainWnd();
	CXTPCommandBars* pCommandBars = pFrame->GetCommandBars();

	ASSERT(pCommandBars);

	CXTPToolBar* pToolBar = pCommandBars->GetAt(1);
	ASSERT(pToolBar->GetTitle() == _T("Standard"));


	XTPImageManager()->RemoveAll();
	pToolBar->LoadToolBar(IDR_ICONS_MENU_32);

	XTP_COMMANDBARS_ICONSINFO* pIconsInfo = XTPPaintManager()->GetIconsInfo();
	pIconsInfo->bUseDisabledIcons = TRUE;

	CXTPCommandBarsOptions* pOptions = pCommandBars->GetCommandBarsOptions();
	pOptions->szIcons = CSize(16, 16);
	pOptions->szLargeIcons = CSize (42, 35);
	pOptions->bLargeIcons = FALSE;

	XTPImageManager()->SetIcons(IDR_ICONS_TOOLBAR_32);


	if (!XTPImageManager()->IsAlphaIconsSupported())
	{
		m_bResample = TRUE;
		GetDlgItem(IDC_CHECK_RESAMPLE)->EnableWindow(FALSE);
		UpdateData(FALSE);
	}

	ResampleImages();

	UpdateContent();
}
开发者ID:chenbk85,项目名称:job_mobile,代码行数:36,代码来源:AlphaIconsPage.cpp

示例15: RefreshToolbarsList

void CXTPCustomizeToolbarsPage::RefreshToolbarsList()
{
	int nIndexSel = 0;
	int nIndex = m_checkList.GetCurSel();
	if (nIndex != LB_ERR)
	{
		nIndexSel = (int)m_checkList.GetItemData(nIndex);
	}
	int nTopIndex = m_checkList.GetTopIndex();

	m_checkList.ResetContent();

	CXTPCommandBars* pCommandBars = m_pSheet->GetCommandBars();
	int nCount = pCommandBars->GetCount();
	for (int i = 0; i < nCount; i++)
	{
		CXTPToolBar* pToolBar = pCommandBars->GetAt(i);

		if (!pToolBar->IsCustomizeDialogPresent())
			continue;

		if (!pToolBar->IsCloseable() && !pToolBar->IsVisible())
			continue;

		nIndex = m_checkList.AddString(pToolBar->GetTitle());
		m_checkList.SetCheck(nIndex, pToolBar->IsVisible());
		m_checkList.SetItemData(nIndex, i);

		if (i == nIndexSel) m_checkList.SetCurSel(nIndex);
	}

	if (m_checkList.GetTopIndex() != nTopIndex)
		m_checkList.SetTopIndex(nTopIndex);

	OnSelectionChanged();
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:36,代码来源:XTPCustomizeToolbarsPage.cpp


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