Esempio n. 1
0
 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);
        }
Esempio n. 3
0
 public override void Render(Gdk.Drawable window, Gdk.Rectangle bounds, Gtk.StateType state)
 {
     if (HasValue)
     {
         base.Render(window, bounds, state);
     }
 }
Esempio n. 4
0
        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;
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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;
            }
        }
Esempio n. 8
0
 protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state)
 {
     if (optInteger)
     {
         return(new OptIntRange(0, null));
     }
     else
     {
         return(new IntRangeEditor());
     }
 }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
 /// <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);
 }
Esempio n. 14
0
 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);
 }
Esempio n. 15
0
 public static void SetForegroundColor(this Gtk.Widget widget, Gtk.StateType state, Xwt.Drawing.Color color)
 {
     widget.ModifyFg(state, color.ToGtkValue());
 }
Esempio n. 16
0
 public static Xwt.Drawing.Color GetTextColor(this Gtk.Widget widget, Gtk.StateType state)
 {
     return(widget.Style.Text(state).ToXwtValue());
 }
Esempio n. 17
0
 protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state)
 {
     return(new EnumerationEditor());
 }
Esempio n. 18
0
 public static void SetTextColor(this Gtk.Widget widget, Gtk.StateType state, Xwt.Drawing.Color color)
 {
     widget.ModifyText(state, color.ToGtkValue());
 }
Esempio n. 19
0
 protected override IInspectorEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state)
 {
     return(new BooleanEditor());
 }
Esempio n. 20
0
 protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state)
 {
     return(new MonoreportsColorEditor());
 }
Esempio n. 21
0
        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);
        }
Esempio n. 22
0
 protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state)
 {
     return(new ResponseIdEditor());
 }
Esempio n. 23
0
 public static Xwt.Drawing.Color GetForegroundColor(this Gtk.Widget widget, Gtk.StateType state)
 {
     return(widget.Style.Foreground(state).ToXwtValue());
 }
Esempio n. 24
0
 public void ModifyBase(Gtk.StateType state)
 {
     gtk_widget_modify_base(Handle, (int)state, IntPtr.Zero);
 }
Esempio n. 25
0
 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());
 }
Esempio n. 27
0
 protected override IPropertyEditor CreateEditor(Gdk.Rectangle cell_area, Gtk.StateType state)
 {
     return(new BooleanEditor {
         State = state
     });
 }
Esempio n. 28
0
 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);
     }
 }
Esempio n. 29
0
 public void ModifyText(Gtk.StateType state)
 {
     gtk_widget_modify_text(Handle, (int)state, IntPtr.Zero);
 }
Esempio n. 30
0
 protected override void OnStateChanged(Gtk.StateType previous_state)
 {
     base.OnStateChanged(previous_state);
     SetDefaultCursor();
     UpdateBackground();
 }