Skip to content

Commit

Permalink
#5097: Instead of setting the icons ourselves, tell wxWidgets about t…
Browse files Browse the repository at this point in the history
…he images it needs to render when the toggle is active/inactive
  • Loading branch information
codereader committed Nov 19, 2020
1 parent 41d4a84 commit de1bffd
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions radiant/ui/layers/LayerControl.cpp
Expand Up @@ -120,18 +120,13 @@ void LayerControl::update()

bool isActive = layerSystem.getActiveLayer() == _layerID;

std::string imageName;

if (isActive)
{
imageName = layerIsVisible ? ICON_LAYER_ACTIVE_VISIBLE : ICON_LAYER_ACTIVE_HIDDEN;
}
else
{
imageName = layerIsVisible ? ICON_LAYER_VISIBLE : ICON_LAYER_HIDDEN;
}
std::string toggledImage = isActive ? ICON_LAYER_ACTIVE_VISIBLE : ICON_LAYER_VISIBLE;
std::string untoggledImage = isActive ? ICON_LAYER_ACTIVE_HIDDEN : ICON_LAYER_HIDDEN;

_toggle->SetBitmap(wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + imageName));
// Bitmap for disabled state
_toggle->SetBitmap(wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + untoggledImage));
// Bitmap for depressed state (active toggle state)
_toggle->SetBitmapPressed(wxArtProvider::GetBitmap(GlobalUIManager().ArtIdPrefix() + toggledImage));

// Don't allow deleting or renaming layer 0
_deleteButton->Enable(_layerID != 0);
Expand Down

0 comments on commit de1bffd

Please sign in to comment.