Update a few more list/tree views for macOS

(cherry picked from commit 1988aac2b3)
This commit is contained in:
Jon Evans 2024-03-05 08:38:46 -05:00
parent 03120161d3
commit 98d26e77c9
3 changed files with 47 additions and 1 deletions

View File

@ -51,11 +51,30 @@
DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo )
: DIALOG_ABOUT_BASE( aParent ), m_info( aAppInfo )
: DIALOG_ABOUT_BASE( aParent ),
m_images( nullptr ),
m_info( aAppInfo )
{
wxASSERT( aParent != nullptr );
SetEvtHandlerEnabled( false );
#ifdef __WXMAC__
// HiDPI-aware API; will be generally available in wxWidgets 3.4
wxVector<wxBitmapBundle> images;
images.push_back( KiBitmapBundle( BITMAPS::info ) ); // INFORMATION
images.push_back( KiBitmapBundle( BITMAPS::recent ) ); // VERSION
images.push_back( KiBitmapBundle( BITMAPS::preference ) ); // DEVELOPERS
images.push_back( KiBitmapBundle( BITMAPS::editor ) ); // DOCWRITERS
images.push_back( KiBitmapBundle( BITMAPS::library ) ); // LIBRARIANS
images.push_back( KiBitmapBundle( BITMAPS::color_materials ) ); // ARTISTS
images.push_back( KiBitmapBundle( BITMAPS::language ) ); // TRANSLATORS
images.push_back( KiBitmapBundle( BITMAPS::zip ) ); // PACKAGERS
images.push_back( KiBitmapBundle( BITMAPS::tools ) ); // LICENSE
m_notebook->SetImages( images );
#else
// TODO: Change these to 16x16 versions when available
m_images = new wxImageList( 24, 24, false, 9 );
@ -70,6 +89,7 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo )
m_images->Add( KiBitmap( BITMAPS::tools ) ); // LICENSE
m_notebook->SetImageList( m_images );
#endif
if( m_info.GetAppIcon().IsOk() )
{
@ -108,7 +128,9 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo )
DIALOG_ABOUT::~DIALOG_ABOUT()
{
#ifndef __WXMAC__
delete m_images;
#endif
}

View File

@ -57,6 +57,21 @@ DIALOG_GIT_COMMIT::DIALOG_GIT_COMMIT( wxWindow* parent, git_repository* repo,
m_listCtrl->SetColumnWidth( 1, 200 );
// Set up image list for icons
#ifdef __WXMAC__
// HiDPI-aware API; will be generally available in wxWidgets 3.4
wxVector<wxBitmapBundle> stateImages;
stateImages.push_back( wxBitmapBundle() ); // GIT_STATUS_UNTRACKED
stateImages.push_back( KiBitmapBundle( BITMAPS::git_good_check ) ); // GIT_STATUS_CURRENT
stateImages.push_back( KiBitmapBundle( BITMAPS::git_modified ) ); // GIT_STATUS_MODIFIED
stateImages.push_back( KiBitmapBundle( BITMAPS::git_add ) ); // GIT_STATUS_ADDED
stateImages.push_back( KiBitmapBundle( BITMAPS::git_delete ) ); // GIT_STATUS_DELETED
stateImages.push_back( KiBitmapBundle( BITMAPS::git_out_of_date ) ); // GIT_STATUS_BEHIND
stateImages.push_back( KiBitmapBundle( BITMAPS::git_changed_ahead ) ); // GIT_STATUS_AHEAD
stateImages.push_back( KiBitmapBundle( BITMAPS::git_conflict ) ); // GIT_STATUS_CONFLICTED
m_listCtrl->SetNormalImages( stateImages );
m_listCtrl->SetSmallImages( stateImages );
#else
wxImageList* imageList = new wxImageList(
16, 16, true, static_cast<int>( KIGIT_COMMON::GIT_STATUS::GIT_STATUS_LAST ) );
@ -71,6 +86,7 @@ DIALOG_GIT_COMMIT::DIALOG_GIT_COMMIT( wxWindow* parent, git_repository* repo,
// Assign the image list to the list control
m_listCtrl->SetImageList( imageList, wxIMAGE_LIST_SMALL );
#endif
// Populate list control with items
for( auto& [filename, status] : filesToCommit )

View File

@ -80,6 +80,13 @@ HIERARCHY_PANE::HIERARCHY_PANE( SCH_EDIT_FRAME* aParent ) :
SetSizer( sizer );
m_tree = new HIERARCHY_TREE( this );
#ifdef __WXMAC__
// HiDPI-aware API; will be generally available in wxWidgets 3.4
wxVector<wxBitmapBundle> images;
images.push_back( KiBitmapBundle( BITMAPS::tree_nosel ) );
images.push_back( KiBitmapBundle( BITMAPS::tree_sel ) );
m_tree->SetImages( images );
#else
// Make an image list containing small icons
// All icons are expected having the same size.
wxBitmap tree_nosel_bm( KiBitmap( BITMAPS::tree_nosel ) );
@ -90,6 +97,7 @@ HIERARCHY_PANE::HIERARCHY_PANE( SCH_EDIT_FRAME* aParent ) :
imageList->Add( KiBitmap( BITMAPS::tree_sel ) );
m_tree->AssignImageList( imageList );
#endif
sizer->Add( m_tree, 1, wxEXPAND, wxBORDER_NONE, 0 );