bool ProjectViewModel::GetAttr( const wxDataViewItem& item, unsigned int column, wxDataViewItemAttr& attr ) const { if ( !item.IsOk() ) { return false; } ProjectViewModelNode *node = static_cast< ProjectViewModelNode* >( item.GetID() ); HELIUM_ASSERT( node ); // bold the entry if the node is active attr.SetBold( node->m_IsActive ); // italicize the entry if it is modified attr.SetItalic( ( node->GetDocument() && node->GetDocument()->HasChanged() ) ); Path nodePath = node->GetPath().GetAbsolutePath( m_Project->a_Path.Get() ); if ( !nodePath.Exists() ) { attr.SetColour( *wxRED ); } else { attr.SetColour( *wxBLACK ); } return true; }
bool ProjectViewModel::GetAttr( const wxDataViewItem& item, unsigned int column, wxDataViewItemAttr& attr ) const { if ( !item.IsOk() ) { return false; } Asset *node = static_cast< Asset* >( item.GetID() ); HELIUM_ASSERT( node ); // bold the entry if the node is active attr.SetBold( node->IsPackage() ); if ( node->GetAllFlagsSet( Asset::FLAG_EDITOR_FORCIBLY_LOADED ) ) { attr.SetColour( *wxBLACK ); } else { attr.SetColour( *wxLIGHT_GREY ); } // italicize the entry if it is modified attr.SetItalic( node->GetAllFlagsSet( Asset::FLAG_CHANGED_SINCE_LOADED ) ); if ( node->GetAllFlagsSet( Asset::FLAG_CHANGED_SINCE_LOADED ) ) { attr.SetColour( *wxRED ); } return true; }
bool LIB_MANAGER_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsigned int aCol, wxDataViewItemAttr& aAttr ) const { if( IsFrozen() ) return false; // change attributes only for the name field if( aCol != 0 ) return false; auto node = ToNode( aItem ); wxCHECK( node, false ); switch( node->Type ) { case CMP_TREE_NODE::LIB: // mark modified libs with bold font aAttr.SetBold( m_libMgr->IsLibraryModified( node->Name ) ); #ifdef __WXGTK__ // The native wxGTK+ impl ignores background colour, so set the text colour instead. // This works reasonably well in dark themes, and quite poorly in light ones.... if( node->Name == m_libMgr->GetCurrentLib() ) aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #else // mark the current library with background color if( node->Name == m_libMgr->GetCurrentLib() ) aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #endif break; case CMP_TREE_NODE::LIBID: // mark modified part with bold font aAttr.SetBold( m_libMgr->IsPartModified( node->Name, node->Parent->Name ) ); // mark aliases with italic font aAttr.SetItalic( !node->IsRoot ); #ifdef __WXGTK__ // The native wxGTK+ impl ignores background colour, so set the text colour instead. // This works reasonably well in dark themes, and quite poorly in light ones.... if( node->LibId == m_libMgr->GetCurrentLibId() ) aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #else // mark the current part with background color if( node->LibId == m_libMgr->GetCurrentLibId() ) aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #endif break; default: return false; } return true; }
bool BOM_TABLE_GROUP::GetAttr( unsigned int aFieldId, wxDataViewItemAttr& aAttr ) const { if( GetFieldValue( aFieldId ).Cmp( ROW_MULT_ITEMS ) == 0 ) { aAttr.SetItalic( true ); aAttr.SetColour( ROW_COLOUR_MULTIPLE_ITEMS ); return true; } return BOM_TABLE_ROW::GetAttr( aFieldId, aAttr ); }
/** * Update cell attributes based on parameters of the cell * Default implementation highlights cells that have been altered */ bool BOM_TABLE_ROW::GetAttr( unsigned int aFieldId, wxDataViewItemAttr& aAttr ) const { auto field = m_columnList->GetColumnById( aFieldId ); if( HasValueChanged( field ) ) { aAttr.SetBold( true ); aAttr.SetItalic( true ); aAttr.SetColour( ROW_COLOUR_ITEM_CHANGED ); return true; } return false; }