Example #1
0
BOOL CSettingsSheet::SkinMe(LPCTSTR pszSkin, UINT nIcon, BOOL bLanguage)
{
	EnableBanner( FALSE );

	m_szPages.cx = m_szPages.cy = 0;

	for ( int nPage = 0 ; nPage < GetPageCount() ; nPage++ )
	{
		CSettingsPage* pPage = GetPage( nPage );
		CDialogTemplate pTemplate;

		if ( pPage->GetTemplateName() == NULL )  continue;

		if ( pTemplate.Load( pPage->GetTemplateName() ) )
		{
			CSize size;
			pTemplate.GetSizeInPixels( &size );
			m_szPages.cx = max( m_szPages.cx, size.cx );
			m_szPages.cy = max( m_szPages.cy, size.cy );
		}
	}

	CRect rcWindow(
		0,
		0,
		m_szPages.cx + m_nListWidth + m_nListMargin,
		m_szPages.cy + + m_nButtonHeight + 8 + 8 + 2 );
	CalcWindowRect( &rcWindow );
	SetWindowPos( &wndTop, 0, 0, rcWindow.Width(), rcWindow.Height(),
		SWP_NOMOVE|SWP_NOZORDER );

	CRect rcTree(
		0,
		2,
		m_nListWidth,
		2 + m_szPages.cy );
	m_wndTree.MoveWindow( &rcTree );

	CRect rcButton(
		8,
		2 + m_szPages.cy + 8,
		8 + m_nButtonWidth,
		2 + m_szPages.cy + 8 + m_nButtonHeight );
	m_wndOK.MoveWindow( &rcButton );
	rcButton.OffsetRect( rcButton.Width() + 8, 0 );
	m_wndCancel.MoveWindow( &rcButton );
	rcButton.OffsetRect( rcButton.Width() + 8, 0 );
	m_wndApply.MoveWindow( &rcButton );

	CenterWindow();

	SetActivePage( m_pPage ? m_pPage : m_pFirst );

	return CSkinDialog::SkinMe( pszSkin, nIcon, bLanguage );
}
Example #2
0
void CSettingsSheet::Layout()
{
	TEXTMETRIC txtMetric;

	CDC* pDC = GetDC();
	pDC->SelectObject( &CoolInterface.m_fntNormal );
	pDC->GetTextMetrics( &txtMetric );
	ReleaseDC( pDC );

	m_nButtonHeight = ( txtMetric.tmHeight + txtMetric.tmExternalLeading ) + 10;

	m_szPages.cx = m_szPages.cy = 0;

	for ( int nPage = 0 ; nPage < GetPageCount() ; nPage++ )
	{
		CSettingsPage* pPage = GetPage( nPage );
		CDialogTemplate pTemplate;

		if ( pPage->GetTemplateName() == NULL )  continue;

		if ( pTemplate.Load( pPage->GetTemplateName() ) )
		{
			CSize size;
			pTemplate.GetSizeInPixels( &size );
			m_szPages.cx = max( m_szPages.cx, size.cx );
			m_szPages.cy = max( m_szPages.cy, size.cy );
		}
	}

	CRect rc( 0, 0, m_szPages.cx, m_szPages.cy );
	rc.right += m_nListWidth + m_nListMargin;
	rc.right += m_nLeftMargin;
	rc.bottom += m_nTopMargin + m_nButtonHeight + 16;

	CalcWindowRect( &rc );
	SetWindowPos( &wndTop, 0, 0, rc.Width(), rc.Height(), SWP_NOMOVE|SWP_NOZORDER );

	rc.SetRect( m_nLeftMargin, m_nTopMargin, 0, 0 );
	rc.right	= rc.left + m_nListWidth;
	rc.bottom	= rc.top  + m_szPages.cy;

	m_wndTree.MoveWindow( &rc );

	rc.SetRect( 8, rc.bottom + 8, 76, m_nButtonHeight );
	rc.right += rc.left;
	rc.bottom += rc.top;

	m_wndOK.MoveWindow( &rc );
	rc.OffsetRect( rc.Width() + 8, 0 );
	m_wndCancel.MoveWindow( &rc );
	rc.OffsetRect( rc.Width() + 8, 0 );
	m_wndApply.MoveWindow( &rc );
}
Example #3
0
BOOL COptionSheet::CalcSpacing(CFont &buttonFont)
{
	TEXTMETRIC	txtMetric;
	CRect		rcClient;
	CRect		rcWindow;
	COptionPage *page;
	CRect		rect;
	
	GetClientRect(rcClient);
	GetWindowRect(rcWindow);

	// Get the client area used by the window
	m_XBorder = rcWindow.Width() - rcClient.Width();
	m_YBorder = rcWindow.Height() - rcClient.Height();

	// Get the rect metrics of the font used on the buttons
	CDC *dc = GetDC();
	dc->SelectObject(buttonFont);
	dc->GetTextMetrics(&txtMetric);
	ReleaseDC(dc);

	// Calculate the height of the buttons and the button spacing
	m_ButtonHeight = (txtMetric.tmHeight + txtMetric.tmExternalLeading) + 10;
	m_ButtonYLocOffset = PAGE_SPACING2 + m_ButtonHeight;
	m_ButtonSpacing = m_ButtonHeight + PAGE_SPACING;
	m_ButtonWidth = BUTTON_WIDTH;

	// Adjust the button spacing if in full page wizard mode
	if(m_psh.dwFlags & OSH_WIZARDFULL) {
		m_ButtonSpacing += PAGE_SPACING;
	}

	// Calculate the space needed for the buttons
	m_AllButtonsWidth = 0;

	m_AllButtonsWidth = AddButtons(FALSE);

	// Calculate the sizes of the option pages
	m_MaxChildSize.cx = 0;
	m_MaxChildSize.cy = 0;

	for(int i = 0; i < GetPageCount(); i++) {
		BOOL result;
		CDialogTemplate tmpl;
		SIZE size;

		page = GetPage(i);

		// FIXME
		if(NULL != page->GetTemplateName()) {
			// Create the child dialog and get the rect
			result = tmpl.Load(page->GetTemplateName());
			ASSERT(TRUE == result);

			tmpl.GetSizeInPixels(&size);

			// Calc the size
			if(size.cx > m_MaxChildSize.cx) {
				m_MaxChildSize.cx = size.cx;
			}

			if(size.cy > m_MaxChildSize.cy) {
				m_MaxChildSize.cy = size.cy;
			}
		}
	}

	return TRUE;
}