///<summary>
        ///</summary>
        ///<param name="controlFactory"></param>
        public FilterControlVWG(IControlFactory controlFactory)
        {

            this.Height = 50;
            _controlFactory = controlFactory;
            _groupBox = _controlFactory.CreateGroupBox();
            //_groupBox.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
            //_groupBox.Top = 0;
            //_groupBox.Left = 0;
            //_groupBox.Width = this.Width;
            //_groupBox.Height = this.Height;
            //this.Controls.Add((Control) _groupBox);
            _controlFactory.CreateBorderLayoutManager(this).AddControl(_groupBox, BorderLayoutManager.Position.Centre);
            _groupBox.Text = "Filter the Grid";

            BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(_groupBox);
            layoutManager.BorderSize = 20;
            IPanel filterButtonPanel = controlFactory.CreatePanel();
            filterButtonPanel.Height = 50;
            filterButtonPanel.Width = 110;
            CreateFilterButtons(filterButtonPanel);

            layoutManager.AddControl(filterButtonPanel, BorderLayoutManager.Position.West);

            _filterPanel = controlFactory.CreatePanel();
            _filterPanel.Width = this.Width;

            layoutManager.AddControl(_filterPanel, BorderLayoutManager.Position.Centre);
            _filterControlManager = new FilterControlManager(controlFactory, new FlowLayoutManager(_filterPanel, controlFactory));
        }
        static IGroupManager FindOrCreateGroupManager(IGroupBox groupBox)
        {
            if (s_GroupManagers.ContainsKey(groupBox))
            {
                return(s_GroupManagers[groupBox]);
            }

            Type genericType = null;

            foreach (var interfaceType in groupBox.GetType().GetInterfaces())
            {
                if (interfaceType.IsGenericType && k_GenericGroupBoxType.IsAssignableFrom(interfaceType.GetGenericTypeDefinition()))
                {
                    genericType = interfaceType.GetGenericArguments()[0];
                    break;
                }
            }

            var groupManager = genericType != null ? (IGroupManager)Activator.CreateInstance(genericType) : new DefaultGroupManager();

            if (groupBox is BaseVisualElementPanel panel)
            {
                panel.panelDisposed += OnPanelDestroyed;
            }
            else if (groupBox is VisualElement visualElement)
            {
                visualElement.RegisterCallback <DetachFromPanelEvent>(OnGroupBoxDetachedFromPanel);
            }

            s_GroupManagers[groupBox] = groupManager;
            return(groupManager);
        }
        ///<summary>
        ///</summary>
        ///<param name="controlFactory"></param>
        public FilterControlVWG(IControlFactory controlFactory)
        {
            this.Height     = 50;
            _controlFactory = controlFactory;
            _groupBox       = _controlFactory.CreateGroupBox();
            //_groupBox.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
            //_groupBox.Top = 0;
            //_groupBox.Left = 0;
            //_groupBox.Width = this.Width;
            //_groupBox.Height = this.Height;
            //this.Controls.Add((Control) _groupBox);
            _controlFactory.CreateBorderLayoutManager(this).AddControl(_groupBox, BorderLayoutManager.Position.Centre);
            _groupBox.Text = "Filter the Grid";

            BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(_groupBox);

            layoutManager.BorderSize = 20;
            IPanel filterButtonPanel = controlFactory.CreatePanel();

            filterButtonPanel.Height = 50;
            filterButtonPanel.Width  = 110;
            CreateFilterButtons(filterButtonPanel);

            layoutManager.AddControl(filterButtonPanel, BorderLayoutManager.Position.West);

            _filterPanel       = controlFactory.CreatePanel();
            _filterPanel.Width = this.Width;

            layoutManager.AddControl(_filterPanel, BorderLayoutManager.Position.Centre);
            _filterControlManager = new FilterControlManager(controlFactory, new FlowLayoutManager(_filterPanel, controlFactory));
        }
示例#4
0
        public void Test_Visually_Advanced()
        {
            //---------------Set up test pack-------------------
            IControlFactory controlFactory = GetControlFactory();
            IGroupBox       groupBox       = controlFactory.CreateGroupBox("Test Layout");
            IPanel          panel          = controlFactory.CreatePanel();

            panel.Dock = DockStyle.Fill;
            groupBox.Controls.Add(panel);
            ColumnLayoutManager columnLayoutManager = new ColumnLayoutManager(panel, controlFactory)
            {
                ColumnCount = 1
            };
            int    controlNumber = 1;
            IPanel panel1        = CreateColoredPanel(controlFactory, controlNumber++ + ":");

            panel1.Controls.Clear();
            GridLayoutManager gridLayoutManager = new GridLayoutManager(panel1, controlFactory);

            gridLayoutManager.SetGridSize(4, 3);
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "a:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "b:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "c:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "d:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "e:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "f:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "g:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "h:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "i:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "j:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "k:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "l:"));


            columnLayoutManager.AddControl(panel1);
            columnLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++ + ":"));
            IButtonGroupControl buttonGroupControl = controlFactory.CreateButtonGroupControl();

            buttonGroupControl.Dock = DockStyle.Top;
            groupBox.Controls.Add(buttonGroupControl);
            buttonGroupControl.AddButton("Add Control", (sender, e) => columnLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++ + ":")));
            buttonGroupControl.AddButton("-Columns", (sender, e) =>
            {
                if (columnLayoutManager.ColumnCount > 1)
                {
                    columnLayoutManager.ColumnCount--;
                    columnLayoutManager.Refresh();
                }
            });
            buttonGroupControl.AddButton("+Columns", (sender, e) => { columnLayoutManager.ColumnCount++; columnLayoutManager.Refresh(); });
            IFormHabanero form = controlFactory.CreateOKCancelDialogFactory().CreateOKCancelForm(groupBox, "Test Column Layout Manager");

            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            form.ShowDialog();
            //---------------Test Result -----------------------
        }
        public void Test_Visually()
        {
            //---------------Set up test pack-------------------
            IControlFactory controlFactory = GetControlFactory();
            IGroupBox       groupBox       = controlFactory.CreateGroupBox("Test Layout");
            IPanel          panel          = controlFactory.CreatePanel();

            panel.Dock = DockStyle.Fill;
            groupBox.Controls.Add(panel);
            GridLayoutManager gridLayoutManager = new GridLayoutManager(panel, controlFactory);

            gridLayoutManager.SetGridSize(6, 2);
            int controlNumber = 1;

            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()), 2, 1);
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()), 2, 1);
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()));
            //IButtonGroupControl buttonGroupControl = controlFactory.CreateButtonGroupControl();
            //buttonGroupControl.Dock = DockStyle.Top;
            //groupBox.Controls.Add(buttonGroupControl);
            //buttonGroupControl.AddButton("Add Control", (sender, e) => gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++ + ":")));
            //buttonGroupControl.AddButton("-Columns", (sender, e) =>
            //{
            //    if (gridLayoutManager.ColumnCount > 1)
            //    {
            //        gridLayoutManager.ColumnCount--;
            //        gridLayoutManager.Refresh();
            //    }
            //});
            //buttonGroupControl.AddButton("+Columns", (sender, e) => { gridLayoutManager.ColumnCount++; gridLayoutManager.Refresh(); });
            IFormHabanero form = controlFactory.CreateOKCancelDialogFactory().CreateOKCancelForm(groupBox, "Test Grid Layout Manager");

            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            form.ShowDialog();
            //---------------Test Result -----------------------
        }
示例#6
0
文件: GroupBox.cs 项目: M1C/Eto
 public GroupBox(Generator g)
     : base(g, typeof(IGroupBox))
 {
     inner = (IGroupBox)base.Handler;
 }
 /// <summary>
 /// Accessor for the group manager of a specified group box implementation.
 /// Note: A group manager is only created once an option is added under its group box. It has no use otherwise.
 /// </summary>
 /// <param name="groupBox">The group box to search against.</param>
 /// <returns>The group manager associated to this group box.</returns>
 public static IGroupManager GetGroupManager(this IGroupBox groupBox)
 {
     return(s_GroupManagers.ContainsKey(groupBox) ? s_GroupManagers[groupBox] : null);
 }
 /// <summary>
 /// Retrieve the selected option in this group
 /// </summary>
 public static IGroupBoxOption GetSelectedOption(this IGroupBox groupBox)
 {
     return(!s_GroupManagers.ContainsKey(groupBox) ? null : s_GroupManagers[groupBox].GetSelectedOption());
 }
示例#9
0
文件: GroupBox.cs 项目: hultqvist/Eto
		protected GroupBox (Generator generator, Type type, bool initialize = true)
			: base (generator, type, initialize)
		{
			handler = (IGroupBox)base.Handler;
		}
示例#10
0
 protected GroupBox(Generator generator, Type type, bool initialize = true)
     : base(generator, type, initialize)
 {
     handler = (IGroupBox)base.Handler;
 }