Esempio n. 1
1
LRESULT CMainFrame::OnToolbarReset(WPARAM wp, LPARAM)
{
	UINT uiToolBarId = (UINT) wp;
	if (uiToolBarId == IDR_MAINFRAME)
	{
		// Replace "Back" and "Forward" buttons by the menu buttons
		// with the history lists:

		CMenu menuBackward;
		menuBackward.LoadMenu (IDR_BACKWARD_MENU);

		m_wndToolBar.ReplaceButton (ID_GO_BACK, 
			CMFCToolBarMenuButton (ID_GO_BACK, menuBackward, 
						GetCmdMgr ()->GetCmdImage (ID_GO_BACK), NULL));

		CMenu menuForward;
		menuForward.LoadMenu (IDR_FORWARD_MENU);

		m_wndToolBar.ReplaceButton (ID_GO_FORWARD,
			CMFCToolBarMenuButton (ID_GO_FORWARD, menuForward, 
						GetCmdMgr ()->GetCmdImage (ID_GO_FORWARD), NULL));
	}

	return 0;
}
Esempio n. 2
0
LRESULT CMainFrame::OnToolbarReset(WPARAM wp,LPARAM)
{
	//----Example----//

	UINT uiToolBarId = (UINT) wp;

	switch (uiToolBarId)
	{
	case IDR_MAINFRAME:
		{
			CMFCToolBarDateTimeCtrl dateButton (ID_DATE,
				GetCmdMgr ()->GetCmdImage (ID_DATE, FALSE));
			m_wndToolBar.ReplaceButton (ID_DATE, dateButton);

			CMFCToolBarDateTimeCtrl timeButton (ID_TIME,
				GetCmdMgr ()->GetCmdImage (ID_TIME, FALSE),
				DTS_TIMEFORMAT | DTS_UPDOWN);
			m_wndToolBar.ReplaceButton (ID_TIME, timeButton);
		}
		break;
	}

	//----Example----//

	return 0;
}
Esempio n. 3
0
LRESULT CMainFrame::OnToolbarReset(WPARAM wp,LPARAM)
{
	UINT uiToolBarId = (UINT) wp;

	switch (uiToolBarId)
	{
	case IDR_TOOLBAR2:
		{
		CMFCToolBarComboBoxButton deviceCombo(ID_LOADFILE, GetCmdMgr()->GetCmdImage(IDR_TOOLBAR2, FALSE), CBS_DROPDOWNLIST,150);
		m_wndLoadFileBar.ReplaceButton (ID_LOADFILE,deviceCombo);
		}
		break;

	case IDR_TOOLBAR3:
		{
		CMFCToolBarEditBoxButton editBox(ID_HTMEAS, 0, ES_AUTOHSCROLL, 80);
		m_wndGPS_HTMEAS.ReplaceButton (ID_HTMEAS, editBox);
		}
		break;

	case IDR_TOOLBAR4:
		{
		CMFCToolBarEditBoxButton editBox(ID_PROTONS, 0, ES_AUTOHSCROLL, 80);
		m_wndISOLDE_PROTONS.ReplaceButton (ID_PROTONS, editBox);
		}
		break;

	default:
		break;
	}

	return 0;
}
CMFCToolBarFontComboBox* CFormatBar::CreateFontComboButton ()
{
	// CSize m_szBaseUnits
	return new CMFCToolBarFontComboBox (IDC_FONTNAME, 
		GetCmdMgr ()->GetCmdImage  (IDC_FONTNAME, FALSE),
		TRUETYPE_FONTTYPE | DEVICE_FONTTYPE,
		DEFAULT_CHARSET,
		WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN |
		CBS_AUTOHSCROLL | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED,
		(3*LF_FACESIZE*m_szBaseUnits.cx)/2);
}
//*****************************************************************************************
CBCGPCalendarMenuButton::CBCGPCalendarMenuButton (UINT uiCmdID, LPCTSTR lpszText) :
	CBCGPToolbarMenuButton (uiCmdID, NULL,
#ifndef _BCGSUITE_
		CImageHash::GetImageOfCommand (uiCmdID, FALSE), 
#else
		GetCmdMgr ()->GetCmdImage (uiCmdID, FALSE),
#endif
		lpszText)
{
	Initialize ();

	m_Calendar = GetCalendarByCmdID (uiCmdID);
}
Esempio n. 6
0
afx_msg LRESULT CMainFrame::OnToolbarReset(WPARAM wp, LPARAM)
{
	UINT uiToolBarId = (UINT) wp;
	if (uiToolBarId != IDR_MAINFRAME)
	{
		return 0;
	}

	// Replace "Back" and "Forward" buttons by the menu buttons
	// with the history lists:

	CMenu menuHistory;
	menuHistory.LoadMenu (IDR_HISTORY_POPUP);

	CMFCToolBarMenuButton btnBack (ID_GO_BACK, menuHistory, 
					GetCmdMgr ()->GetCmdImage (ID_GO_BACK), _T("Back"));
	btnBack.m_bText = TRUE;
	m_wndToolBar.ReplaceButton (ID_GO_BACK, btnBack);

	m_wndToolBar.ReplaceButton (ID_GO_FORWARD,
		CMFCToolBarMenuButton (ID_GO_FORWARD, menuHistory, 
					GetCmdMgr ()->GetCmdImage (ID_GO_FORWARD), _T("Forward")));

	// "Folders" button has a text label:
	m_wndToolBar.SetToolBarBtnText (m_wndToolBar.CommandToIndex (ID_VIEW_FOLDERS),
		_T("Folders"));

	// Replace "Views" button by the menu button:
	CMenu menuViews;
	menuViews.LoadMenu (IDR_VIEWS_POPUP);

	m_wndToolBar.ReplaceButton (ID_VIEW_VIEWS,
		CMFCToolBarMenuButton ((UINT)-1, menuViews, 
					GetCmdMgr ()->GetCmdImage (ID_VIEW_VIEWS), _T("Views")));

	return 0;
}
Esempio n. 7
0
void CMainFrame::OnViewCustomize()
{
	//------------------------------------
	// Create a customize toolbars dialog:
	//------------------------------------
	CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog (this,
		TRUE /* Automatic menus scaning */
		);

	//----Example----//

	CMFCToolBarDateTimeCtrl dateButton (ID_DATE,
		GetCmdMgr ()->GetCmdImage (ID_DATE, FALSE));
	pDlgCust->ReplaceButton (ID_DATE, dateButton);

	CMFCToolBarDateTimeCtrl timeButton (ID_TIME,
		GetCmdMgr ()->GetCmdImage (ID_TIME, FALSE),
		DTS_TIMEFORMAT | DTS_UPDOWN);
	pDlgCust->ReplaceButton (ID_TIME, timeButton);

	//----Example----//

	pDlgCust->Create ();
}
Esempio n. 8
0
void CMainFrame::OnViewCustomize() 
{
	CWordPadView* pView = DYNAMIC_DOWNCAST (CWordPadView, GetActiveView());
	if (pView != NULL && pView->GetInPlaceActiveItem () != NULL)
	{
		return;
	}

	//------------------------------------
	// Create a customize toolbars dialog:
	//------------------------------------
	CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog (this,
		TRUE /* Automatic menus scaning */,
		AFX_CUSTOMIZE_MENU_SHADOWS | AFX_CUSTOMIZE_TEXT_LABELS | 
		AFX_CUSTOMIZE_MENU_ANIMATIONS);

	pDlgCust->AddToolBar (_T("Format"), IDR_FORMATBAR);

	CMFCToolBarFontComboBox* pFontButton = m_wndFormatBar.CreateFontComboButton ();
	pDlgCust->ReplaceButton (IDC_FONTNAME, *pFontButton);
	delete pFontButton;

	CMFCToolBarFontSizeComboBox comboButtonFontSize (IDC_FONTSIZE, 
		GetCmdMgr ()->GetCmdImage (IDC_FONTSIZE, FALSE),
		WS_TABSTOP|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|CBS_DROPDOWN,
		10*m_wndFormatBar.m_szBaseUnits.cx + 10);
	pDlgCust->ReplaceButton (IDC_FONTSIZE, comboButtonFontSize);

	CMFCColorMenuButton* pColorButton = m_wndFormatBar.CreateColorButton ();
	pDlgCust->ReplaceButton (ID_CHAR_COLOR, *pColorButton);
	delete pColorButton;

	CMFCToolBarMenuButton* pBorderTypeButton = m_wndFormatBar.CreateBorderTypeButton ();
	pDlgCust->ReplaceButton (ID_BORDER_1, *pBorderTypeButton);
	delete pBorderTypeButton;

	pDlgCust->EnableUserDefinedToolbars ();
	pDlgCust->Create ();
}
//******************************************************************************
void CBCGPRadialMenuItem::OnDrawIcon(CBCGPGraphicsManager* pGM, BOOL bIsCtrlDisabled, CBCGPImage& icons, CBCGPSize sizeIcon)
{
	ASSERT_VALID(pGM);

	if (m_ptCenter == CBCGPPoint(-1, -1))
	{
		return;
	}

	BOOL bIsDisabled = bIsCtrlDisabled || m_bIsDisabled;
	HICON hIcon = NULL;

	if (m_hIcon != NULL)
	{
		hIcon = m_hIcon;
	}
	else if (m_nImageIndex >= 0)
	{
		CBCGPPoint ptImage = m_ptCenter;
		ptImage.x -= .5 * sizeIcon.cx;
		ptImage.y -= .5 * sizeIcon.cy;

		pGM->DrawImage(icons, ptImage, sizeIcon, bIsDisabled ? .4 : 1., CBCGPImage::BCGP_IMAGE_INTERPOLATION_MODE_LINEAR,
			CBCGPRect(CBCGPPoint(sizeIcon.cx * m_nImageIndex, 0), sizeIcon));
	}
	else
	{
		// Try to obtain icon from ribbon/toolbars:
#ifndef _BCGSUITE_
#ifndef BCGP_EXCLUDE_RIBBON
		CFrameWnd* pParentFrame = DYNAMIC_DOWNCAST (CFrameWnd, AfxGetMainWnd());
		CBCGPRibbonBar* pRibbonBar = NULL;

		CBCGPMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST (CBCGPMDIFrameWnd, pParentFrame);
		if (pMainFrame != NULL)
		{
			pRibbonBar = pMainFrame->GetRibbonBar();
		}
		else	// Maybe, SDI frame...
		{
			CBCGPFrameWnd* pFrame = DYNAMIC_DOWNCAST (CBCGPFrameWnd, pParentFrame);
			if (pFrame != NULL)
			{
				pRibbonBar = pFrame->GetRibbonBar();
			}
		}

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

			hIcon = pRibbonBar->ExportImageToIcon(m_nID, FALSE);
		}
		else
#endif
#endif
		{
#ifndef _BCGSUITE_
			int nImage = CImageHash::GetImageOfCommand(m_nID, FALSE);
#else
			int nImage = GetCmdMgr ()->GetCmdImage(m_nID, FALSE);
#endif
			CBCGPToolBarImages* pImages = CBCGPToolBar::GetImages();
			if (pImages != NULL && nImage >= 0)
			{
				hIcon = pImages->ExtractIcon(nImage);
			}
		}

		if (hIcon != NULL)
		{
			m_hIcon = hIcon;
			m_bDestroyIcon = TRUE;
		}
	}

	if (hIcon != NULL)
	{
		CBCGPImage image(hIcon);

		sizeIcon = pGM->GetImageSize(image);
		
		CBCGPPoint ptImage = m_ptCenter;
		ptImage.x -= .5 * sizeIcon.cx;
		ptImage.y -= .5 * sizeIcon.cy;

		pGM->DrawImage(image, ptImage, CBCGPSize(), bIsDisabled ? .4 : 1);
	}
}