Inheritance: Gtk.Frame
コード例 #1
0
        public override Gtk.Widget Create()
        {
            var table = new Gtk.Table ((uint)rows, (uint)cols, false);

            // could add some spacing so cell content won't touch
            // table.ColumnSpacing = table.RowSpacing = 0;

            const uint PadX = 2;
            const uint PadY = 2;

            // axis header, left
            Gtk.Label headerLeft = new Gtk.Label ();
            headerLeft.Markup = "<b>" + HeaderAxisMarkup + "</b>";
            table.Attach (headerLeft, DataColLeft, DataColLeft + 1, DataRowTop - 1, DataRowTop, AttachOptions.Shrink, AttachOptions.Shrink, 0, PadY);

            // table header, right
            Gtk.Label headerRight = new Gtk.Label ();
            headerRight.Markup = "<b>" + HeaderValuesMarkup + "</b>";
            table.Attach (headerRight, DataColLeft + 1, DataColLeft + 2, DataRowTop - 1, DataRowTop, AttachOptions.Shrink, AttachOptions.Shrink, 0, PadY);

            // x axis title
            Gtk.Label titleLeft = new Gtk.Label ();
            titleLeft.Angle = 90;
            titleLeft.Markup = "<b>" + this.axisXMarkup + "</b>";
            table.Attach (titleLeft, 0, 1, 0, (uint)rows, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            // y axis title
            Gtk.Label titleRight = new Gtk.Label ();
            titleRight.Angle = 90;
            titleRight.Markup = "<b>" + this.valuesMarkup + "</b>";
            table.Attach (titleRight, DataColLeft + 2, DataColLeft + 3, 0, (uint)rows, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            // x values
            for (uint i = 0; i < countX; i++) {
                float val = axisX [i];

                Gtk.Label label = new Label ();
                label.Text = val.ToString ();
                label.SetAlignment (1f, 0f);

                BorderWidget widget = new BorderWidget (CalcAxisXColor (val));
                widget.Add (label);

                table.Attach (widget, DataColLeft, DataColLeft + 1, DataRowTop + i, DataRowTop + 1 + i, AttachOptions.Fill, AttachOptions.Shrink, PadX, PadY);
            }

            // y values
            int count = values.Length;
            for (uint i = 0; i < count; i++) {
                float val = values [i];

                Gtk.Widget label = new Label (val.ToString (this.formatValues));
                BorderWidget widget = new BorderWidget (CalcValueColor (val));

                // ShadowType appearance differences might be minimal
                if (val >= this.valuesMax)
                    widget.ShadowType = ShadowType.EtchedOut;
                else if (val <= this.valuesMin)
                    widget.ShadowType = ShadowType.EtchedIn;

                widget.Add (label);

                uint row = DataRowTop + i;
                uint col = DataColLeft + 1;

                table.Attach (widget, col, col + 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            }

            return table;
        }
コード例 #2
0
        public Gtk.Widget Create()
        {
            table = new Gtk.Table((uint)rows, (uint)cols, false);

            Gtk.Label title = new Label();
            title.Markup = this.titleMarkup;
            // label starting at left with SetAlignment also needs AttachOptions.Fill for it to work
            title.SetAlignment(0f, 0.5f);
            table.Attach(title, 0, (uint)cols, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            // add some spacing so cell content won't touch
            table.ColumnSpacing = table.RowSpacing = 0;

            const uint AxisPadX = 2;
            const uint AxisPadY = 2;

            // x axis
            axisWidgetsX = new Widget[countX];
            for (uint i = 0; i < countX; i++)
            {
                Gtk.Label label = new Label();
                label.Text = axisX[i].ToString();

                axisWidgetsX[i] = label;
                table.Attach(label, DataColLeft + i, DataColLeft + 1 + i, DataRowTop - 1, DataRowTop, AttachOptions.Shrink, AttachOptions.Shrink, AxisPadX, AxisPadY);
            }

            // y axis
            axisWidgetsY = new Widget[countY];
            for (uint i = 0; i < countY; i++)
            {
                Gtk.Label label = new Label();
                label.Text = axisY[i].ToString();
                label.SetAlignment(1f, 0f);

                axisWidgetsY[i] = label;
                table.Attach(label, DataColLeft - 1, DataColLeft, DataRowTop + i, DataRowTop + 1 + i, AttachOptions.Fill, AttachOptions.Shrink, AxisPadX, AxisPadY);
            }

            // values
            int countZ = values.Length;

            valueWidgets = new Widget[countZ];
            for (uint i = 0; i < countZ; i++)
            {
                float        val    = values[i];
                Gtk.Widget   label  = new Label(val.ToString(this.formatValues));
                BorderWidget widget = new BorderWidget();

                // ShadowType differences might be minimal
                if (val >= this.valuesMax)
                {
                    widget.Shadow = ShadowType.EtchedOut;
                }
                else if (val <= this.valuesMin)
                {
                    widget.Shadow = ShadowType.EtchedOut;
                }

                widget.Color = CalcColor(val);
                widget.Add(label);

                valueWidgets[i] = widget;
                uint row = DataRowTop + i / (uint)this.countX;
                uint col = DataColLeft + i % (uint)this.countX;

                table.Attach(widget, col, col + 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            }

            // x axis name
            Gtk.Label titleX = new Gtk.Label();
            titleX.Markup = "<b>" + this.axisMarkupX + "</b>";
            //titleX.SetAlignment (0.5f, 0.5f);
            table.Attach(titleX, DataColLeft, (uint)cols, DataRowTop - 2, DataRowTop - 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            // y axis name
            Gtk.Label titleY = new Gtk.Label();
            // Turning on any wrap property causes 0 angle!
            //titleY.Wrap = true;
            //titleY.LineWrap = true;
            //titleY.LineWrapMode = Pango.WrapMode.WordChar;
            titleY.Angle  = 90;
            titleY.Markup = "<b>" + this.axisMarkupY + "</b>";

            //titleY.SetAlignment (0.5f, 0.5f);
            table.Attach(titleY, 0, 1, DataRowTop, (uint)rows, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            //table.Homogeneous = true;
            return(table);
        }
コード例 #3
0
        public override Gtk.Widget Create()
        {
            var table = new Gtk.Table ((uint)rows, (uint)cols, false);

            //var fontDescription = new Pango.FontDescription ();
            //fontDescription.Family = "mono";

            Gtk.Label title = new Label ();
            title.Markup = this.titleMarkup;
            // label starting at left with SetAlignment also needs AttachOptions.Fill for it to work
            title.SetAlignment (0f, 0.5f);
            table.Attach (title, 0, (uint)cols, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            // add some spacing so cell content won't touch
            table.ColumnSpacing = table.RowSpacing = 0;

            const uint AxisPadX = 2;
            const uint AxisPadY = 2;

            // x axis
            for (uint i = 0; i < countX; i++) {
                Gtk.Label label = new Label ();
                float val = axisX [i];
                label.Text = val.ToString ();

                BorderWidget widget = new BorderWidget (CalcAxisXColor (val));
                widget.Add (label);

                table.Attach (widget, DataColLeft + i, DataColLeft + 1 + i, DataRowTop - 1, DataRowTop, AttachOptions.Shrink, AttachOptions.Shrink, AxisPadX, 2 * AxisPadY);
            }

            // y axis
            for (uint i = 0; i < countY; i++) {
                Gtk.Label label = new Label ();
                float val = axisY [i];
                label.Text = val.ToString ();
                label.SetAlignment (1f, 0f);

                BorderWidget widget = new BorderWidget (CalcAxisYColor (val));
                widget.Add (label);

                table.Attach (widget, DataColLeft - 1, DataColLeft, DataRowTop + i, DataRowTop + 1 + i, AttachOptions.Fill, AttachOptions.Shrink, 2 * AxisPadX, AxisPadY);
            }

            // values
            int countZ = values.Length;
            for (uint i = 0; i < countZ; i++) {
                float val = values [i];
                Gtk.Widget label = new Label (val.ToString (this.formatValues));
                //label.ModifyFont (fontDescription);

                BorderWidget widget = new BorderWidget (CalcValueColor (val));

                // ShadowType differences might be minimal
                if (val >= this.valuesMax)
                    widget.ShadowType = ShadowType.EtchedOut;
                else if (val <= this.valuesMin)
                    widget.ShadowType = ShadowType.EtchedIn;
                widget.Add (label);

                uint row = DataRowTop + i / (uint)this.countX;
                uint col = DataColLeft + i % (uint)this.countX;

                table.Attach (widget, col, col + 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            }

            // x axis name
            Gtk.Label titleX = new Gtk.Label ();
            titleX.Markup = "<b>" + this.axisXMarkup + "</b>";
            //titleX.SetAlignment (0.5f, 0.5f);
            table.Attach (titleX, DataColLeft, (uint)cols, DataRowTop - 2, DataRowTop - 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            // y axis name
            Gtk.Label titleY = new Gtk.Label ();
            // Turning on any wrap property causes 0 angle!
            //titleY.Wrap = true;
            //titleY.LineWrap = true;
            //titleY.LineWrapMode = Pango.WrapMode.WordChar;
            titleY.Angle = 90;
            titleY.Markup = "<b>" + this.axisYMarkup + "</b>";

            //titleY.SetAlignment (0.5f, 0.5f);
            table.Attach (titleY, 0, 1, DataRowTop, (uint)rows, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            //table.Homogeneous = true;
            return table;
        }
コード例 #4
0
ファイル: TableWidget2D.cs プロジェクト: spegelref/ScoobyRom
        public override Gtk.Widget Create()
        {
            var table = new Gtk.Table((uint)rows, (uint)cols, false);

            // could add some spacing so cell content won't touch
            // table.ColumnSpacing = table.RowSpacing = 0;

            const uint PadX = 2;
            const uint PadY = 2;

            // axis header, left
            Gtk.Label headerLeft = new Gtk.Label();
            headerLeft.Markup = "<b>" + HeaderAxisMarkup + "</b>";
            table.Attach(headerLeft, DataColLeft, DataColLeft + 1, DataRowTop - 1, DataRowTop, AttachOptions.Shrink, AttachOptions.Shrink, 0, PadY);

            // table header, right
            Gtk.Label headerRight = new Gtk.Label();
            headerRight.Markup = "<b>" + HeaderValuesMarkup + "</b>";
            table.Attach(headerRight, DataColLeft + 1, DataColLeft + 2, DataRowTop - 1, DataRowTop, AttachOptions.Shrink, AttachOptions.Shrink, 0, PadY);

            // x axis title
            Gtk.Label titleLeft = new Gtk.Label();
            titleLeft.Angle  = 90;
            titleLeft.Markup = "<b>" + this.axisXMarkup + "</b>";
            table.Attach(titleLeft, 0, 1, 0, (uint)rows, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            // y axis title
            Gtk.Label titleRight = new Gtk.Label();
            titleRight.Angle  = 90;
            titleRight.Markup = "<b>" + this.valuesMarkup + "</b>";
            table.Attach(titleRight, DataColLeft + 2, DataColLeft + 3, 0, (uint)rows, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            // x values
            for (uint i = 0; i < countX; i++)
            {
                float val = axisX [i];

                Gtk.Label label = new Label();
                label.Text = val.ToString();
                label.SetAlignment(1f, 0f);

                BorderWidget widget = new BorderWidget(CalcAxisXColor(val));
                widget.Add(label);

                table.Attach(widget, DataColLeft, DataColLeft + 1, DataRowTop + i, DataRowTop + 1 + i, AttachOptions.Fill, AttachOptions.Shrink, PadX, PadY);
            }

            // y values
            int count = values.Length;

            for (uint i = 0; i < count; i++)
            {
                float val = values [i];

                Gtk.Widget   label  = new Label(val.ToString(this.formatValues));
                BorderWidget widget = new BorderWidget(CalcValueColor(val));

                // ShadowType appearance differences might be minimal
                if (val >= this.valuesMax)
                {
                    widget.ShadowType = ShadowType.EtchedOut;
                }
                else if (val <= this.valuesMin)
                {
                    widget.ShadowType = ShadowType.EtchedIn;
                }

                widget.Add(label);

                uint row = DataRowTop + i;
                uint col = DataColLeft + 1;

                table.Attach(widget, col, col + 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            }

            return(table);
        }