22#include <wx/dcclient.h>
29 m_actionCallback( aCallback ),
30 m_pinCallback( aPinCallback ),
34 SetMinSize( FromDIP( GetMinSize() ) );
41 wxColour bgColor = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK );
42 m_desc->SetBackgroundColour( bgColor );
43 m_name->SetBackgroundColour( bgColor );
44 m_bitmap->SetBackgroundColour( bgColor );
52 m_desc->SetMinSize( wxSize( 0, -1 ) );
56 double descLineHeight =
m_desc->GetTextExtent( wxT(
"X" ) ).GetHeight() * 1.2 ;
59 descLineHeight = wxSplit(
m_desc->GetLabel(),
'\n' ).size() * descLineHeight;
61 int nameLineHeight =
m_name->GetTextExtent( wxT(
"X" ) ).GetHeight();
71 splitMenu->Append( wxID_ANY,
_(
"Pin package" ),
72 _(
"Pinned packages don't affect available update notification and "
73 "will not be updated with 'Update All' button." ),
88 double descLineHeight =
m_desc->GetTextExtent( wxT(
"X" ) ).GetHeight() * 1.2 ;
91 descLineHeight = wxSplit(
m_desc->GetLabel(),
'\n' ).size() * descLineHeight;
93 int nameLineHeight =
m_name->GetTextExtent( wxT(
"X" ) ).GetHeight();
108 case PCM_PACKAGE_STATE::PPS_AVAILABLE:
114 case PCM_PACKAGE_STATE::PPS_UNAVAILABLE:
120 case PCM_PACKAGE_STATE::PPS_INSTALLED:
131 case PCM_PACKAGE_STATE::PPS_PENDING_INSTALL:
134 m_button->SetLabel(
_(
"Install Pending" ) );
137 case PCM_PACKAGE_STATE::PPS_PENDING_UNINSTALL:
140 m_button->SetLabel(
_(
"Uninstall Pending" ) );
143 case PCM_PACKAGE_STATE::PPS_UPDATE_AVAILABLE:
170 case PCM_PACKAGE_STATE::PPS_PENDING_UPDATE:
173 m_button->SetLabel(
_(
"Update Pending" ) );
189 if( version.IsEmpty() )
223 wxLogError( wxT(
"Uninstall clicked in unexpected state" ) );
242 wxRect rect( wxPoint( 1, 1 ), GetClientSize() - wxSize( 1, 1 ) );
243 wxPaintDC dc(
this );
244 dc.SetBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK ) );
245 dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ), 1 ) );
250 dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_HOTLIGHT ), 3 ) );
253 dc.DrawRectangle( rect );
272 return ver.compatible && ver.status == PVS_STABLE;
281 return ver.compatible;
286 return wxEmptyString;
288 return ver_it->version;
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Class PANEL_PACKAGE_BASE.
wxStaticBitmap * m_bitmap
SPLIT_BUTTON * m_splitButton
void OnClick(wxMouseEvent &event) override
void OnUninstallClick(wxCommandEvent &event)
wxMenuItem * m_actionMenuItem
void OnPinVersionClick(wxCommandEvent &event)
void OnPaint(wxPaintEvent &event) override
void SetSelected(bool aSelected)
void OnButtonClicked(wxCommandEvent &event) override
Changes state of the (un)install button.
const ActionCallback & m_actionCallback
const PinCallback & m_pinCallback
wxMenuItem * m_pinVersionMenuItem
void SetState(PCM_PACKAGE_STATE aState, bool aPinned)
Called when anywhere on the panel is clicked (except install button)
PANEL_PACKAGE(wxWindow *parent, const ActionCallback &aCallback, const PinCallback &aPinCallback, const PACKAGE_VIEW_DATA &aData)
Sets callback for OnClick action.
void OnSize(wxSizeEvent &event) override
Get preferred version. If criteria are not met, return wxEmptyString.
std::function< void()> m_selectCallback
void SetSelectCallback(const std::function< void()> &aCallback)
Marks panel as selected.
wxString GetPreferredVersion() const
const int minSize
Push and Shove router track width and via size dialog.
std::function< void(const wxString &aPackageId, const PCM_PACKAGE_STATE aState, const bool aPinned)> PinCallback
std::function< void(const PACKAGE_VIEW_DATA &aData, PCM_PACKAGE_ACTION aAction, const wxString &aVersion)> ActionCallback
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
< Package version metadata Package metadata
< Collection of data relevant to the package display panel Callback for (un)install button
const PCM_PACKAGE package
std::vector< PACKAGE_VERSION > versions