22#include <wx/dcclient.h>
37 SetMinSize( FromDIP( GetMinSize() ) );
44 wxColour bgColor = wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK );
45 m_desc->SetBackgroundColour( bgColor );
46 m_name->SetBackgroundColour( bgColor );
47 m_bitmap->SetBackgroundColour( bgColor );
55 m_desc->SetMinSize( wxSize( 0, -1 ) );
59 double descLineHeight =
m_desc->GetTextExtent( wxT(
"X" ) ).GetHeight() * 1.2 ;
62#if wxCHECK_VERSION( 3, 3, 2 )
63 m_desc->SetWindowStyle( wxST_WRAP );
68 descLineHeight = wxSplit(
m_desc->GetLabel(),
'\n' ).size() * descLineHeight;
70 int nameLineHeight =
m_name->GetTextExtent( wxT(
"X" ) ).GetHeight();
80 splitMenu->Append( wxID_ANY,
_(
"Pin package" ),
81 _(
"Pinned packages don't affect available update notification and "
82 "will not be updated with 'Update All' button." ),
90 m_warningIcon->SetToolTip(
_(
"Warning: This plugin only supports the legacy Python API "
91 "and will not run in this KiCad version." ) );
102 double descLineHeight =
m_desc->GetTextExtent( wxT(
"X" ) ).GetHeight() * 1.2 ;
104#if !wxCHECK_VERSION( 3, 3, 2 )
109 descLineHeight = wxSplit(
m_desc->GetLabel(),
'\n' ).size() * descLineHeight;
111 int nameLineHeight =
m_name->GetTextExtent( wxT(
"X" ) ).GetHeight();
152 m_button->SetLabel(
_(
"Install Pending" ) );
158 m_button->SetLabel(
_(
"Uninstall Pending" ) );
172 m_splitButton->GetSplitButtonMenu()->Bind( wxEVT_COMMAND_MENU_SELECTED,
183 m_splitButton->GetSplitButtonMenu()->Bind( wxEVT_COMMAND_MENU_SELECTED,
191 m_button->SetLabel(
_(
"Update Pending" ) );
207 if( version.IsEmpty() )
225 m_data.pinned =
event.IsChecked();
241 wxLogError( wxT(
"Uninstall clicked in unexpected state" ) );
260 wxRect rect( wxPoint( 1, 1 ), GetClientSize() - wxSize( 1, 1 ) );
261 wxPaintDC dc(
this );
262 dc.SetBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK ) );
263 dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ), 1 ) );
268 dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_HOTLIGHT ), 3 ) );
271 dc.DrawRectangle( rect );
287 auto ver_it = std::find_if(
m_data.package.versions.begin(),
m_data.package.versions.end(),
290 return ver.compatible && ver.status == PVS_STABLE;
294 if( ver_it ==
m_data.package.versions.end() )
296 ver_it = std::find_if(
m_data.package.versions.begin(),
m_data.package.versions.end(),
299 return ver.compatible;
303 if( ver_it ==
m_data.package.versions.end() )
304 return wxEmptyString;
306 return ver_it->version;
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
wxStaticBitmap * m_bitmap
PANEL_PACKAGE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxBORDER_NONE|wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
SPLIT_BUTTON * m_splitButton
wxStaticBitmap * m_warningIcon
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
< Package version metadataPackage metadata
< Collection of data relevant to the package display panelCallback for (un)install button