コード例 #1
0
        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;
        }
コード例 #2
0
 public void InitializeDisplay(object obj, SizeAllocatedArgs args)
 {
     SizeAllocated -= InitializeDisplay;
     colorButton.SetSizeRequest(args.Allocation.Height, 0);
 }