public ColorField(PropertyInfo property, object obj, Context context, DisplayableAttribute attribute) { this.property = property; this.obj = (IGUIComplete)obj; this.context = context; Label label = new Label(UIFactory.ToReadable(property.Name) + ": "); PackStart(label, false, false, 0); colorButton = new ClickableEventBox { VisibleWindow = true, BorderWidth = 1 }; Graphics.SetAllBg(colorButton, (Gdk.Color)property.GetValue(obj)); PackStart(colorButton, false, false, 0); if (attribute.tooltipText != "") { HasTooltip = true; TooltipMarkup = attribute.tooltipText; } colorButton.SetSizeRequest(0, 0); SizeAllocated += InitializeDisplay; colorButton.DoubleClicked += OpenPicker; }
public void InitializeDisplay(object obj, SizeAllocatedArgs args) { SizeAllocated -= InitializeDisplay; colorButton.SetSizeRequest(args.Allocation.Height, 0); }