Skip to content

Commit

Permalink
! Tweak style of buttons on symbol list
Browse files Browse the repository at this point in the history
  • Loading branch information
wmjordan committed Jun 26, 2023
1 parent 7f84301 commit 88d9aa2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Codist/Controls/SymbolMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ public SymbolMenu(SemanticContext semanticContext, SymbolListType listType) : ba
new Separator()
}
};
HeaderButtons = new StackPanel {
Orientation = Orientation.Horizontal,
Children = {
new ThemedButton(ThemeHelper.GetImage(IconIds.TogglePinning), R.CMD_Pin, TogglePinButton),
HeaderButtons = new ThemedControlGroup()
.AddRange(
new ThemedToggleButton(IconIds.TogglePinning, R.CMD_Pin, TogglePinButton),
new ThemedButton(IconIds.Close, R.CMD_Close, () => {
var a = _ExternalAdornment;
a.RemoveAndDispose(this);
a.FocusOnTextView();
})
}
};
}));
MouseLeftButtonUp += MenuItemSelect;
_ExternalAdornment.MakeDraggable(this);
}
Expand All @@ -59,7 +56,7 @@ public override void Dispose() {
}

void TogglePinButton(object sender, RoutedEventArgs e) {
((ThemedButton)e.Source).Content = ThemeHelper.GetImage((IsPinned = !IsPinned) ? IconIds.Pin : IconIds.Unpin);
((ThemedToggleButton)e.Source).Content = ThemeHelper.GetImage((IsPinned = !IsPinned) ? IconIds.Pin : IconIds.Unpin);
}

public void Show(UIElement relativeElement = null) {
Expand Down
6 changes: 6 additions & 0 deletions Codist/Controls/ThemedButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ public ThemedToggleButton(int imageId, string toolTip) {
this.ReferenceCrispImageBackground(EnvironmentColors.MainWindowActiveCaptionColorKey);
}

public ThemedToggleButton(int imageId, string toolTip, RoutedEventHandler changedHandler)
: this(imageId, toolTip) {
Checked += changedHandler;
Unchecked += changedHandler;
}

public TextBlock Text {
get => _Text;
set {
Expand Down

0 comments on commit 88d9aa2

Please sign in to comment.