Esempio n. 1
0
        // Methods :: Private
        // Methods :: Private :: InsertTrack
        private void InsertTrack(Song song)
        {
            tracks_table.NRows++;

            // Number
            Label number = new Label("" + song.TrackNumber);

            number.Selectable = true;
            number.Xalign     = 0.5F;
            number.Show();

            tracks_table.Attach(number, 0, 1,
                                tracks_table.NRows - 1, tracks_table.NRows,
                                AttachOptions.Fill,
                                0, 0, 0);

            // Track
            Label track = new Label(song.Title);

            track.Selectable = true;
            track.Xalign     = 0.0F;
            track.Show();

            AttachOptions opts =
                (AttachOptions.Expand
                 | AttachOptions.Shrink
                 | AttachOptions.Fill);

            tracks_table.Attach(track, 1, 2,
                                tracks_table.NRows - 1, tracks_table.NRows,
                                opts, 0, 0, 0);
        }
Esempio n. 2
0
        public bool Attach(int pid)
        {
            var options = new AttachOptions {
                ProcessId = pid,
            };

            return(Attach(options));
        }
Esempio n. 3
0
        public SimpleTable(int n_columns) : base(1, (uint)n_columns, false)
        {
            ColumnSpacing = 5;
            RowSpacing    = 5;

            XOptions = new AttachOptions [n_columns];
            for (int i = 0; i < n_columns; i++)
            {
                XOptions[i] = default_options;
            }
        }
Esempio n. 4
0
        public void Append(Widget widget, AttachOptions xoptions, AttachOptions yoptions,
                           bool showArrow, Gdk.Pixbuf arrow)
        {
            uint row = NRows;

            if (showArrow)
            {
                AttachArrow(arrow);
            }

            Attach(widget, 1, 2, row, row + 1, xoptions, yoptions, 0, 0);
            widget.OverrideBackgroundColor(StateFlags.Normal, StyleContext.GetBackgroundColor(StateFlags.Normal));
        }
Esempio n. 5
0
        public void Append(Widget widget, AttachOptions xoptions, AttachOptions yoptions,
                           bool showArrow, Gdk.Pixbuf arrow)
        {
            uint row = NRows;

            if (showArrow)
            {
                AttachArrow(arrow);
            }

            Attach(widget, 1, 2, row, row + 1, xoptions, yoptions, 0, 0);
            widget.ModifyBg(StateType.Normal, Style.Base(StateType.Normal));
        }
Esempio n. 6
0
        public static DBG.AttachProcessOptions Convert(AttachOptions options, IDebuggerSettings settings, string debuggeeVersion = null)
        {
            if (options == null)
            {
                throw new ArgumentNullException();
            }
            var o = new DBG.AttachProcessOptions(new DBG.DesktopCLRTypeAttachInfo(debuggeeVersion));

            o.ProcessId = options.ProcessId;
            o.DebugMessageDispatcher = WpfDebugMessageDispatcher.Instance;
            o.DebugOptions.IgnoreBreakInstructions = settings.IgnoreBreakInstructions;
            return(o);
        }
Esempio n. 7
0
        public void Attach(Widget widget, int left, int right, int top, int bottom, AttachOptions xOptions, AttachOptions yOptions)
        {
            var p = new TablePlacement((EventSink)WidgetEventSink, widget)
            {
                Left     = left,
                Right    = right,
                Top      = top,
                Bottom   = bottom,
                XOptions = xOptions,
                YOptions = yOptions
            };

            children.Add(p);
        }
Esempio n. 8
0
        public DownloadWindow(String msg) : base("Einen Moment...")
        {
            SetDefaultSize(250, 210);
            SetPosition(WindowPosition.Center);
            DeleteEvent += delegate { Application.Quit(); };

            GLib.Timeout.Add(100, new GLib.TimeoutHandler(OnTimer));

            var table = new Table(3, 5, false);

            darea        = new DrawingArea();
            darea.Drawn += new DrawnHandler(OnExpose);
            table.Attach(new Label(msg), 0, 2, 0, 1, 0, 0, 10, 10);
            AttachOptions fill = AttachOptions.Fill | AttachOptions.Expand;

            table.Attach(darea, 0, 2, 3, 4, fill, fill, 0, 0);

            Add(table);
            this.ShowAll();
        }
Esempio n. 9
0
        private void InitializeComponent()
        {
            //
            // costWidget
            //
            this.costWidget = new PlotWidget();
            //
            // volumeWidget
            //
            this.volumeWidget = new PlotWidget();
            //
            // closeButton
            //
            this.closeButton          = new Gtk.Button("Close");
            this.closeButton.Clicked += new System.EventHandler(this.closeButton_Click);

            //
            // FinancialDemo
            //
            this.SetSizeRequest(630, 450);
            //
            // Define a 10x10 table on which to lay out the plots and button
            //
            Gtk.Table layout = new Gtk.Table(10, 10, true);
            layout.BorderWidth = 4;
            Add(layout);

            AttachOptions opt = AttachOptions.Expand | AttachOptions.Fill;
            uint          xpad = 2, ypad = 10;

            layout.Attach(costWidget, 0, 10, 0, 6);
            layout.Attach(volumeWidget, 0, 10, 6, 9);
            layout.Attach(closeButton, 1, 2, 9, 10, opt, opt, xpad, ypad);
            this.Name = "PlotSurface2DDemo";

            this.Name = "FinancialDemo";
        }
Esempio n. 10
0
        private void Attach()
        {
            if (this.DatabaseItem == null)
            {
                this.Log.LogError("DatabaseItem is required");
                return;
            }

            this.LogTaskMessage(string.Format(CultureInfo.CurrentCulture, "Attaching Database: {0}", this.DatabaseItem.ItemSpec));
            if (this.CheckDatabaseExists())
            {
                this.Log.LogError("Cannot attach a database with the same name as an existing database");
                return;
            }

            string[]         databasefiles   = this.DatabaseItem.GetMetadata("Files").Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            StringCollection filescollection = new StringCollection();

            filescollection.AddRange(databasefiles);
            AttachOptions dbattachOptions = AttachOptions.None;
            string        attachOptions   = this.DatabaseItem.GetMetadata("AttachOptions");

            if (!string.IsNullOrEmpty(attachOptions))
            {
                dbattachOptions = (AttachOptions)Enum.Parse(typeof(AttachOptions), attachOptions);
            }

            if (!string.IsNullOrEmpty(this.DatabaseItem.GetMetadata("Owner")))
            {
                this.sqlServer.AttachDatabase(this.DatabaseItem.ItemSpec, filescollection, this.DatabaseItem.GetMetadata("Owner"), dbattachOptions);
            }
            else
            {
                this.sqlServer.AttachDatabase(this.DatabaseItem.ItemSpec, filescollection, dbattachOptions);
            }
        }
        public NewProjectOptionsWidget()
        {
            Stetic.BinContainer.Attach(this);

            AttachOptions fill   = AttachOptions.Fill;
            AttachOptions expand = AttachOptions.Expand | fill;
            AttachOptions shrink = AttachOptions.Shrink;

            var table = new Table(5, 3, false)
            {
                ColumnSpacing = 4,
                RowSpacing    = 4,
            };
            uint row = 0;

            var header = new Label(GettextCatalog.GetString("<b>Project Options</b>"))
            {
                Xalign    = 0,
                UseMarkup = true,
            };

            table.Attach(header, 0, 3, row, row + 1, expand, shrink, 0, 0);

            row++;

            nameEntry          = new Entry();
            nameEntry.Changed += NameChanged;
            var nameLabel = new Label(GettextCatalog.GetString("N_ame:"))
            {
                UseUnderline   = true,
                MnemonicWidget = nameEntry,
                Xalign         = 0,
            };

            table.Attach(nameLabel, 0, 1, row, row + 1, fill, shrink, 0, 0);
            table.Attach(nameEntry, 1, 3, row, row + 1, expand, shrink, 0, 0);

            row++;

            locationEntry              = new FileEntry();
            locationEntry.PathChanged += delegate {
                UpdateState();
            };
            var locationLabel = new Label(GettextCatalog.GetString("L_ocation:"))
            {
                UseUnderline   = true,
                MnemonicWidget = locationEntry,
                Xalign         = 0,
            };

            table.Attach(locationLabel, 0, 1, row, row + 1, fill, shrink, 0, 0);
            table.Attach(locationEntry, 1, 3, row, row + 1, expand, shrink, 0, 0);

            solutionNameEntry           = new Entry();
            solutionNameEntry.Sensitive = false;
            solutionNameEntry.Changed  += delegate {
                UpdateState();
            };
            solutionNameLabel = new Label(GettextCatalog.GetString("_Solution name:"))
            {
                UseUnderline   = true,
                MnemonicWidget = solutionNameEntry,
                Xalign         = 0,
            };
            createSolutionDirectoryCheck = new CheckButton(GettextCatalog.GetString("_Create directory for solution"))
            {
                UseUnderline = true,
            };
            createSolutionDirectoryCheck.Toggled += delegate {
                solutionNameEntry.Sensitive = createSolutionDirectoryCheck.Active;
                UpdateState();
            };

            row++;

            table.Attach(solutionNameLabel, 0, 1, row, row + 1, fill, shrink, 0, 0);
            table.Attach(solutionNameEntry, 1, 2, row, row + 1, expand, shrink, 0, 0);
            table.Attach(createSolutionDirectoryCheck, 2, 3, row, row + 1, fill, shrink, 0, 0);

            row++;

            saveInLabel = new Label()
            {
                Xalign = 0,
            };
            table.Attach(saveInLabel, 1, 3, row, row + 1, fill, shrink, 0, 0);

            table.ShowAll();
            this.Add(table);
        }
Esempio n. 12
0
 public void AttachDatabase(string database, StringCollection files,
                            AttachOptions options)
 {
     m_server.AttachDatabase(database, files, options);
 }
Esempio n. 13
0
 /// <summary>
 /// Mimics the GtkTable.Attach() method for gtk2 compat
 /// </summary>
 /// <param name="grid"></param>
 /// <param name="child"></param>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <param name="top"></param>
 /// <param name="bottom"></param>
 /// <param name="xOptions"></param>
 /// <param name="yOptions"></param>
 /// <param name="xPadding"></param>
 /// <param name="yPadding"></param>
 public static void Attach(this Grid grid, Widget child, int left, int right, int top, int bottom, AttachOptions xOptions, AttachOptions yOptions, int xPadding, int yPadding)
 {
     grid.Attach(child, left, top, right - left, bottom - top);
 }
Esempio n. 14
0
 public bool Attach(AttachOptions options) =>
 dispatcher.UI(() => debugService.Value.Attach(Utils.Convert(options, debugService.Value.DebuggerSettings)));
Esempio n. 15
0
        void Build()
        {
            DefaultWidth  = 470;
            DefaultHeight = 380;
            BorderWidth   = 6;
            Resizable     = false;

            VBox.Spacing = 6;

            buttonCancel = new Button(Gtk.Stock.Cancel);
            AddActionWidget(buttonCancel, ResponseType.Cancel);
            buttonOk = new Button(Gtk.Stock.Ok);
            AddActionWidget(buttonOk, ResponseType.Ok);

            var table = new Table(3, 2, false)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            nameEntry = new Entry {
                WidthRequest = 350
            };
            viewEngineCombo = ComboBox.NewText();
            templateCombo   = ComboBox.NewText();

            var nameLabel = new Label(GettextCatalog.GetString("_Name"))
            {
                MnemonicWidget = nameEntry,
                Xalign         = 0
            };
            var templateLabel = new Label(GettextCatalog.GetString("_Template:"))
            {
                MnemonicWidget = nameEntry,
                Xalign         = 0
            };
            var engineLabel = new Label(GettextCatalog.GetString("_View Engine:"))
            {
                MnemonicWidget = nameEntry,
                Xalign         = 0
            };

            const AttachOptions expandFill = AttachOptions.Expand | AttachOptions.Fill;
            const AttachOptions fill       = AttachOptions.Fill;

            table.Attach(nameLabel, 0, 1, 0, 1, fill, 0, 0, 0);
            table.Attach(nameEntry, 1, 2, 0, 1, expandFill, 0, 0, 0);
            table.Attach(templateLabel, 0, 1, 1, 2, fill, 0, 0, 0);
            table.Attach(templateCombo, 1, 2, 1, 2, expandFill, 0, 0, 0);
            table.Attach(engineLabel, 0, 1, 2, 3, fill, 0, 0, 0);
            table.Attach(viewEngineCombo, 1, 2, 2, 3, expandFill, 0, 0, 0);

            VBox.PackStart(table, false, false, 0);

            var frame = new Frame(GettextCatalog.GetString("Options"))
            {
                BorderWidth = 2
            };
            var optionsVBox = new VBox {
                Spacing = 6
            };
            var optionsAlignment = new Alignment(0.5f, 0.5f, 1f, 1f)
            {
                Child         = optionsVBox,
                TopPadding    = 4,
                BottomPadding = 4,
                RightPadding  = 4,
                LeftPadding   = 4
            };

            frame.Add(optionsAlignment);

            partialCheck = new CheckButton(GettextCatalog.GetString("_Partial view"))
            {
                UseUnderline = true
            };
            stronglyTypedCheck = new CheckButton(GettextCatalog.GetString("_Strongly typed"))
            {
                UseUnderline = true
            };
            masterCheck = new CheckButton(GettextCatalog.GetString("Has _master page or layout"))
            {
                UseUnderline = true
            };

            dataClassCombo = ComboBoxEntry.NewText();
            masterEntry    = new Entry {
                WidthRequest = 250
            };
            placeholderCombo = ComboBoxEntry.NewText();
            masterButton     = new Button("...");

            optionsVBox.PackStart(partialCheck);
            optionsVBox.PackStart(stronglyTypedCheck);
            typePanel = WithLabelAndLeftPadding(dataClassCombo, GettextCatalog.GetString("_Data class:"), true, 24);
            optionsVBox.PackStart(typePanel);
            optionsVBox.PackStart(masterCheck);


            var masterLabel = new Label(GettextCatalog.GetString("_File:"))
            {
                MnemonicWidget = masterEntry,
                Xalign         = 0,
                UseUnderline   = true
            };

            placeholderLabel = new Label(GettextCatalog.GetString("P_rimary placeholder:"))
            {
                MnemonicWidget = placeholderCombo,
                Xalign         = 0,
                UseUnderline   = true
            };

            var masterTable = new Table(2, 3, false)
            {
                RowSpacing = 6, ColumnSpacing = 6
            };

            masterTable.Attach(masterLabel, 0, 1, 0, 1, fill, 0, 0, 0);
            masterTable.Attach(masterEntry, 1, 3, 0, 1, expandFill, 0, 0, 0);
            masterTable.Attach(placeholderLabel, 0, 1, 1, 2, expandFill, 0, 0, 0);
            masterTable.Attach(placeholderCombo, 1, 2, 1, 2, fill, 0, 0, 0);
            masterTable.Attach(masterButton, 2, 3, 1, 2, fill, 0, 0, 0);

            masterPanel = new Alignment(0.5f, 0.5f, 1f, 1f)
            {
                LeftPadding = 24, Child = masterTable
            };
            optionsVBox.PackStart(masterPanel);

            VBox.PackStart(frame, false, false, 0);

            Child.ShowAll();

            viewEngineCombo.Changed    += ViewEngineChanged;
            templateCombo.Changed      += Validate;
            nameEntry.Changed          += Validate;
            partialCheck.Toggled       += UpdateMasterPanelSensitivity;
            stronglyTypedCheck.Toggled += UpdateTypePanelSensitivity;
            dataClassCombo.Changed     += DataClassChanged;
            masterCheck.Toggled        += UpdateMasterPanelSensitivity;
            masterEntry.Changed        += MasterChanged;
            masterButton.Clicked       += ShowMasterSelectionDialog;
            placeholderCombo.Changed   += Validate;
        }
Esempio n. 16
0
        void CalcDefaultSizes(SizeRequestMode mode, double totalSize, bool calcHeights, bool calcOffsets)
        {
            TablePlacement[]             visibleChildren;
            Dictionary <int, WidgetSize> fixedSizesByCell;
            HashSet <int> cellsWithExpand;

            WidgetSize[] sizes;
            double       spacing;

            CalcDefaultSizes(mode, calcHeights, out visibleChildren, out fixedSizesByCell, out cellsWithExpand, out sizes, out spacing);

            double naturalSize = 0;

            // Get the total natural size
            foreach (var ws in fixedSizesByCell.Values)
            {
                naturalSize += ws.NaturalSize;
            }

            double remaining = totalSize - naturalSize - spacing;

            if (remaining < 0)
            {
                // The box is not big enough to fit the widgets using its natural size.
                // We have to shrink the cells

                // List of cell indexes that we have to shrink
                var toShrink = new List <int> (fixedSizesByCell.Keys);

                // The total amount we have to shrink
                double shrinkSize = -remaining;

                while (toShrink.Count > 0 && shrinkSize > 0)
                {
                    SizeSplitter sizePart = new SizeSplitter(shrinkSize, toShrink.Count);
                    shrinkSize = 0;
                    for (int i = 0; i < toShrink.Count; i++)
                    {
                        int        n         = toShrink[i];
                        double     reduction = sizePart.NextSizePart();
                        WidgetSize size;
                        fixedSizesByCell.TryGetValue(n, out size);
                        size.NaturalSize -= reduction;

                        if (size.NaturalSize < size.MinSize)
                        {
                            // If the widget can't be shrinked anymore, we remove it from the shrink list
                            // and increment the remaining shrink size. We'll loop again and this size will be
                            // substracted from the cells which can still be reduced
                            shrinkSize      += (size.MinSize - size.NaturalSize);
                            size.NaturalSize = size.MinSize;
                            toShrink.RemoveAt(i);
                            i--;
                        }
                        fixedSizesByCell [n] = size;
                    }
                }
            }
            else
            {
                int nexpands        = cellsWithExpand.Count;
                var expandRemaining = new SizeSplitter(remaining, nexpands);
                foreach (var c in cellsWithExpand)
                {
                    WidgetSize ws;
                    fixedSizesByCell.TryGetValue(c, out ws);
                    ws.NaturalSize      += expandRemaining.NextSizePart();
                    fixedSizesByCell [c] = ws;
                }
            }

            for (int n = 0; n < visibleChildren.Length; n++)
            {
                var           bp            = visibleChildren[n];
                double        allocatedSize = 0;
                double        cellOffset    = 0;
                AttachOptions ops           = calcHeights ? bp.YOptions : bp.XOptions;

                int start = GetStartAttach(bp, calcHeights);
                int end   = GetEndAttach(bp, calcHeights);
                for (int i = start; i < end; i++)
                {
                    WidgetSize ws;
                    fixedSizesByCell.TryGetValue(i, out ws);
                    allocatedSize += ws.NaturalSize;
                    if (i != start)
                    {
                        allocatedSize += GetSpacing(i, calcHeights);
                    }
                }

                if ((ops & AttachOptions.Fill) == 0)
                {
                    double s = sizes[n].NaturalSize;
                    if (s < allocatedSize)
                    {
                        cellOffset    = (allocatedSize - s) / 2;
                        allocatedSize = s;
                    }
                }

                // cellOffset is the offset of the widget inside the cell. We store it in NextX/Y, and
                // will be used below to calculate the total offset of the widget

                if (calcHeights)
                {
                    bp.NextHeight = allocatedSize;
                    bp.NextY      = cellOffset;
                }
                else
                {
                    bp.NextWidth = allocatedSize;
                    bp.NextX     = cellOffset;
                }
            }

            if (calcOffsets)
            {
                var    sortedChildren = visibleChildren.OrderBy(c => GetStartAttach(c, calcHeights)).ToArray();
                var    cells          = fixedSizesByCell.OrderBy(c => c.Key);
                double offset         = 0;
                int    n = 0;
                foreach (var c in cells)
                {
                    if (c.Key > 0)
                    {
                        offset += GetSpacing(c.Key, calcHeights);
                    }
                    while (n < sortedChildren.Length && GetStartAttach(sortedChildren[n], calcHeights) == c.Key)
                    {
                        // In the loop above we store the offset of the widget inside the cell in the NextX/Y field
                        // so now we have to add (not just assign) the offset of the cell to NextX/Y
                        if (calcHeights)
                        {
                            sortedChildren[n].NextY += offset;
                        }
                        else
                        {
                            sortedChildren[n].NextX += offset;
                        }
                        n++;
                    }
                    offset += c.Value.NaturalSize;
                }
            }
        }
Esempio n. 17
0
        void CalcDefaultSizes(SizeRequestMode mode, bool calcHeights, out TablePlacement[] visibleChildren, out Dictionary <int, WidgetSize> fixedSizesByCell, out HashSet <int> cellsWithExpand, out WidgetSize[] sizes, out double spacing)
        {
            bool useLengthConstraint = mode == SizeRequestMode.HeightForWidth && calcHeights || mode == SizeRequestMode.WidthForHeight && !calcHeights;

            visibleChildren = children.Where(b => b.Child.Visible).ToArray();
            int lastCell = 0;

            fixedSizesByCell = new Dictionary <int, WidgetSize> ();
            cellsWithExpand  = new HashSet <int> ();
            HashSet <int> cellsWithWidget = new HashSet <int> ();

            sizes = new WidgetSize [visibleChildren.Length];

            // Get the size of each widget and store the fixed sizes for widgets which don't span more than one cell

            for (int n = 0; n < visibleChildren.Length; n++)
            {
                var bp    = visibleChildren[n];
                int start = GetStartAttach(bp, calcHeights);
                int end   = GetEndAttach(bp, calcHeights);

                if (end > lastCell)
                {
                    lastCell = end;
                }

                // Check if the cell is expandable and store the value
                AttachOptions ops = calcHeights ? bp.YOptions : bp.XOptions;
                for (int i = start; i < end; i++)
                {
                    cellsWithWidget.Add(i);
                    if ((ops & AttachOptions.Expand) != 0)
                    {
                        cellsWithExpand.Add(i);
                    }
                }

                WidgetSize s;
                if (useLengthConstraint)
                {
                    s = GetPreferredLengthForSize(mode, bp.Child, calcHeights ? bp.NextWidth : bp.NextHeight);
                }
                else
                {
                    s = GetPreferredSize(calcHeights, bp.Child);
                }
                sizes [n] = s;

                if (end == start + 1)
                {
                    // The widget only takes one cell. Store its size if it is the biggest
                    bool       changed = false;
                    WidgetSize fs;
                    fixedSizesByCell.TryGetValue(start, out fs);
                    if (s.MinSize > fs.MinSize)
                    {
                        fs.MinSize = s.MinSize;
                        changed    = true;
                    }
                    if (s.NaturalSize > fs.NaturalSize)
                    {
                        fs.NaturalSize = s.NaturalSize;
                        changed        = true;
                    }
                    if (changed)
                    {
                        fixedSizesByCell [start] = fs;
                    }
                }
            }

            // For widgets that span more than one cell, calculate the floating size, that is, the size
            // which is not taken by other fixed size widgets

            List <TablePlacement> widgetsToAdjust = new List <TablePlacement> ();
            Dictionary <TablePlacement, WidgetSize[]> growSizes = new Dictionary <TablePlacement, WidgetSize[]> ();

            for (int n = 0; n < visibleChildren.Length; n++)
            {
                var bp    = visibleChildren[n];
                int start = GetStartAttach(bp, calcHeights);
                int end   = GetEndAttach(bp, calcHeights);
                if (end == start + 1)
                {
                    continue;
                }
                widgetsToAdjust.Add(bp);

                WidgetSize fixedSize = new WidgetSize(0);

                // We are going to calculate the spacing included in the widget's span of cells
                // (there is spacing between each cell)
                double spanSpacing = 0;

                for (int c = start; c < end; c++)
                {
                    WidgetSize fs;
                    fixedSizesByCell.TryGetValue(c, out fs);
                    fixedSize += fs;
                    if (c != start && c != end)
                    {
                        spanSpacing += GetSpacing(c, calcHeights);
                    }
                }

                // sizeToGrow is the size that the whole cell span has to grow in order to fit
                // this widget. We substract the spacing between cells because that space will
                // be used by the widget, so we don't need to allocate more size for it

                WidgetSize sizeToGrow = sizes [n] - fixedSize - new WidgetSize(spanSpacing);

                WidgetSize sizeToGrowPart = new WidgetSize(sizeToGrow.MinSize / (end - start), sizeToGrow.NaturalSize / (end - start));

                // Split the size to grow between the cells of the widget. We need to know how much size the widget
                // requires for each cell it covers.

                WidgetSize[] widgetGrowSizes = new WidgetSize [end - start];
                for (int i = 0; i < widgetGrowSizes.Length; i++)
                {
                    widgetGrowSizes [i] = sizeToGrowPart;
                }
                growSizes[bp] = widgetGrowSizes;
            }

            // Now size-to-grow values have to be adjusted. For example, let's say widget A requires 100px for column 1 and 100px for column 2, and widget B requires
            // 60px for column 2 and 60px for column 3. So the widgets are overlapping at column 2. Since A requires at least 100px in column 2, it means that B can assume
            // that it will have 100px available in column 2, which means 40px more than it requested. Those extra 40px can then be substracted from the 60px that
            // it required for column 3.

            foreach (var n in cellsWithWidget)
            {
                // Get a list of all widgets that cover this cell
                var            colCells    = widgetsToAdjust.Where(bp => GetStartAttach(bp, calcHeights) <= n && GetEndAttach(bp, calcHeights) > n).ToArray();
                WidgetSize     maxv        = new WidgetSize(0);
                TablePlacement maxtMin     = null;
                TablePlacement maxtNatural = null;

                // Find the widget that requires the maximum size for this cell
                foreach (var bp in colCells)
                {
                    WidgetSize cv = growSizes[bp][n - GetStartAttach(bp, calcHeights)];
                    if (cv.MinSize > maxv.MinSize)
                    {
                        maxv.MinSize = cv.MinSize;
                        maxtMin      = bp;
                    }
                    if (cv.NaturalSize > maxv.NaturalSize)
                    {
                        maxv.NaturalSize = cv.NaturalSize;
                        maxtNatural      = bp;
                    }
                }

                // Adjust the required size of all widgets of the cell (excluding the widget with the max size)
                foreach (var bp in colCells)
                {
                    WidgetSize[] widgetGrows = growSizes[bp];
                    int          cellIndex   = n - GetStartAttach(bp, calcHeights);
                    if (bp != maxtMin)
                    {
                        double cv = widgetGrows[cellIndex].MinSize;
                        // splitExtraSpace is the additional space that the widget can take from this cell (because there is a widget
                        // that is requiring more space), split among all other cells of the widget
                        double splitExtraSpace = (maxv.MinSize - cv) / (widgetGrows.Length - 1);
                        for (int i = 0; i < widgetGrows.Length; i++)
                        {
                            widgetGrows[i].MinSize -= splitExtraSpace;
                        }
                    }
                    if (bp != maxtNatural)
                    {
                        double cv = widgetGrows[cellIndex].NaturalSize;
                        double splitExtraSpace = (maxv.NaturalSize - cv) / (widgetGrows.Length - 1);
                        for (int i = 0; i < widgetGrows.Length; i++)
                        {
                            widgetGrows[i].NaturalSize -= splitExtraSpace;
                        }
                    }
                }
            }

            // Find the maximum size-to-grow for each cell

            Dictionary <int, WidgetSize> finalGrowTable = new Dictionary <int, WidgetSize> ();

            foreach (var bp in widgetsToAdjust)
            {
                int          start       = GetStartAttach(bp, calcHeights);
                int          end         = GetEndAttach(bp, calcHeights);
                WidgetSize[] widgetGrows = growSizes[bp];
                for (int n = start; n < end; n++)
                {
                    WidgetSize curGrow;
                    finalGrowTable.TryGetValue(n, out curGrow);
                    var val = widgetGrows [n - start];
                    if (val.MinSize > curGrow.MinSize)
                    {
                        curGrow.MinSize = val.MinSize;
                    }
                    if (val.NaturalSize > curGrow.NaturalSize)
                    {
                        curGrow.NaturalSize = val.NaturalSize;
                    }
                    finalGrowTable [n] = curGrow;
                }
            }

            // Add the final size-to-grow to the fixed sizes calculated at the begining

            foreach (var it in finalGrowTable)
            {
                WidgetSize ws;
                fixedSizesByCell.TryGetValue(it.Key, out ws);
                fixedSizesByCell [it.Key] = it.Value + ws;
            }

            spacing = 0;
            for (int n = 1; n < lastCell; n++)
            {
                if (cellsWithWidget.Contains(n))
                {
                    spacing += GetSpacing(n, calcHeights);
                }
            }
        }
Esempio n. 18
0
 public void Append(Widget widget, AttachOptions xoptions, AttachOptions yoptions, bool showArrow)
 {
     Append(widget, xoptions, yoptions, showArrow, null);
 }
Esempio n. 19
0
        private void InitializeComponent()
        {
            //
            // closeButton
            //
            this.closeButton          = new Gtk.Button("Close");
            this.closeButton.Clicked += new System.EventHandler(this.closeButton_Click);

            //
            // volumePS
            //
            this.volumePS = new NPlot.Gtk.InteractivePlotSurface2D();
            this.volumePS.AutoScaleAutoGeneratedAxes = false;
            this.volumePS.AutoScaleTitle             = false;
            this.volumePS.Canvas.ModifyBg(StateType.Normal);
            this.volumePS.Legend      = null;
            this.volumePS.Canvas.Name = "volumePS";
            // HWT this.volumePS.RightMenu = null;
            // HWT this.volumePS.ShowCoordinates = false;
            this.volumePS.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
            this.volumePS.Title         = "";
            this.volumePS.TitleFont     = new System.Drawing.Font("Arial", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
            this.volumePS.XAxis1        = null;
            this.volumePS.XAxis2        = null;
            this.volumePS.YAxis1        = null;
            this.volumePS.YAxis2        = null;

            //
            // costPS
            //
            this.costPS = new NPlot.Gtk.InteractivePlotSurface2D();
            this.costPS.AutoScaleAutoGeneratedAxes = false;
            this.costPS.AutoScaleTitle             = false;
            this.costPS.Canvas.ModifyBg(StateType.Normal);
            this.costPS.Legend      = null;
            this.costPS.Canvas.Name = "costPS";
            // HWT this.costPS.RightMenu = null;
            // HWT this.costPS.ShowCoordinates = false;
            this.costPS.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
            this.costPS.Title         = "";
            this.costPS.TitleFont     = new System.Drawing.Font("Arial", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
            this.costPS.XAxis1        = null;
            this.costPS.XAxis2        = null;
            this.costPS.YAxis1        = null;
            this.costPS.YAxis2        = null;

            //
            // FinancialDemo
            //
            this.SetSizeRequest(630, 450);
            //
            // Define a 10x10 table on which to lay out the plots and button
            //
            Gtk.Table layout = new Gtk.Table(10, 10, true);
            layout.BorderWidth = 4;
            Add(layout);

            AttachOptions opt = AttachOptions.Expand | AttachOptions.Fill;
            uint          xpad = 2, ypad = 10;

            layout.Attach(costPS.Canvas, 0, 10, 0, 6);
            layout.Attach(volumePS.Canvas, 0, 10, 6, 9);
            layout.Attach(closeButton, 1, 2, 9, 10, opt, opt, xpad, ypad);
            this.Name = "PlotSurface2DDemo";

            this.Name = "FinancialDemo";
        }
Esempio n. 20
0
 internal static void TblAttach(Table tbl, Widget w, int x, int y, int width, int height, AttachOptions xoptions, AttachOptions yoptions)
 {
     tbl.Attach(w, (uint)x, (uint)(x + width), (uint)y, (uint)(y + height), xoptions, yoptions, (uint)0, (uint)0);
 }
Esempio n. 21
0
 internal static void TblAttach(Table tbl, Widget w, int x, int y, AttachOptions xoptions, AttachOptions yoptions)
 {
     TblAttach(tbl, w, x, y, 1, 1, xoptions, yoptions);
 }
Esempio n. 22
0
        private void InitializeComponent()
        {
            quitButton         = new Gtk.Button();
            nextPlotButton     = new Gtk.Button();
            prevPlotButton     = new Gtk.Button();
            printButton        = new Gtk.Button();
            exampleNumberLabel = new Gtk.Label();

            // Create the two display panes for the samples
            plotWidget = new PlotWidget();
            infoBox    = new Gtk.TextView();

            quitButton.Name = "quitButton";
            //quitButton.TabIndex = 14;
            quitButton.Label    = "Close";
            quitButton.Clicked += new System.EventHandler(quitButton_Click);

            nextPlotButton.Name = "nextPlotButton";
            //nextPlotButton.TabIndex = 17;
            nextPlotButton.Label    = "Next";
            nextPlotButton.Clicked += new System.EventHandler(nextPlotButton_Click);

            printButton.Name = "printButton";
            //printButton.TabIndex = 9;
            printButton.Label    = "Print";
            printButton.Clicked += new System.EventHandler(printButton_Click);

            prevPlotButton.Name = "prevPlotButton";
            //prevPlotButton.TabIndex = 15;
            prevPlotButton.Label    = "Prev";
            prevPlotButton.Clicked += new System.EventHandler(prevPlotButton_Click);

            exampleNumberLabel.Name = "exampleNumberLabel";

            infoBox.Name = "infoBox";
            //infoBox.TabIndex = 18;

            SetSizeRequest(632, 520);
            //
            // Define 11x8 table on which to lay out the plot, test buttons, etc
            //
            layout             = new Gtk.Table(11, 8, true);
            layout.BorderWidth = 4;
            Add(layout);

            infoFrame            = new Frame();
            infoFrame.ShadowType = Gtk.ShadowType.In;
            infoFrame.Add(infoBox);

            AttachOptions opt = AttachOptions.Expand | AttachOptions.Fill;
            uint          xpad = 2, ypad = 10;

            layout.Attach(infoFrame, 0, 8, 9, 11);
            layout.Attach(plotWidget, 0, 8, 0, 8);
            layout.Attach(quitButton, 3, 4, 8, 9, opt, opt, xpad, ypad);
            layout.Attach(printButton, 2, 3, 8, 9, opt, opt, xpad, ypad);
            layout.Attach(prevPlotButton, 0, 1, 8, 9, opt, opt, xpad, ypad);
            layout.Attach(exampleNumberLabel, 4, 5, 8, 9);
            layout.Attach(nextPlotButton, 1, 2, 8, 9, opt, opt, xpad, ypad);
            Name = "PlotSurface Samples";
        }
Esempio n. 23
0
 public void Attach(Widget widget, int left, int top, AttachOptions xOptions, AttachOptions yOptions)
 {
     Attach(widget, left, left + 1, top, top + 1, xOptions, yOptions);
 }