Пример #1
0
BOOL CBCGPRibbonItemDlg::OnInitDialog() 
{
	CBCGPDialog::OnInitDialog();

	CBCGPStaticLayout* pLayout = (CBCGPStaticLayout*)GetLayout ();
	if (pLayout != NULL)
	{
		pLayout->AddAnchor (IDC_BCGBARRES_IMAGE_LIST, CBCGPStaticLayout::e_MoveTypeNone, CBCGPStaticLayout::e_SizeTypeBoth, CSize(0, 0), CSize(100, 100));
		pLayout->AddAnchor (IDD_BCGBAR_RES_LABEL1, CBCGPStaticLayout::e_MoveTypeVert, CBCGPStaticLayout::e_SizeTypeNone, CSize(50, 100));
		pLayout->AddAnchor (IDC_BCGBARRES_NAME, CBCGPStaticLayout::e_MoveTypeVert, CBCGPStaticLayout::e_SizeTypeHorz, CSize(50, 100), CSize(100, 100));
		pLayout->AddAnchor (IDOK, CBCGPStaticLayout::e_MoveTypeBoth, CBCGPStaticLayout::e_SizeTypeNone, CSize(100, 100));
		pLayout->AddAnchor (IDCANCEL, CBCGPStaticLayout::e_MoveTypeBoth, CBCGPStaticLayout::e_SizeTypeNone, CSize(100, 100));
	}
	
	m_wndImageList.SetImages(&m_images);
	
	int nCount = m_images.GetCount ();

	for (int iImage = 0; iImage < nCount; iImage++)
	{
		CBCGPToolbarButton* pButton = new CBCGPToolbarButton;

		pButton->SetImage (iImage);

		m_wndImageList.AddButton (pButton);
		m_Buttons.AddTail (pButton);
	}

	m_wndImageList.SelectButton (m_iSelImage);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #2
0
//*********************************************************************************
void CBCGPPrintPreviewView::OnUpdatePreviewNumPage(CCmdUI *pCmdUI) 
{
	CPreviewView::OnUpdateNumPageChange(pCmdUI);

	//--------------------------------------------------
	// Change the Icon of AFX_ID_PREVIEW_NUMPAGE button:
	//--------------------------------------------------
	UINT nPages = m_nZoomState == ZOOM_OUT ? m_nPages : m_nZoomOutPages;

#ifndef BCGP_EXCLUDE_RIBBON
	if (m_pWndRibbonBar != NULL && m_pWndRibbonBar->IsVisible())
	{
		ASSERT_VALID (m_pWndRibbonBar);

		if (m_pNumPageButton == NULL)
		{
			m_pNumPageButton = DYNAMIC_DOWNCAST (
				CBCGPRibbonButton,
				m_pWndRibbonBar->GetActiveCategory ()->FindByID (AFX_ID_PREVIEW_NUMPAGE));
		}

		if (m_pNumPageButton != NULL)
		{
			ASSERT_VALID (m_pNumPageButton);

			int nImageIndex = nPages == 1 ? 5 : 4;

			if (m_pNumPageButton->GetImageIndex (TRUE) != nImageIndex)
			{
				m_pNumPageButton->SetImageIndex (nImageIndex, TRUE);
				m_pNumPageButton->SetKeys (nPages == 1 ? _T("2") : _T("1"));
				m_pNumPageButton->Redraw ();
			}
		}
	}
	else
#endif
	if (m_wndToolBar.GetSafeHwnd () != NULL)
	{
		CBCGPToolbarButton* pButton = m_wndToolBar.GetButton (m_iPagesBtnIndex);
		ASSERT_VALID (pButton);

		pButton->SetImage (nPages == 1 ? m_iTwoPageImageIndex : m_iOnePageImageIndex);

		m_wndToolBar.InvalidateRect (pButton->Rect ());
	}
}
Пример #3
0
//********************************************************************************
void CButtonAppearanceDlg::RebuildImageList ()
{
	m_wndButtonList.RemoveButtons ();

	while (!m_Buttons.IsEmpty ())
	{
		delete m_Buttons.RemoveHead ();
	}

	int iEnd = m_pImages->GetCount () - 1;
	for (int iImage = m_iStartImage; iImage <= iEnd; iImage ++)
	{
		CBCGPToolbarButton* pButton = new CBCGPToolbarButton;

		pButton->SetImage (iImage);

		m_wndButtonList.AddButton (pButton);
		m_Buttons.AddTail (pButton);
	}

	m_wndButtonList.Invalidate ();
}