Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 283b625

Browse files
authored
Merge pull request #8970 from mono/jstedfast-debugger-icons-selected
[Debugger] Use the ~sel icon variants when the row is selected
2 parents db72257 + 6726b03 commit 283b625

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectCellViewBase.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ public bool IsLoading {
100100
get { return Node is LoadingObjectValueNode; }
101101
}
102102

103-
protected static NSImage GetImage (string name, Gtk.IconSize size)
103+
protected static NSImage GetImage (string name, Gtk.IconSize size, bool selected = false)
104104
{
105105
var icon = ImageService.GetIcon (name, size);
106106

107+
if (selected)
108+
icon = icon.WithStyles ("sel");
109+
107110
try {
108111
return icon.ToNSImage ();
109112
} catch (Exception ex) {
@@ -112,10 +115,13 @@ protected static NSImage GetImage (string name, Gtk.IconSize size)
112115
}
113116
}
114117

115-
protected static NSImage GetImage (string name, Gtk.IconSize size, double alpha)
118+
protected static NSImage GetImage (string name, Gtk.IconSize size, double alpha, bool selected = false)
116119
{
117120
var icon = ImageService.GetIcon (name, size).WithAlpha (alpha);
118121

122+
if (selected)
123+
icon = icon.WithStyles ("sel");
124+
119125
try {
120126
return icon.ToNSImage ();
121127
} catch (Exception ex) {
@@ -124,10 +130,13 @@ protected static NSImage GetImage (string name, Gtk.IconSize size, double alpha)
124130
}
125131
}
126132

127-
protected static NSImage GetImage (string name, int width, int height)
133+
protected static NSImage GetImage (string name, int width, int height, bool selected = false)
128134
{
129135
var icon = ImageService.GetIcon (name).WithSize (width, height);
130136

137+
if (selected)
138+
icon = icon.WithStyles ("sel");
139+
131140
try {
132141
return icon.ToNSImage ();
133142
} catch (Exception ex) {

main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectNameView.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ protected override void UpdateContents ()
171171

172172
OptimalWidth = MarginSize;
173173

174+
bool selected = Superview is NSTableRowView rowView && rowView.Selected;
174175
var iconName = ObjectValueTreeViewController.GetIcon (Node.Flags);
175-
ImageView.Image = GetImage (iconName, Gtk.IconSize.Menu);
176+
ImageView.Image = GetImage (iconName, Gtk.IconSize.Menu, selected);
176177
constraints.Add (ImageView.CenterYAnchor.ConstraintEqualToAnchor (CenterYAnchor));
177178
constraints.Add (ImageView.LeadingAnchor.ConstraintEqualToAnchor (LeadingAnchor, MarginSize));
178179
constraints.Add (ImageView.WidthAnchor.ConstraintEqualToConstant (ImageSize));

main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/Mac/MacDebuggerObjectValueView.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ protected override void UpdateContents ()
188188
}
189189
constraints.Clear ();
190190

191+
bool selected = Superview is NSTableRowView rowView && rowView.Selected;
191192
var editable = TreeView.GetCanEditNode (Node);
192193
var textColor = NSColor.ControlText;
193194
string evaluateStatusIcon = null;
@@ -255,7 +256,7 @@ protected override void UpdateContents ()
255256

256257
// First item: Status Icon -or- Spinner
257258
if (evaluateStatusIcon != null) {
258-
statusIcon.Image = GetImage (evaluateStatusIcon, Gtk.IconSize.Menu);
259+
statusIcon.Image = GetImage (evaluateStatusIcon, Gtk.IconSize.Menu, selected);
259260

260261
if (!statusIconVisible) {
261262
AddSubview (statusIcon);

0 commit comments

Comments
 (0)