Beispiel #1
0
        /// <inheritdoc />
        void IShell.SetContent(IWidgetCompound widgetCompound)
        {
            using (this.DeferLayout()) {
                // Remove the old content
                if (WindowContent != null)
                {
                    Control oldContentControl = CastUtil.Cast <Control>(WindowContent);
                    Controls.Remove(oldContentControl);
                }

                // Store current window content
                WindowContent = widgetCompound;
                if (widgetCompound == null)
                {
                    return;
                }

                Control newContentControl = CastUtil.Cast <Control>(widgetCompound);
                newContentControl.Dock = DockStyle.Fill;

                // Add the new content
                Controls.Add(newContentControl);

                // Due to a bug of WeifenLou DockPanel the content panel should be at first position
                Controls.SetChildIndex(newContentControl, 0);
            }
        }
Beispiel #2
0
        /// <inheritdoc />
        void IShell.SetContent(IWidgetCompound widgetCompound)
        {
            using (this.DeferLayout()) {
                // Remove old content
                iContentControl.Controls.Clear();

                // Save new content
                WindowContent = widgetCompound;
                if (widgetCompound == null)
                {
                    return;
                }

                // Add new content
                Control dialogContent = CastUtil.Cast <Control>(widgetCompound);
                dialogContent.Dock = DockStyle.Fill; // XXX
                iContentControl.Controls.Add(dialogContent);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Adds the given widget to the next free cell of the composite.
        /// </summary>
        /// <param name="widget">Widget</param>
        /// <param name="layoutBehaviour">Additional layout informations</param>
        void IGridPanel.AddWidget(IWidget widget, GridLayoutBehaviour layoutBehaviour)
        {
            Control wdgCtrl = CastUtil.Cast <Control>(widget);

            // Add the control
            Controls.Add(wdgCtrl, iNextColumn, iNextRow);
            wdgCtrl.Dock = DockStyle.Fill;

            // Handle layout behaviour
            GridLayoutBehaviour behaviour = layoutBehaviour ?? new GridLayoutBehaviour();

            iNextColumn += behaviour.ColumnSpan;

            // Apply span
            SetColumnSpan(wdgCtrl, behaviour.ColumnSpan);
            SetRowSpan(wdgCtrl, behaviour.RowSpan);

            if (iNextColumn >= ((IGridPanel)this).GridColumns)
            {
                iNextColumn = 0;
                iNextRow++;
            }
        }