Example #1
0
// This copies the data from the axis passed to the constructor
void	CAxisSettings::SetupDataFromAxis( void )
{
	CAxis	*axis = &m_Axes[m_CurAxis];

	if( axis != NULL )
	{
		m_AutoMajorTicks = axis->m_TickCount < 0;
		m_AutoMinorTicks = axis->m_MinorTickCount < 0;
		m_AutoRange = !axis->IsRangeSet();
		m_MajorTickLength = axis->m_TickLength/10;
		m_MinorTickLength = axis->m_MinorTickLength/10;
		m_NumMinorTicks = axis->GetMinorTickCount();
		axis->GetTitle(m_Title);
		m_RangeHigh = (float)axis->GetUpperRange();
		m_RangeLow = (float)axis->GetLowerRange();
		m_NumMajorTicks = axis->GetTickCount()+1;
		m_TitleFontDescription = GetFontDescription( &axis->m_TitleFont );
		memcpy( &m_Font, &axis->m_TitleFont, sizeof( LOGFONT ) );

		m_LabelFontDescription = GetFontDescription( &axis->m_LabelFont );
		memcpy( &m_LabelFont, &axis->m_LabelFont, sizeof( LOGFONT ) );

		m_LineColor = axis->GetColor();
		m_LabelColor = axis->m_TitleColor;

		m_AxisLabel.SetWindowText( GetMainLabel() );
		UpdateData( FALSE );
	}
		
}
Example #2
0
wxSize wxCommandLinkButton::DoGetBestSize() const
{
    wxSize size;

    // account for the text part if we have it or if we don't have any image at
    // all (buttons initially created with empty label should still have a non
    // zero size)
    if ( ShowsLabel() || !m_imageData )
    {
        int flags = 0;
        if ( GetAuthNeeded() )
            flags |= wxMSWButton::Size_AuthNeeded;

        wxCommandLinkButton *thisButton =
            const_cast<wxCommandLinkButton *>(this);
        wxClientDC dc(thisButton);

        wxFont noteFont = dc.GetFont();

        // 4/3 is the relationship between main label and note font sizes.
        dc.SetFont(noteFont.Scaled(4.0f/3.0f));
        size = dc.GetMultiLineTextExtent(GetLabelText(GetMainLabel()));

        dc.SetFont(noteFont);
        wxSize noteSize = dc.GetMultiLineTextExtent(GetLabelText(GetNote()));

        if ( noteSize.x > size.x )
            size.x = noteSize.x;
        size.y += noteSize.y;

        size = wxMSWButton::GetFittingSize(thisButton,
                                           size,
                                           flags);

        // The height of a standard command link button is 25 and 35 DLUs for
        // single lines and two lines respectively. Width is not accounted for.
        int heightDef = GetNote().AfterFirst('\n').empty() ? 25 : 35;
        wxSize sizeDef = thisButton->ConvertDialogToPixels(wxSize(50,
                                                                  heightDef));

        if ( size.y < sizeDef.y )
            size.y = sizeDef.y;
    }

    if ( m_imageData )
    {
        AdjustForBitmapSize(size);
    }
    else
    {
        // The default image size is 16x16.
        size.x += 16;
        if ( size.y < 16 )
            size.y = 16;
    }

    size.x += MAINLABEL_NOTE_LEFT_MARGIN;
    size.y += MAINLABEL_TOP_MARGIN + NOTE_BOTTOM_MARGIN;
    if ( !GetNote().empty() )
        size.y += MAINLABEL_NOTE_MARGIN;

    CacheBestSize(size);

    return size;
}