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#if wxCHECK_VERSION( 3, 3, 2 )
60 m_desc->SetWindowStyle( wxST_WRAP );
65 descLineHeight = wxSplit(
m_desc->GetLabel(),
'\n' ).size() * descLineHeight;
67 int nameLineHeight =
m_name->GetTextExtent( wxT(
"X" ) ).GetHeight();
77 splitMenu->Append( wxID_ANY,
_(
"Pin package" ),
78 _(
"Pinned packages don't affect available update notification and "
79 "will not be updated with 'Update All' button." ),
94 double descLineHeight =
m_desc->GetTextExtent( wxT(
"X" ) ).GetHeight() * 1.2 ;
96#if !wxCHECK_VERSION( 3, 3, 2 )
101 descLineHeight = wxSplit(
m_desc->GetLabel(),
'\n' ).size() * descLineHeight;
103 int nameLineHeight =
m_name->GetTextExtent( wxT(
"X" ) ).GetHeight();
144 m_button->SetLabel(
_(
"Install Pending" ) );
150 m_button->SetLabel(
_(
"Uninstall Pending" ) );
164 m_splitButton->GetSplitButtonMenu()->Bind( wxEVT_COMMAND_MENU_SELECTED,
175 m_splitButton->GetSplitButtonMenu()->Bind( wxEVT_COMMAND_MENU_SELECTED,
183 m_button->SetLabel(
_(
"Update Pending" ) );
199 if( version.IsEmpty() )
217 m_data.pinned =
event.IsChecked();
233 wxLogError( wxT(
"Uninstall clicked in unexpected state" ) );
252 wxRect rect( wxPoint( 1, 1 ), GetClientSize() - wxSize( 1, 1 ) );
253 wxPaintDC dc(
this );
254 dc.SetBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_FRAMEBK ) );
255 dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ), 1 ) );
260 dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_HOTLIGHT ), 3 ) );
263 dc.DrawRectangle( rect );
279 auto ver_it = std::find_if(
m_data.package.versions.begin(),
m_data.package.versions.end(),
282 return ver.compatible && ver.status == PVS_STABLE;
286 if( ver_it ==
m_data.package.versions.end() )
288 ver_it = std::find_if(
m_data.package.versions.begin(),
m_data.package.versions.end(),
291 return ver.compatible;
295 if( ver_it ==
m_data.package.versions.end() )
296 return wxEmptyString;
298 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