//*******************************************************************************
VOID CALLBACK CBCGPRibbonStatusBarPane::AnimTimerProc (HWND /*hwnd*/, UINT /*uMsg*/,
													   UINT_PTR idEvent, DWORD dwTime)
{
	CBCGPRibbonStatusBarPane* pPane = NULL;

	g_cs.Lock ();

	if (!m_mapAnimations.Lookup ((UINT) idEvent, pPane))
	{
		g_cs.Unlock ();
		return;
	}

	ASSERT_VALID (pPane);

	g_cs.Unlock ();

	if (pPane->m_nAnimationDuration > 0)
	{
		if (dwTime - pPane->m_dwAnimationStartTime > (DWORD) pPane->m_nAnimationDuration)
		{
			pPane->StopAnimation ();
			return;
		}
	}

	pPane->m_nAnimationIndex++;

	if (pPane->m_nAnimationIndex >= pPane->m_AnimImages.GetCount ())
	{
		pPane->m_nAnimationIndex = 0;
	}

	pPane->Redraw ();
}
Пример #2
0
void CSynBCGPEditView::OnUpdateCursorPos( CCmdUI * /*pCmdUI*/ )
{
	CBCGPRibbonStatusBar* pStatusBar = ((CMainFrame*) GetTopLevelFrame ())->GetRibbonStatusBar ();
	CBCGPRibbonStatusBarPane* pCursorPos = DYNAMIC_DOWNCAST (
		CBCGPRibbonStatusBarPane,
		pStatusBar->FindElement (ID_STATUSBAR_PANE3));
	ASSERT_VALID (pCursorPos);

	CString strCursorPos, strTemp;
	BOOL bNameValid = strTemp.LoadString(IDS_STATUS_ROWCOL);
	ASSERT(bNameValid);
	strCursorPos.Format (strTemp, m_pEdit->GetCurRow() + 1, m_pEdit->GetCurColumn() + 1);

	pCursorPos->SetText (strCursorPos);
	pCursorPos->Redraw ();
}
Пример #3
0
void CCoolFormat3Doc::OnCloseDocument()
{
	CBCGPRibbonStatusBar* pStatusBar = ((CMainFrame*) AfxGetMainWnd())->GetRibbonStatusBar ();
	CBCGPRibbonStatusBarPane* pCursorPos = DYNAMIC_DOWNCAST (
		CBCGPRibbonStatusBarPane,
		pStatusBar->FindElement (ID_STATUSBAR_PANE3));
	ASSERT_VALID (pCursorPos);

	CString strCursorPos, strTemp;
	BOOL bNameValid = strTemp.LoadString(IDS_STATUS_ROWCOL);
	ASSERT(bNameValid);
	strCursorPos.Format (strTemp, 0, 0);

	pCursorPos->SetText (strCursorPos);
	pCursorPos->Redraw ();

	CDocument::OnCloseDocument();
}
Пример #4
0
void CBCGPMSOffice2007DemoView::OnZoomSlider()
{
	CBCGPRibbonStatusBar* pStatusBar = ((CMainFrame*) GetTopLevelFrame ())->GetRibbonStatusBar ();

	CBCGPRibbonSlider* pSlider = DYNAMIC_DOWNCAST (
		CBCGPRibbonSlider,
		pStatusBar->FindElement (ID_STATUSBAR_ZOOM_SLIDER));
	ASSERT_VALID (pSlider);

	int nPos = pSlider->GetPos ();

	CBCGPRibbonStatusBarPane* pZoom = DYNAMIC_DOWNCAST (
		CBCGPRibbonStatusBarPane,
		pStatusBar->FindElement (ID_STATUSBAR_ZOOM));
	ASSERT_VALID (pZoom);

	CString strZoom;
	strZoom.Format (_T("%d%%"), nPos);

	pZoom->SetText (strZoom);
	pZoom->Redraw ();

	SendMessage(EM_SETZOOM, nPos, 100);
}
Пример #5
0
CBCGPBaseRibbonElement* CBCGPRibbonConstructor::CreateElement (const CBCGPRibbonInfo::XElement& info) const
{
	CBCGPBaseRibbonElement* pElement = NULL;

	int i = 0;

	if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Main) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonMain& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonMain&)info;

		CBCGPRibbonMainButton* pNewElement = new CBCGPRibbonMainButton;

		if (infoElement.m_Image.m_Image.GetImageWell () != NULL)
		{
			pNewElement->SetImage (infoElement.m_Image.m_Image.GetImageWell ());
		}
		if (infoElement.m_ImageScenic.m_Image.GetImageWell () != NULL)
		{
			pNewElement->SetScenicImage (infoElement.m_ImageScenic.m_Image.GetImageWell ());
		}

		pElement = pNewElement;

		ConstructElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Launch) == 0)
	{
		CBCGPRibbonLaunchButton* pNewElement = new CBCGPRibbonLaunchButton;
		pElement = pNewElement;

		ConstructElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szGroup) == 0)
	{
		CBCGPRibbonButtonsGroup* pNewElement = new CBCGPRibbonButtonsGroup;
		pElement = pNewElement;

		ConstructElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szLabel) == 0)
	{
		const CBCGPRibbonInfo::XElementLabel& infoElement = 
			(const CBCGPRibbonInfo::XElementLabel&)info;

		CBCGPRibbonLabel* pNewElement = 
			new CBCGPRibbonLabel (infoElement.m_strText, infoElement.m_bIsAlwaysLarge);
		pElement = pNewElement;
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szComboBox_Font) == 0)
	{
		const CBCGPRibbonInfo::XElementFontComboBox& infoElement = 
			(const CBCGPRibbonInfo::XElementFontComboBox&)info;

		CBCGPRibbonFontComboBox* pNewElement = 
			new CBCGPRibbonFontComboBox (infoElement.m_ID.m_Value, 
										infoElement.m_nFontType, 
										infoElement.m_nCharSet, 
										infoElement.m_nPitchAndFamily,
										infoElement.m_nWidth);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		if (infoElement.m_nWidthFloaty > 0)
		{
			pNewElement->SetWidth (infoElement.m_nWidthFloaty, TRUE);
		}

		pNewElement->SetTextAlign (infoElement.m_nTextAlign);
		pNewElement->SetPrompt(infoElement.m_strSearchPrompt);

		((CBCGPRibbonFontComboBox*)pNewElement)->m_bHasEditBox = infoElement.m_bHasEditBox;
		pNewElement->EnableDropDownListResize (infoElement.m_bResizeDropDownList);

		if (infoElement.m_bHasEditBox)
		{
			pNewElement->EnableAutoComplete (infoElement.m_bAutoComplete);
		}
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szComboBox) == 0)
	{
		const CBCGPRibbonInfo::XElementComboBox& infoElement = 
			(const CBCGPRibbonInfo::XElementComboBox&)info;

		CBCGPRibbonComboBox* pNewElement = 
			new CBCGPRibbonComboBox (infoElement.m_ID.m_Value, 
									infoElement.m_bCalculatorMode || infoElement.m_bHasEditBox,
									infoElement.m_nWidth,
									infoElement.m_strText,
									infoElement.m_nSmallImageIndex,
									infoElement.m_sortOrder);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		if (infoElement.m_nWidthFloaty > 0)
		{
			pNewElement->SetWidth (infoElement.m_nWidthFloaty, TRUE);
		}

		pNewElement->SetTextAlign (infoElement.m_nTextAlign);
		pNewElement->SetPrompt(infoElement.m_strSearchPrompt);

		if (infoElement.m_bCalculatorMode)
		{
			pNewElement->EnableCalculator (TRUE, NULL, &infoElement.m_lstCalculatorExt);
		}
		else
		{
			pNewElement->EnableDropDownListResize (infoElement.m_bResizeDropDownList);
			if (infoElement.m_bHasEditBox)
			{
				pNewElement->EnableAutoComplete (infoElement.m_bAutoComplete);
			}

			if (infoElement.m_bSearchMode)
			{
				pNewElement->EnableSearchMode (TRUE, infoElement.m_strSearchPrompt);
			}

			for (i = 0; i < infoElement.m_arItems.GetSize (); i++)
			{
				pNewElement->AddItem (infoElement.m_arItems[i]);
			}
		}
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szEdit) == 0)
	{
		const CBCGPRibbonInfo::XElementEdit& infoElement = 
			(const CBCGPRibbonInfo::XElementEdit&)info;

		CBCGPRibbonEdit* pNewElement = 
			new CBCGPRibbonEdit (infoElement.m_ID.m_Value, 
								infoElement.m_nWidth,
								infoElement.m_strText,
								infoElement.m_nSmallImageIndex);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		if (infoElement.m_nWidthFloaty > 0)
		{
			pNewElement->SetWidth (infoElement.m_nWidthFloaty, TRUE);
		}

		pNewElement->SetTextAlign (infoElement.m_nTextAlign);
		pNewElement->SetPrompt(infoElement.m_strSearchPrompt);

		CString strValue (infoElement.m_strValue);
		if (infoElement.m_bSearchMode)
		{
			pNewElement->EnableSearchMode (TRUE, infoElement.m_strSearchPrompt);
		}
		else if (infoElement.m_bHasSpinButtons)
		{
			pNewElement->EnableSpinButtons (infoElement.m_nMin, infoElement.m_nMax);
			if (strValue.IsEmpty ())
			{
				strValue.Format (_T("%d"), infoElement.m_nMin);
			}
		}

		BOOL bDontNotify = pNewElement->m_bDontNotify;
		pNewElement->m_bDontNotify = TRUE;
		pNewElement->SetEditText (strValue);
		pNewElement->m_bDontNotify = bDontNotify;
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Undo) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonUndo& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonUndo&)info;

		CBCGPRibbonUndoButton* pNewElement = 
			new CBCGPRibbonUndoButton (infoElement.m_ID.m_Value,
										infoElement.m_strText,
										infoElement.m_nSmallImageIndex,
										infoElement.m_nLargeImageIndex);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info, FALSE);

		pNewElement->SetButtonMode (infoElement.m_bIsButtonMode);
		pNewElement->EnableMenuResize (infoElement.m_bEnableMenuResize, infoElement.m_bMenuResizeVertical);
		pNewElement->SetDrawDisabledItems(infoElement.m_bDrawDisabledItems);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Color) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonColor& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonColor&)info;

		CBCGPRibbonColorButton* pNewElement = 
			new CBCGPRibbonColorButton (infoElement.m_ID.m_Value,
										infoElement.m_strText,
										infoElement.m_bSimpleButtonLook,
										infoElement.m_nSmallImageIndex,
										infoElement.m_nLargeImageIndex,
										infoElement.m_clrColor);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		pNewElement->EnableAutomaticButton (infoElement.m_strAutomaticBtnLabel.IsEmpty () ? NULL : (LPCTSTR)infoElement.m_strAutomaticBtnLabel, 
			infoElement.m_clrAutomaticBtnColor, !infoElement.m_strAutomaticBtnLabel.IsEmpty (), infoElement.m_strAutomaticBtnToolTip, 
			infoElement.m_bAutomaticBtnOnTop, infoElement.m_bAutomaticBtnBorder);

		pNewElement->EnableOtherButton (infoElement.m_strOtherBtnLabel.IsEmpty () ? NULL : (LPCTSTR)infoElement.m_strOtherBtnLabel, 
										infoElement.m_strOtherBtnToolTip);

		pNewElement->SetColorBoxSize (infoElement.m_sizeIcon);
		pNewElement->SetButtonMode (infoElement.m_bIsButtonMode);
		pNewElement->EnableMenuResize (infoElement.m_bEnableMenuResize, infoElement.m_bMenuResizeVertical);
		pNewElement->SetDrawDisabledItems(infoElement.m_bDrawDisabledItems);
		pNewElement->SetIconsInRow (infoElement.m_nIconsInRow);

		if (infoElement.m_arGroups.GetSize () == 0)
		{
			if (!infoElement.m_bIsButtonMode)
			{
				pNewElement->AddGroup (_T(""), (int)pNewElement->m_Colors.GetSize ());
				pNewElement->m_bHasGroups = TRUE;
			}
		}
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Palette) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonPalette& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonPalette&)info;

		CBCGPRibbonPaletteButton* pNewElement = 
			new CBCGPRibbonPaletteButton (infoElement.m_ID.m_Value,
										infoElement.m_strText,
										infoElement.m_nSmallImageIndex,
										infoElement.m_nLargeImageIndex);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		pNewElement->SetButtonMode (infoElement.m_bIsButtonMode);
		pNewElement->EnableMenuResize (infoElement.m_bEnableMenuResize, infoElement.m_bMenuResizeVertical);
		pNewElement->SetDrawDisabledItems(infoElement.m_bDrawDisabledItems);
		pNewElement->SetIconsInRow (infoElement.m_nIconsInRow);

		pNewElement->Clear ();
		int nCount = (int)infoElement.m_arGroups.GetSize ();
		if (nCount > 0)
		{
			BOOL bIsOwnerDraw = pNewElement->m_bIsOwnerDraw;
			pNewElement->m_bIsOwnerDraw = TRUE;
			for (int i = 0; i < nCount; i++)
			{
				pNewElement->AddGroup (infoElement.m_arGroups[i]->m_strName, infoElement.m_arGroups[i]->m_nItems);
			}
			pNewElement->m_bIsOwnerDraw = bIsOwnerDraw;
		}

		const_cast<CBCGPToolBarImages&>(infoElement.m_Images.m_Image).CopyTo (pNewElement->m_imagesPalette);
		pNewElement->m_nIcons = pNewElement->m_imagesPalette.GetCount ();
		pNewElement->CreateIcons ();
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Hyperlink) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonHyperlink& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonHyperlink&)info;

		CBCGPRibbonHyperlink* pNewElement = 
			new CBCGPRibbonHyperlink (infoElement.m_ID.m_Value, infoElement.m_strText, infoElement.m_strLink);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Radio) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonRadio& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonRadio&)info;

		CBCGPRibbonRadioButton* pNewElement = 
			new CBCGPRibbonRadioButton (infoElement.m_ID.m_Value, infoElement.m_strText);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Check) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonCheck& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonCheck&)info;

		CBCGPRibbonCheckBox* pNewElement = 
			new CBCGPRibbonCheckBox (infoElement.m_ID.m_Value, infoElement.m_strText);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szStatusPane) == 0)
	{
		const CBCGPRibbonInfo::XElementStatusPane& infoElement = 
			(const CBCGPRibbonInfo::XElementStatusPane&)info;

		CBCGPRibbonStatusBarPane* pNewElement = 
			new CBCGPRibbonStatusBarPane (infoElement.m_ID.m_Value,
											infoElement.m_strText,
											infoElement.m_bIsStatic);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		if (!infoElement.m_strAlmostLargeText.IsEmpty())
		{
			pNewElement->SetAlmostLargeText (infoElement.m_strAlmostLargeText);
		}
		pNewElement->SetTextAlign (infoElement.m_nTextAlign);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_MainPanel) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonMainPanel& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonMainPanel&)info;

		CBCGPRibbonMainPanelButton* pNewElement = 
			new CBCGPRibbonMainPanelButton (infoElement.m_ID.m_Value,
									infoElement.m_strText,
									infoElement.m_nSmallImageIndex);

		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton_Command) == 0)
	{
		const CBCGPRibbonInfo::XElementButtonCommand& infoElement = 
			(const CBCGPRibbonInfo::XElementButtonCommand&)info;

		CBCGPRibbonButton* pNewElement = 
			new CBCGPRibbonButton (infoElement.m_ID.m_Value,
									infoElement.m_strText,
									infoElement.m_bIsMenu ? -1 : infoElement.m_nSmallImageIndex);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info, FALSE);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szButton) == 0)
	{
		const CBCGPRibbonInfo::XElementButton& infoElement = 
			(const CBCGPRibbonInfo::XElementButton&)info;

		CBCGPRibbonButton* pNewElement = 
			new CBCGPRibbonButton (infoElement.m_ID.m_Value,
									infoElement.m_strText,
									infoElement.m_nSmallImageIndex,
									infoElement.m_nLargeImageIndex,
									infoElement.m_bIsAlwaysShowDescription);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szSlider) == 0)
	{
		const CBCGPRibbonInfo::XElementSlider& infoElement = 
			(const CBCGPRibbonInfo::XElementSlider&)info;

		CBCGPRibbonSlider* pNewElement = 
			new CBCGPRibbonSlider (infoElement.m_ID.m_Value,
									infoElement.m_nWidth,
									infoElement.m_dwStyle);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		pNewElement->SetZoomButtons (infoElement.m_bZoomButtons);
		pNewElement->SetRange (infoElement.m_nMin, infoElement.m_nMax);
		pNewElement->SetPos (infoElement.m_nPos, FALSE);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szProgress) == 0)
	{
		const CBCGPRibbonInfo::XElementProgressBar& infoElement = 
			(const CBCGPRibbonInfo::XElementProgressBar&)info;

		CBCGPRibbonProgressBar* pNewElement = 
			new CBCGPRibbonProgressBar (infoElement.m_ID.m_Value,
										infoElement.m_nWidth,
										infoElement.m_nHeight,
										infoElement.m_bVertical);
		pElement = pNewElement;

		ConstructBaseElement (*pElement, info);

		pNewElement->SetRange (infoElement.m_nMin, infoElement.m_nMax);
		pNewElement->SetPos (infoElement.m_nPos, FALSE);
		pNewElement->SetInfiniteMode (infoElement.m_bInfinite);
	}
	else if (info.GetElementName ().Compare (CBCGPRibbonInfo::s_szSeparator) == 0)
	{
		const CBCGPRibbonInfo::XElementSeparator& infoElement = 
			(const CBCGPRibbonInfo::XElementSeparator&)info;

		CBCGPRibbonSeparator* pSeparator = 
			new CBCGPRibbonSeparator (infoElement.m_bIsHoriz);

		pElement = pSeparator;
	}

	return pElement;
}