PCM: automatic check for repository updates

This commit is contained in:
qu1ck
2022-08-18 20:41:43 +00:00
committed by Seth Hillbrand
parent 97d7ee1f30
commit f4fa3b02c5
29 changed files with 1038 additions and 147 deletions
+23 -4
View File
@@ -35,14 +35,16 @@
BITMAP_BUTTON::BITMAP_BUTTON( wxWindow* aParent, wxWindowID aId, const wxPoint& aPos,
const wxSize& aSize, int aStyles ) :
wxPanel( aParent, aId, aPos, aSize, aStyles ),
m_isRadioButton( false ),
m_buttonState( 0 ),
m_padding( 0 ),
m_acceptDraggedInClicks( false )
m_isRadioButton( false ), m_buttonState( 0 ), m_padding( 0 ),
m_acceptDraggedInClicks( false ), m_showBadge( false ),
m_badgeColor( wxColor( 210, 0, 0, 0 ) ), // dark red
m_badgeTextColor( wxColor( wxT( "white" ) ) )
{
if( aSize == wxDefaultSize )
SetMinSize( wxButton::GetDefaultSize() + wxSize( m_padding * 2, m_padding * 2) );
m_badgeFont = GetFont().Smaller().MakeBold();
setupEvents();
}
@@ -254,6 +256,23 @@ void BITMAP_BUTTON::OnPaint( wxPaintEvent& aEvent )
// Draw the bitmap with the upper-left corner offset by the padding
if( bmp.IsOk() )
dc.DrawBitmap( bmp, m_padding, m_padding, true );
// Draw the badge
if( m_showBadge )
{
dc.SetFont( m_badgeFont );
wxSize box_size = dc.GetTextExtent( m_badgeText ) + wxSize( 6, 2 );
wxSize box_offset = box_size + wxSize( m_padding - 2, m_padding );
wxSize text_offset = box_offset - wxSize( 3, 1 );
dc.SetPen( wxPen( m_badgeColor ) );
dc.SetBrush( wxBrush( m_badgeColor ) );
dc.DrawRoundedRectangle( rect.GetRightBottom() - box_offset, box_size, -0.25 );
dc.SetTextForeground( m_badgeTextColor );
dc.DrawText( m_badgeText, rect.GetRightBottom() - text_offset );
}
}