22#include <wx/dcclient.h>
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();
134 m_button->SetLabel(
_(
"Install Pending" ) );
140 m_button->SetLabel(
_(
"Uninstall Pending" ) );
154 m_splitButton->GetSplitButtonMenu()->Bind( wxEVT_COMMAND_MENU_SELECTED,
165 m_splitButton->GetSplitButtonMenu()->Bind( wxEVT_COMMAND_MENU_SELECTED,
173 m_button->SetLabel(
_(
"Update Pending" ) );
189 if( version.IsEmpty() )
207 m_data.pinned =
event.IsChecked();
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 );
269 auto ver_it = std::find_if(
m_data.package.versions.begin(),
m_data.package.versions.end(),
272 return ver.compatible && ver.status == PVS_STABLE;
276 if( ver_it ==
m_data.package.versions.end() )
278 ver_it = std::find_if(
m_data.package.versions.begin(),
m_data.package.versions.end(),
281 return ver.compatible;
285 if( ver_it ==
m_data.package.versions.end() )
286 return wxEmptyString;
288 return ver_it->version;
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
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 metadataPackage metadata
< Collection of data relevant to the package display panelCallback for (un)install button