public SparkleDataSource (float backing_scale_factor, List<Preset> presets)
{
Items = new List <object> ();
Cells = new NSAttributedString [presets.Count];
SelectedCells = new NSAttributedString [presets.Count];
this.backing_scale_factor = (int) backing_scale_factor;
int i = 0;
foreach (Preset preset in presets) {
Items.Add (preset);
NSTextFieldCell cell = new NSTextFieldCell ();
NSData name_data = NSData.FromString ("<font face='" + UserInterface.FontName + "'><b>" + preset.Name + "</b></font>");
NSDictionary name_dictionary = new NSDictionary();
NSAttributedString name_attributes = new NSAttributedString (
name_data, new NSUrl ("file://"), out name_dictionary);
NSData description_data = NSData.FromString (
"<small><font style='line-height: 150%' color='#aaa' face='" + UserInterface.FontName + "'>" + preset.Description + "</font></small>");
NSDictionary description_dictionary = new NSDictionary();
NSAttributedString description_attributes = new NSAttributedString (
description_data, new NSUrl ("file://"), out description_dictionary);
NSMutableAttributedString mutable_attributes = new NSMutableAttributedString (name_attributes);
mutable_attributes.Append (new NSAttributedString ("\n"));
mutable_attributes.Append (description_attributes);
cell.AttributedStringValue = mutable_attributes;
Cells [i] = (NSAttributedString) cell.ObjectValue;
NSTextFieldCell selected_cell = new NSTextFieldCell ();
NSData selected_name_data = NSData.FromString (
"<font color='white' face='" + UserInterface.FontName +"'><b>" + preset.Name + "</b></font>");
NSDictionary selected_name_dictionary = new NSDictionary ();
NSAttributedString selected_name_attributes = new NSAttributedString (
selected_name_data, new NSUrl ("file://"), out selected_name_dictionary);
NSData selected_description_data = NSData.FromString (
"<small><font style='line-height: 150%' color='#9bbaeb' face='" + UserInterface.FontName + "'>" +
preset.Description + "</font></small>");
NSDictionary selected_description_dictionary = new NSDictionary ();
NSAttributedString selected_description_attributes = new NSAttributedString (
selected_description_data, new NSUrl ("file://"), out selected_description_dictionary);
NSMutableAttributedString selected_mutable_attributes =
new NSMutableAttributedString (selected_name_attributes);
selected_mutable_attributes.Append (new NSAttributedString ("\n"));
selected_mutable_attributes.Append (selected_description_attributes);
selected_cell.AttributedStringValue = selected_mutable_attributes;
SelectedCells [i] = (NSAttributedString) selected_cell.ObjectValue;
i++;
}
}