protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { if (evtBind == null) { return(null); } //get existing method names ICollection IColl = evtBind.GetCompatibleMethods(evtBind.GetEvent(Property)); string[] methods = new string [IColl.Count + 1]; IColl.CopyTo(methods, 1); //add a suggestion methods [0] = evtBind.CreateUniqueMethodName((IComponent)Instance, evtBind.GetEvent(Property)); EventEditor combo = new EventEditor(evtBind, methods); if (Value != null) { combo.Entry.Text = (string)Value; } combo.WidthRequest = 30; //Don't artificially inflate the width. It expands anyway. return(combo); }
protected override void OnStateChanged(Gtk.StateType previous_state) { base.OnStateChanged(previous_state); entry.Sensitive = State != StateType.Insensitive; filter_button.Sensitive = State != StateType.Insensitive; clear_button.Sensitive = State != StateType.Insensitive; }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { if (optInteger) { return(new OptIntRange(0, null)); } else { return(new IntRangeEditor()); } }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { if (valueSelector) { return(new TextEditor()); } //if (optInteger) // return new OptIntRange(0, null); //else return(new FloatRangeEditor()); }
public static void PaintFlatBox(Gtk.Style style, Gdk.Drawable window, Gtk.StateType state_type, Gtk.ShadowType shadow_type, Gdk.Rectangle?area, Gtk.Widget widget, string detail, int x, int y, int width, int height) { IntPtr native_area = area == null ? IntPtr.Zero : GLib.Marshaller.StructureToPtrAlloc(area); IntPtr native_detail = GLib.Marshaller.StringToPtrGStrdup(detail); gtk_paint_flat_box(style == null ? IntPtr.Zero : style.Handle, window == null ? IntPtr.Zero : window.Handle, (int)state_type, (int)shadow_type, native_area, widget == null ? IntPtr.Zero : widget.Handle, native_detail, x, y, width, height); if (area != null) { area = Gdk.Rectangle.New(native_area); Marshal.FreeHGlobal(native_area); } GLib.Marshaller.Free(native_detail); }
protected Gdk.Pixbuf GetPixbuf(Gtk.StateType aState) { switch (aState) { case StateType.Normal: return(base.Pixbuf); default: if (statePixbufs[(int)aState] == null) { return(base.Pixbuf); } return(statePixbufs[(int)aState]); } return(base.Pixbuf); }
void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state) { Gtk.ShadowType sh = (bool)Active ? Gtk.ShadowType.In : Gtk.ShadowType.Out; int s = (int)(scaleFactor * Size) - 1; if (s > bounds.Height) { s = bounds.Height; } if (s > bounds.Width) { s = bounds.Width; } Gtk.Style.PaintCheck(Container.Style, window, state, sh, bounds, Container, "checkbutton", bounds.X + indicatorSpacing - 1, bounds.Y + (bounds.Height - s) / 2, s, s); }
protected virtual void ExposeWidget(bool aFocus, bool aPrelight, Gdk.Rectangle aClipRegion, Gdk.EventExpose evnt) { Widget wdg = this; Gdk.Rectangle rect = Allocation.Copy(); Gdk.Rectangle clip = aClipRegion; Gdk.Rectangle borderclip = aClipRegion; borderclip.X += buttonStyle.XThickness; borderclip.Y += buttonStyle.YThickness; borderclip.Width -= buttonStyle.XThickness * 2; borderclip.Height -= buttonStyle.YThickness * 2; if (wdg.IsSensitive() == false) { Style.PaintFlatBox(buttonStyle, GdkWindow, StateType.Insensitive, ShadowType.Out, clip, wdg, "button", rect.X, rect.Y, rect.Width, rect.Height); Style.PaintBox(buttonStyle, GdkWindow, StateType.Insensitive, ShadowType.Out, clip, wdg, "button", rect.X, rect.Y, rect.Width, rect.Height); } else { if (HasDefault == true) { Style.PaintBox(buttonStyle, GdkWindow, StateType.Selected, ShadowType.Out, clip, wdg, "button", rect.X, rect.Y, rect.Width, rect.Height); } Gtk.StateType st = StateType.Normal; if (aFocus == true) { st = StateType.Selected; } else if (aPrelight == true) { st = StateType.Prelight; } Style.PaintBox(buttonStyle, GdkWindow, st, ShadowType.Out, borderclip, wdg, "buttondefault", rect.X, rect.Y, rect.Width, rect.Height); } }
public static Gtk.StateFlags ToGtk3StateFlags(this Gtk.StateType state) { switch (state) { case Gtk.StateType.Active: return(Gtk.StateFlags.Active); case Gtk.StateType.Prelight: return(Gtk.StateFlags.Prelight); case Gtk.StateType.Insensitive: return(Gtk.StateFlags.Insensitive); case Gtk.StateType.Focused: return(Gtk.StateFlags.Active); case Gtk.StateType.Inconsistent: return(Gtk.StateFlags.Normal); case Gtk.StateType.Selected: return(Gtk.StateFlags.Selected); } return(Gtk.StateFlags.Normal); }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { return(new FlagsEditor()); }
protected override void OnStateChanged(Gtk.StateType previous_state) { base.OnStateChanged(previous_state); Sensitive = State != StateType.Insensitive; }
protected override IPropertyEditor CreateEditor (Gdk.Rectangle cell_area, Gtk.StateType state) { return new DateTimeEditor (); }
public static void SetBackgroundColor(this Gtk.Widget widget, Gtk.StateType state, Xwt.Drawing.Color color) { widget.SetBackgroundColor(state.ToGtk3StateFlags(), color); }
public static Xwt.Drawing.Color GetBackgroundColor(this Gtk.Widget widget, Gtk.StateType state) { return(widget.GetBackgroundColor(state.ToGtk3StateFlags())); }
public DayDescription(string aDescription, Gtk.StateType aState, object[] aIconicState) { Description = aDescription; State = aState; IconicState = aIconicState; }
public void Render(Cairo.Context cr, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CairoCellRendererState state) { if (!visible) { return; } int width, height; CairoHelper.GetToyTextMetrics(font_size, text, out width, out height); // pad the requested size with the selection outline width += SELECTION_PAD * 2; height += SELECTION_PAD * 2; int x = cell_area.X + (cell_area.Width / 2) - (width / 2) + SELECTION_PAD; int y = cell_area.Y + SELECTION_PAD; cr.Save(); Gtk.StateType state_type = StateType.Normal; if ((state & CairoCellRendererState.Selected) == CairoCellRendererState.Selected) { state_type = StateType.Selected; CairoHelper.RoundedRectangle(cr, x - SELECTION_PAD, y - SELECTION_PAD, width, height, 10); //cr.Color = CairoHelper.GetCairoColor (widget.Style.Background (state_type)); cr.SetSourceRGBA(CairoHelper.GetCairoColor(widget.Style.Background(state_type)).R, CairoHelper.GetCairoColor(widget.Style.Background(state_type)).G, CairoHelper.GetCairoColor(widget.Style.Background(state_type)).B, CairoHelper.GetCairoColor(widget.Style.Background(state_type)).A); cr.Fill(); } if (font_color.Equal(Gdk.Color.Zero)) { //cr.Color = CairoHelper.GetCairoColor (widget.Style.Text (state_type)); cr.SetSourceRGBA(CairoHelper.GetCairoColor(widget.Style.Text(state_type)).R, CairoHelper.GetCairoColor(widget.Style.Text(state_type)).G, CairoHelper.GetCairoColor(widget.Style.Text(state_type)).B, CairoHelper.GetCairoColor(widget.Style.Text(state_type)).A); } else { //cr.Color = CairoHelper.GetCairoColor (font_color); cr.SetSourceRGBA(CairoHelper.GetCairoColor(font_color).R, CairoHelper.GetCairoColor(font_color).G, CairoHelper.GetCairoColor(font_color).B, CairoHelper.GetCairoColor(font_color).A); } CairoHelper.PaintToyText(cr, font_size, text, x, y, true, width - (SELECTION_PAD * 2)); if ((state & CairoCellRendererState.Focused) == CairoCellRendererState.Focused) { cr.Rectangle(x - SELECTION_PAD, y - SELECTION_PAD, width, height); CairoHelper.PaintFocus(cr, widget.Style, StateType.Normal); } cr.Restore(); }
public virtual void Render(CellContext context, Gtk.StateType state, double cellWidth, double cellHeight) { }
protected override IInspectorEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { return(new TimeSpanEditor()); }
public override void Render(Gdk.Drawable window, Cairo.Context ctx, Gdk.Rectangle bounds, Gtk.StateType state) { var values = Enum.GetValues(Property.PropertyType); if (values.Length < MaxCheckCount) { if (style == null) { InitializeStyle(Container); } var container = (Widget)Container; using (var layout = new Pango.Layout(container.PangoContext)) { layout.Width = -1; layout.FontDescription = FontService.SansFont.CopyModified(Ide.Gui.Styles.FontScale11); ulong value = Convert.ToUInt64(Value); int dy = 2; foreach (var val in values) { ulong uintVal = Convert.ToUInt64(val); Gtk.ShadowType sh = (value & uintVal) != 0 ? Gtk.ShadowType.In : Gtk.ShadowType.Out; if (value == 0 && uintVal == 0) { sh = Gtk.ShadowType.In; } int s = indicatorSize - 1; Gtk.Style.PaintCheck(style, window, state, sh, bounds, Container, "checkbutton", bounds.X + indicatorSpacing - 1, bounds.Y + dy, s, s); layout.SetText(val.ToString()); int tw, th; layout.GetPixelSize(out tw, out th); ctx.Save(); ctx.SetSourceColor(container.Style.Text(state).ToCairoColor()); ctx.MoveTo(bounds.X + indicatorSize + indicatorSpacing, dy + bounds.Y + ((indicatorSize - th) / 2)); Pango.CairoHelper.ShowLayout(ctx, layout); ctx.Restore(); dy += indicatorSize + CheckSpacing; } } } else { base.Render(window, ctx, bounds, state); return; } }