Exemple #1
0
void CToolBarEx::OnRestore( NMHDR* pNMHDR, LRESULT* pResult )
{
    NMTBRESTORE* lpnmtb = ( NMTBRESTORE* )pNMHDR;
    if ( lpnmtb->iItem == -1 )
    {
        lpnmtb->cButtons = ( lpnmtb->cbData - sizeof( DWORD ) * 2 ) / lpnmtb->cbBytesPerRecord;
        lpnmtb->pCurrent = lpnmtb->pData;

        SetTextOptions( ( ETextOptions )*lpnmtb->pCurrent++, false );
        SetIconOptions( ( EIconOptions )*lpnmtb->pCurrent++, false );

        if ( lpnmtb->cButtons == 0 )
        {
            ReloadButtons();
            UpdateParentBandInfo();

            *pResult = 1;
            return;
        }
    }
    else
    {
        VERIFY( GetButtonInfo( lpnmtb->tbButton.idCommand, lpnmtb->tbButton ) );
    }

    *pResult = 0;
}
Exemple #2
0
void CToolBarEx::SetBitmaps( 
	UINT nIDSmallCold, 
	UINT nIDSmallHot, 
	UINT nIDSmallDisabled,
   UINT nIDLargeCold, 
	UINT nIDLargeHot, 
	UINT nIDLargeDisabled,
   EIconOptions eIconOptionsDefault,
	CSize szImageSmall,
	CSize szImageLarge,	
   COLORREF clrMask /*=RGB(255,0,255)*/ 
) {
    m_nIDSmallCold     = nIDSmallCold;
    m_nIDSmallHot      = nIDSmallHot;
    m_nIDSmallDisabled = nIDSmallDisabled;
    m_nIDLargeCold     = nIDLargeCold;
    m_nIDLargeHot      = nIDLargeHot;
    m_nIDLargeDisabled = nIDLargeDisabled;
    m_clrMask          = clrMask;

	// NOTE: This needs to come before we call SetIconOptions() below.
	m_szImageSmall = szImageSmall;
	m_szImageLarge = szImageLarge;

	m_eIconOptionsDefault = eIconOptionsDefault;    // to be used on reset
	SetIconOptions( m_eIconOptionsDefault );        // apply new options
}
Exemple #3
0
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;
}
Exemple #4
0
LRESULT CCustomizeDialog::OnInitDialog( WPARAM /*wParam*/, LPARAM /*lParam*/ )
{
    CRect rcClient;
    GetClientRect( rcClient );
    CRect rcWindow;
    GetWindowRect( rcWindow );

	// create  the windows	// sizes are hardcoded //ugly way


	CRect  rc;
	CFont *pFont =GetFont();
	ASSERT_VALID(pFont);

	
  
	//static wnd
	rc=CRect(4,2,49,8);
	MapDialogRect(m_hWnd,&rc);
	rc.left+=rcClient.left;
	rc.top+=rcClient.bottom;
	VERIFY(m_wndTextOptionsText.Create(_T("Te&xt options:"),WS_CHILD|WS_VISIBLE,rc,this));
 	m_wndTextOptionsText.SetFont(pFont);
	m_wndTextOptionsText.SetWindowPos(NULL,rc.left,rc.top,rc.right,rc.bottom,SWP_NOZORDER|SWP_NOACTIVATE);

	
	//Text options
	rc=CRect(52,0,123,50);
	MapDialogRect(m_hWnd,&rc);
	rc.left+=rcClient.left;
	rc.top+=rcClient.bottom;
	VERIFY(m_wndTextOptions.Create(WS_CHILD |WS_VISIBLE |CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP,rc,this, IDC_CB_TEXTOPTIONS));
 	m_wndTextOptions.SetFont(pFont);

	m_wndTextOptions.AddString(_T("Show Text Labels"));
	m_wndTextOptions.AddString(_T("Selective Text on Right"));
	m_wndTextOptions.AddString(_T("No Text Labels"));

	SetTextOptions(m_eTextOptions);
	m_wndTextOptions.SetWindowPos(NULL,rc.left,rc.top,rc.right,rc.bottom,SWP_NOZORDER|SWP_NOACTIVATE);

 
	//static wnd
	rc=CRect(4,20,49,8);
	MapDialogRect(m_hWnd,&rc);
	rc.left+=rcClient.left;
	rc.top+=rcClient.bottom;
	VERIFY(m_wndIconOptionsText.Create(_T("Ico&n options:"),WS_CHILD|WS_VISIBLE,rc,this));
	m_wndIconOptionsText.SetFont(pFont);
	m_wndIconOptionsText.SetWindowPos(NULL,rc.left,rc.top,rc.right,rc.bottom,SWP_NOZORDER|SWP_NOACTIVATE);


	//icon combo
	rc=CRect(52,18,123,50);
	MapDialogRect(m_hWnd,&rc);
	rc.left+=rcClient.left;
	rc.top+=rcClient.bottom;
	VERIFY(m_wndIconOptions.Create(WS_CHILD |WS_VISIBLE |CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP,rc,this, IDC_CB_ICONOPTIONS));
 	m_wndIconOptions.SetFont(pFont);

	m_wndIconOptions.AddString(_T("Small Icons"));
	m_wndIconOptions.AddString(_T("Large Icons"));
	
	SetIconOptions(m_eIconOptions);
	m_wndIconOptions.SetWindowPos(NULL,rc.left,rc.top,rc.right,rc.bottom,SWP_NOZORDER|SWP_NOACTIVATE);



	// final rect
	rc=CRect(0,0,179,34);
	MapDialogRect(m_hWnd,&rc);
	rc.left+=rcClient.left;
	rc.top+=rcClient.bottom;
	
 
    // Increase height of Customize Toolbar dialog accordingly
    rcWindow.bottom += (rc.bottom+cyPadding);
    VERIFY( SetWindowPos( 0, 0, 0, rcWindow.Width(), rcWindow.Height(),
        SWP_NOZORDER | SWP_NOMOVE ) );

	//Set Title
	ASSERT(m_pToolBar);
	CString strName,strOrgName;
	m_pToolBar->GetWindowText(strName);

	if (!strName.IsEmpty())
	{
		GetWindowText(strOrgName);
		SetWindowText(strOrgName + _T(" - ")+ strName);
	}

    return Default();

}