public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state) { Gdk.GC gc = new Gdk.GC(window); gc.RgbFgColor = (Gdk.Color)Value; window.DrawRectangle(gc, true, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); window.DrawRectangle(Container.Style.BlackGC, false, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); }
public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state) { int yd = (bounds.Height - ColorBoxSize) * 4 / 5; int width = ColorBoxSize * 2 - 1; int heigth = ColorBoxSize - 1; Cairo.Context cr = Gdk.CairoHelper.Create(window); // black cross to show alpha cr.LineWidth = 2; cr.SetSourceColor(new Cairo.Color(0, 0, 0)); cr.MoveTo(bounds.X, bounds.Y + yd); cr.LineTo(bounds.X + width, bounds.Y + heigth); cr.MoveTo(bounds.X, bounds.Y + yd + heigth); cr.LineTo(bounds.X + width, bounds.Y); cr.Stroke(); // rect around, also only visible with alpha cr.Rectangle(bounds.X, bounds.Y + yd, width, heigth); cr.Stroke(); // fill with color cr.SetSourceColor(GetCairoColor()); cr.Rectangle(bounds.X, bounds.Y + yd, width, heigth); cr.Fill(); cr.Dispose(); bounds.X += width + ColorBoxSpacing; bounds.Width -= heigth + ColorBoxSpacing; base.Render(window, bounds, state); }
public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state) { if (HasValue) { base.Render(window, bounds, state); } }
public bool StateIsRunning(Gtk.StateType state, out double progress) { bool raw_ret = gtk_style_context_state_is_running(Handle, (int)state, out progress); bool ret = raw_ret; return(ret); }
protected override void OnStateChanged(Gtk.StateType previous_state) { base.OnStateChanged(previous_state); entry.Sensitive = State != Gtk.StateType.Insensitive; filter_button.Sensitive = State != Gtk.StateType.Insensitive; clear_button.Sensitive = State != Gtk.StateType.Insensitive; }
public Gdk.Pixbuf RenderIcon(Gtk.Style style, Gtk.TextDirection direction, Gtk.StateType state, Gtk.IconSize size, Gtk.Widget widget, string detail) { IntPtr native_detail = GLib.Marshaller.StringToPtrGStrdup(detail); IntPtr raw_ret = gtk_icon_set_render_icon(Handle, style == null ? IntPtr.Zero : style.Handle, (int)direction, (int)state, (int)size, widget == null ? IntPtr.Zero : widget.Handle, native_detail); Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; GLib.Marshaller.Free(native_detail); return(ret); }
protected override void OnStateChanged(Gtk.StateType previous_state) { base.OnStateChanged(previous_state); //while the menu's open, make sure the button looks depressed if (isOpen && this.State != Gtk.StateType.Active) { this.State = Gtk.StateType.Active; } }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { if (optInteger) { return(new OptIntRange(0, null)); } else { return(new IntRangeEditor()); } }
public unsafe Gdk.Pixbuf LoadSymbolicForStyle(Gtk.Style style, Gtk.StateType state, out bool was_symbolic) { IntPtr error = IntPtr.Zero; IntPtr raw_ret = gtk_icon_info_load_symbolic_for_style(Handle, style == null ? IntPtr.Zero : style.Handle, (int)state, out was_symbolic, out error); Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf; if (error != IntPtr.Zero) { throw new GLib.GException(error); } return(ret); }
public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state) { Gdk.GC gc = new Gdk.GC(window); gc.RgbFgColor = GetColor(); int yd = (bounds.Height - ColorBoxSize) / 2; window.DrawRectangle(gc, true, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1); window.DrawRectangle(Container.Style.BlackGC, false, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1); bounds.X += ColorBoxSize + ColorBoxSpacing; bounds.Width -= ColorBoxSize + ColorBoxSpacing; base.Render(window, bounds, state); }
public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state) { Gtk.ShadowType sh = (bool)Value ? Gtk.ShadowType.In : Gtk.ShadowType.Out; int s = indicatorSize - 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); }
public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state) { int iy = bounds.Y + (bounds.Height - imgSize) / 2; if (image != null) { int dy = (imgSize - image.Height) / 2; int dx = (imgSize - image.Width) / 2; window.DrawPixbuf(Container.Style.BackgroundGC(state), image, 0, 0, bounds.X + dx, iy + dy, -1, -1, Gdk.RgbDither.None, 0, 0); } window.DrawRectangle(Container.Style.DarkGC(state), false, bounds.X, iy, imgSize - 1, imgSize - 1); bounds.X += imgSize + spacing; base.Render(window, bounds, state); }
/// <summary> /// Sets the background color for a DatePicker in a particular state. /// It also changes his childs background. /// </summary> /// <param name="state">Type.</param> /// <param name="color">Color.</param> public new void ModifyBg(Gtk.StateType state, Gdk.Color color) { base.ModifyBg(state, color); Child.ModifyBg(state, color); }
public void NotifyStateChange(Gdk.Window window, IntPtr region_id, Gtk.StateType state, bool state_value) { gtk_style_context_notify_state_change(Handle, window == null ? IntPtr.Zero : window.Handle, region_id, (int)state, state_value); }
public static void SetForegroundColor(this Gtk.Widget widget, Gtk.StateType state, Xwt.Drawing.Color color) { widget.ModifyFg(state, color.ToGtkValue()); }
public static Xwt.Drawing.Color GetTextColor(this Gtk.Widget widget, Gtk.StateType state) { return(widget.Style.Text(state).ToXwtValue()); }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { return(new EnumerationEditor()); }
public static void SetTextColor(this Gtk.Widget widget, Gtk.StateType state, Xwt.Drawing.Color color) { widget.ModifyText(state, color.ToGtkValue()); }
protected override IInspectorEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { return(new BooleanEditor()); }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { return(new MonoreportsColorEditor()); }
int Expose(bool draw, int testx, int testy, out int ix, out int iy) { int x = spacing; int y = spacing; int sx = spacing; int maxx = columns * (iconSize + spacing) + spacing; bool calcSize = (testx == -1); int w, h, tborder = 1; using (var layout = new Pango.Layout(this.PangoContext)) { Pango.FontDescription des = this.Style.FontDescription.Copy(); des.Size = 10 * (int)Pango.Scale.PangoScale; layout.FontDescription = des; layout.SetMarkup(title); layout.Width = -1; layout.GetPixelSize(out w, out h); if (draw) { GdkWindow.DrawRectangle(this.Style.DarkGC(Gtk.StateType.Normal), true, x, y, Allocation.Width + tborder * 2, h + tborder * 2); GdkWindow.DrawLayout(this.Style.ForegroundGC(Gtk.StateType.Normal), x + tborder + 2, y + tborder, layout); } } if (calcSize) { xmax = 0; } y += h + spacing * 2 + tborder * 2; for (int n = 0; n < icons.Count; n++) { string cmd = names [n] as string; Gdk.Pixbuf pix = icons [n] as Gdk.Pixbuf; if (cmd == "-") { if (x > sx) { y += iconSize + spacing; } x = sx; y -= spacing; if (draw) { Gdk.Rectangle rect = new Gdk.Rectangle(0, y + (sectionGap / 2), Allocation.Width - x, 1); Gtk.Style.PaintHline(this.Style, this.GdkWindow, Gtk.StateType.Normal, rect, this, "", rect.X, rect.Right, rect.Y); } y += sectionGap; continue; } if (cmd == "|") { if (x == sx) { continue; } x += spacing; if (draw) { Gdk.Rectangle rect = new Gdk.Rectangle(x, y, 1, iconSize); Gtk.Style.PaintVline(this.Style, this.GdkWindow, Gtk.StateType.Normal, rect, this, "", rect.Y, rect.Bottom, rect.X); } x += spacing * 2; continue; } if (testx != -1 && testx >= (x - spacing / 2) && testx < (x + iconSize + spacing) && testy >= (y - spacing / 2) && testy < (y + iconSize + spacing)) { ix = x; iy = y; return(n); } if (draw) { Gtk.StateType state = (n == selIndex) ? Gtk.StateType.Selected : Gtk.StateType.Normal; if (n == selIndex) { GdkWindow.DrawRectangle(this.Style.BackgroundGC(state), true, x - spacing, y - spacing, iconSize + spacing * 2, iconSize + spacing * 2); } GdkWindow.DrawPixbuf(this.Style.ForegroundGC(state), pix, 0, 0, x, y, pix.Width, pix.Height, Gdk.RgbDither.None, 0, 0); } x += (iconSize + spacing); if (calcSize && x > xmax) { xmax = x; } if (x >= maxx) { x = sx; y += iconSize + spacing; } } if (calcSize) { if (x > sx) { y += iconSize + spacing; } ymax = y; } ix = iy = 0; return(-1); }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { return(new ResponseIdEditor()); }
public static Xwt.Drawing.Color GetForegroundColor(this Gtk.Widget widget, Gtk.StateType state) { return(widget.Style.Foreground(state).ToXwtValue()); }
public void ModifyBase(Gtk.StateType state) { gtk_widget_modify_base(Handle, (int)state, IntPtr.Zero); }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { return(new ImageSelectorEditor()); }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { return(new StockItemEditor()); }
protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state) { return(new BooleanEditor { State = state }); }
public override void Render(Gdk.Drawable window, Cairo.Context ctx, Gdk.Rectangle bounds, Gtk.StateType state) { using (Gdk.GC gc = new Gdk.GC(window)) { gc.RgbFgColor = GetColor(); int yd = (bounds.Height - ColorBoxSize) / 2; window.DrawRectangle(gc, true, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1); window.DrawRectangle(Container.GetNativeWidget <Gtk.Widget> ().Style.BlackGC, false, bounds.X, bounds.Y + yd, ColorBoxSize - 1, ColorBoxSize - 1); bounds.X += ColorBoxSize + ColorBoxSpacing; bounds.Width -= ColorBoxSize + ColorBoxSpacing; base.Render(window, ctx, bounds, state); } }
public void ModifyText(Gtk.StateType state) { gtk_widget_modify_text(Handle, (int)state, IntPtr.Zero); }
protected override void OnStateChanged(Gtk.StateType previous_state) { base.OnStateChanged(previous_state); SetDefaultCursor(); UpdateBackground(); }