Esempio n. 1
0
        public virtual Allocation Extents(double scale, Cairo.Context graphics)
        {
            Allocation alloc = d_allocation.Copy();

            alloc.Scale(scale);
            alloc.GrowBorder(3);

            string lbl = Label;

            if (!String.IsNullOrEmpty(lbl))
            {
                int width, height;
                MeasureString(graphics, lbl, out width, out height);

                alloc.Height += height + 3;

                if (width > alloc.Width)
                {
                    int off = (int)(width - alloc.Width / 2);
                    alloc.X     -= off;
                    alloc.Width += off * 2;
                }
            }

            d_lastExtents = alloc;
            return(d_lastExtents.Copy());
        }
Esempio n. 2
0
        private void HandleCopied(object o, CopiedArgs args)
        {
            Wrapper wrapped = Wrap(args.Copy);

            wrapped.Allocation = Allocation.Copy();

            if (Renderer != null)
            {
                wrapped.Renderer = Renderer.Copy(wrapped);
            }
        }
Esempio n. 3
0
        public Point[] ControlPoints()
        {
            if (WrappedObject.Input == null || WrappedObject.Output == null)
            {
                return(null);
            }

            Allocation a1 = WrappedObject.Input.Allocation;
            Allocation a2 = WrappedObject.Output.Allocation;

            if (d_prevFrom != null && d_prevTo != null && a1.Equals(d_prevFrom) && a2.Equals(d_prevTo))
            {
                return(d_controlPoints);
            }

            d_prevFrom = a1.Copy();
            d_prevTo   = a2.Copy();

            d_controlPoints = ControlPoints(a1, a2, WrappedObject.Offset);
            return(d_controlPoints);
        }
Esempio n. 4
0
        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);
            }
        }