///<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)); }
/// <summary> /// Creates a panel to display a business object /// </summary> /// <returns>Returns the panel info object containing the panel</returns> public IPanelFactoryInfo CreatePanel() { IPanelFactoryInfo factoryInfo; _firstControl = null; if (_uiForm.Count > 1) { IPanel mainPanel = _controlFactory.CreatePanel(_controlFactory); ControlMapperCollection controlMappers = new ControlMapperCollection(); IDictionary <string, IEditableGridControl> formGrids = new Dictionary <string, IEditableGridControl>(); ITabControl tabControl = _controlFactory.CreateTabControl(); BorderLayoutManager mainPanelManager = _controlFactory.CreateBorderLayoutManager(mainPanel); mainPanelManager.AddControl(tabControl, BorderLayoutManager.Position.Centre); foreach (UIFormTab formTab in _uiForm) { IPanelFactoryInfo onePanelInfo = CreateOnePanel(formTab); AddControlMappers(onePanelInfo, controlMappers); AddFormGrids(onePanelInfo, formGrids); ITabPage page = _controlFactory.CreateTabPage(formTab.Name); BorderLayoutManager manager = _controlFactory.CreateBorderLayoutManager(page); manager.AddControl(onePanelInfo.Panel, BorderLayoutManager.Position.Centre); tabControl.TabPages.Add(page); } factoryInfo = new PanelFactoryInfo(mainPanel, controlMappers, _uiDefName, _firstControl); factoryInfo.FormGrids = formGrids; } else { factoryInfo = CreateOnePanel(_uiForm[0]); } SetFormPreferredHeight(factoryInfo); //TODO_Port AttachTriggers(_uiForm, factoryInfo, _currentBusinessObject); return(factoryInfo); }
///<summary> /// Constructor for <see cref="CollapsiblePanelManager"/> ///</summary> ///<param name="collapsiblePanel"></param> ///<param name="controlFactory"></param> public CollapsiblePanelManager(ICollapsiblePanel collapsiblePanel, IControlFactory controlFactory) { _controlFactory = controlFactory; _collapsiblePanel = collapsiblePanel; _collapseButton = _controlFactory.CreateButtonCollapsibleStyle(); _collapseButton.Click += delegate { Collapsed = !Collapsed; }; _pinLabel = controlFactory.CreateLabelPinOffStyle(); _pinLabel.Click += delegate { Pinned = !Pinned; }; IPanel buttonPanel = _controlFactory.CreatePanel(); BorderLayoutManager buttonLayoutManager = _controlFactory.CreateBorderLayoutManager(buttonPanel); buttonPanel.Height = _collapseButton.Height; buttonLayoutManager.AddControl(_collapseButton, BorderLayoutManager.Position.Centre); buttonLayoutManager.AddControl(_pinLabel, BorderLayoutManager.Position.East); _layoutManager = _controlFactory.CreateBorderLayoutManager(collapsiblePanel); _layoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.North); _collapseButton.BackColor = System.Drawing.Color.Transparent; _collapseButton.ForeColor = System.Drawing.Color.Transparent; }
/// <summary> /// Constructs a <see cref="MainTitleIconControlWin"/> /// </summary> public MainTitleIconControlWin(IControlFactory controlFactory) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } _controlFactory = controlFactory; _panel = _controlFactory.CreatePanel(); ((PanelWin)_panel).BackgroundImage = CollapsiblePanelResource.headergradient; _panel.BackColor = Color.Transparent; _panel.Dock = Habanero.Faces.Base.DockStyle.Top; _panel.Height = 23; _icon = _controlFactory.CreateLabel(); ((LabelWin)_icon).BackgroundImage = CollapsiblePanelResource.headergradient; _icon.BackColor = Color.Transparent; ((LabelWin)_icon).BackgroundImageLayout = ImageLayout.Center; _icon.Dock = Habanero.Faces.Base.DockStyle.Left; _icon.Size = new Size(20, 20); _title = _controlFactory.CreateLabel(); _title.Dock = Habanero.Faces.Base.DockStyle.Fill; _title.BackColor = Color.Transparent; _title.TextAlign = ContentAlignment.MiddleLeft; _title.ForeColor = Color.White; _panel.Controls.Add(_title); _panel.Controls.Add(_icon); _panel.MaximumSize = new Size(2000, 23); this.Dock = DockStyleWin.GetDockStyle(DockStyle.Top); this.Controls.Add((PanelWin)_panel); this.Height = 23; }
/// <summary> /// Creates the panel on the form /// </summary> /// <returns>Returns the panel created</returns> public IPanel CreateControlPanel() { IPanel panel = _controlFactory.CreatePanel(); ILabel label = _controlFactory.CreateLabel(_message, false); ColumnLayoutManager columnLayoutManager = new ColumnLayoutManager(panel, _controlFactory); columnLayoutManager.AddControl(label); columnLayoutManager.AddControl(_comboBox); panel.Height = _comboBox.Height + label.Height + columnLayoutManager.BorderSize + columnLayoutManager.VerticalGapSize; int preferredWidth = label.PreferredWidth + 20; int preferredWidthFromCombo = GetLongestComboText() + 40; if (preferredWidthFromCombo > preferredWidth) { preferredWidth = preferredWidthFromCombo; } if (preferredWidth < 200) { preferredWidth = 200; } panel.Width = preferredWidth; _comboBox.Width = panel.Width - 30; panel.MinimumSize = panel.Size; return(panel); }
///<summary> /// Constructor for the <see cref="HelpAboutBoxManager"/> ///</summary> ///<param name="controlFactory"></param> ///<param name="formHabanero"></param> ///<param name="programName"></param> ///<param name="producedForName"></param> ///<param name="producedByName"></param> ///<param name="versionNumber"></param> public HelpAboutBoxManager(IControlFactory controlFactory, IFormHabanero formHabanero, string programName, string producedForName, string producedByName, string versionNumber) { _FormHabanero = formHabanero; _mainPanel = controlFactory.CreatePanel(); GridLayoutManager mainPanelManager = new GridLayoutManager(_mainPanel, controlFactory); mainPanelManager.SetGridSize(4, 2); mainPanelManager.FixAllRowsBasedOnContents(); mainPanelManager.FixColumnBasedOnContents(0); mainPanelManager.FixColumnBasedOnContents(1); mainPanelManager.AddControl(controlFactory.CreateLabel("Programme Name:", false)); mainPanelManager.AddControl(controlFactory.CreateLabel(programName, false)); mainPanelManager.AddControl(controlFactory.CreateLabel("Produced For:", false)); mainPanelManager.AddControl(controlFactory.CreateLabel(producedForName, false)); mainPanelManager.AddControl(controlFactory.CreateLabel("Produced By:", false)); mainPanelManager.AddControl(controlFactory.CreateLabel(producedByName, false)); mainPanelManager.AddControl(controlFactory.CreateLabel("Version:", false)); mainPanelManager.AddControl(controlFactory.CreateLabel(versionNumber, false)); IButtonGroupControl buttons = controlFactory.CreateButtonGroupControl(); buttons.AddButton("OK", new EventHandler(OKButtonClickHandler)); BorderLayoutManager manager = controlFactory.CreateBorderLayoutManager(formHabanero); manager.AddControl(_mainPanel, BorderLayoutManager.Position.Centre); manager.AddControl(buttons, BorderLayoutManager.Position.South); formHabanero.Width = 300; formHabanero.Height = 200; formHabanero.Text = "About"; }
public OKCancelPanelVWG(IControlFactory controlFactory) { //_controlFactory = controlFactory; //// create content panel //_contentPanel = _controlFactory.CreatePanel(); //_contentPanel.Dock = DockStyle.Fill; //this.Controls.Add((Control)_contentPanel); //// create buttons //IButtonGroupControl buttonGroupControl = _controlFactory.CreateButtonGroupControl(); //buttonGroupControl.Dock = DockStyle.Bottom; //_okButton = buttonGroupControl.AddButton("OK"); //_okButton.NotifyDefault(true); //_cancelButton = buttonGroupControl.AddButton("Cancel"); //this.Controls.Add((Control)buttonGroupControl); _controlFactory = controlFactory; // create content panel _contentPanel = _controlFactory.CreatePanel(); // create buttons _buttonGroupControl = _controlFactory.CreateButtonGroupControl(); _cancelButton = _buttonGroupControl.AddButton("Cancel"); _okButton = _buttonGroupControl.AddButton("OK"); _okButton.NotifyDefault(true); BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this); layoutManager.AddControl(_contentPanel, BorderLayoutManager.Position.Centre); layoutManager.AddControl(_buttonGroupControl, BorderLayoutManager.Position.South); }
/// <summary> /// Constructs a <see cref="MainTitleIconControlVWG"/> /// </summary> public MainTitleIconControlVWG(IControlFactory controlFactory) { if (controlFactory == null) throw new ArgumentNullException("controlFactory"); _controlFactory = controlFactory; _panel = _controlFactory.CreatePanel(); ((PanelVWG)_panel).BackgroundImage = @"Images.headergradient.png"; _panel.BackColor = Color.Transparent; _panel.Dock = Habanero.Faces.Base.DockStyle.Top; _panel.Height = 23; this.Size = new Size(_panel.Width,_panel.Height); _icon = _controlFactory.CreateLabel(); ((LabelVWG)_icon).BackgroundImage = ""; _icon.BackColor = Color.Transparent; ((LabelVWG)_icon).BackgroundImageLayout = ImageLayout.Center; _icon.Dock = Habanero.Faces.Base.DockStyle.Left; _icon.Size = new Size(20, 20); _title = _controlFactory.CreateLabel(); _title.Font = new Font("Verdana", 10); _title.Dock = Habanero.Faces.Base.DockStyle.Fill; _title.BackColor = Color.Transparent; _title.TextAlign = ContentAlignment.MiddleLeft; _title.ForeColor = Color.White; _panel.Controls.Add(_title); _panel.Controls.Add(_icon); this.Dock = DockStyleVWG.GetDockStyle(DockStyle.Top); this.Controls.Add((PanelVWG)_panel); this.Height = 23; }
/// <summary> /// Constructs a <see cref="MainTitleIconControlWin"/> /// </summary> public MainTitleIconControlWin(IControlFactory controlFactory) { if (controlFactory == null) throw new ArgumentNullException("controlFactory"); _controlFactory = controlFactory; _panel = _controlFactory.CreatePanel(); ((PanelWin)_panel).BackgroundImage = CollapsiblePanelResource.headergradient; _panel.BackColor = Color.Transparent; _panel.Dock = Habanero.Faces.Base.DockStyle.Top; _panel.Height = 23; _icon = _controlFactory.CreateLabel(); ((LabelWin)_icon).BackgroundImage = CollapsiblePanelResource.headergradient; _icon.BackColor = Color.Transparent; ((LabelWin)_icon).BackgroundImageLayout = ImageLayout.Center; _icon.Dock = Habanero.Faces.Base.DockStyle.Left; _icon.Size = new Size(20, 20); _title = _controlFactory.CreateLabel(); _title.Dock = Habanero.Faces.Base.DockStyle.Fill; _title.BackColor = Color.Transparent; _title.TextAlign = ContentAlignment.MiddleLeft; _title.ForeColor = Color.White; _panel.Controls.Add(_title); _panel.Controls.Add(_icon); _panel.MaximumSize = new Size(2000, 23); this.Dock = DockStyleWin.GetDockStyle(DockStyle.Top); this.Controls.Add((PanelWin)_panel); this.Height = 23; }
private void AddBOPanel(IBusinessObject businessObject) { IPanel panel = _controlFactory.CreatePanel(); panel.Name = businessObject.ID.ObjectID.ToString(); ICollapsiblePanel control = this.AddControl(panel, businessObject.ToString(), 100); control.Name = businessObject.ID.ObjectID.ToString(); }
/// <summary> /// Sets all the controls up in a layout manager. By default uses the border layout manager /// with the editor control centre and the buttons south. /// </summary> protected virtual void CreateLayout() { IPanel panel = _controlFactory.CreatePanel(); BorderLayoutManager borderLayoutManager = new BorderLayoutManagerVWG(this, _controlFactory); borderLayoutManager.AddControl(panel, BorderLayoutManager.Position.Centre); panel.Controls.Add(BoPanel); borderLayoutManager.AddControl(Buttons, BorderLayoutManager.Position.South); }
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 ----------------------- }
private static IPanel CreateColoredPanel(IControlFactory controlFactory, string labelPrefix) { System.Windows.Forms.Panel panel = (System.Windows.Forms.Panel)controlFactory.CreatePanel(); ILabel label = controlFactory.CreateLabel(labelPrefix); label.Height = 15; label.BackColor = Color.White; panel.Controls.Add((System.Windows.Forms.Control)label); panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; panel.BackColor = Color.FromArgb(TestUtil.GetRandomInt(255), TestUtil.GetRandomInt(255), TestUtil.GetRandomInt(255)); return (IPanel)panel; }
/// <summary> /// Creates the panel on the form /// </summary> /// <returns>Returns the panel created</returns> public IPanel createControlPanel() { IPanel panel = _controlFactory.CreatePanel(); ILabel label = _controlFactory.CreateLabel(_message, false); FlowLayoutManager flowLayoutManager = new FlowLayoutManager(panel, _controlFactory); flowLayoutManager.AddControl(label); flowLayoutManager.AddControl(_dateTimePicker); panel.Height = _dateTimePicker.Height + label.Height; panel.Width = _controlFactory.CreateLabel(_message, true).PreferredWidth + 20; return(panel); }
private static IPanel CreateColoredPanel(IControlFactory controlFactory, string labelPrefix) { System.Windows.Forms.Panel panel = (System.Windows.Forms.Panel)controlFactory.CreatePanel(); ILabel label = controlFactory.CreateLabel(labelPrefix); label.Height = 15; label.BackColor = Color.White; panel.Controls.Add((System.Windows.Forms.Control)label); panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; panel.BackColor = Color.FromArgb(TestUtil.GetRandomInt(255), TestUtil.GetRandomInt(255), TestUtil.GetRandomInt(255)); return((IPanel)panel); }
/// <summary> /// Constructs a <see cref="MainEditorPanelWin"/> /// </summary> /// <param name="controlFactory"></param> public MainEditorPanelWin(IControlFactory controlFactory) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } this.EditorPanel = controlFactory.CreatePanel(); this.MainTitleIconControl = new MainTitleIconControlWin(controlFactory); BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this); layoutManager.AddControl(this.MainTitleIconControl, BorderLayoutManager.Position.North); layoutManager.AddControl(this.EditorPanel, BorderLayoutManager.Position.Centre); }
///<summary> /// Constructor for <see cref="FilterControlWin"/> ///</summary> ///<param name="controlFactory"></param> public FilterControlWin(IControlFactory controlFactory) { Height = 50; _controlFactory = controlFactory; FilterGroupBox = _controlFactory.CreateGroupBox(); // _groupBox = _controlFactory.CreatePanel(); _controlFactory.CreateBorderLayoutManager(this).AddControl(FilterGroupBox, BorderLayoutManager.Position.Centre); FilterGroupBox.Text = "Filter the Grid"; BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(FilterGroupBox); layoutManager.BorderSize = 20; _filterButtonPanel = controlFactory.CreatePanel(); _filterButtonPanel.Height = 50; _filterButtonPanel.Width = 120; //110; _filterButtonPanel.Visible = false; CreateFilterButtons(_filterButtonPanel); _controlPanel = controlFactory.CreatePanel(); _controlPanel.Width = Width; this.EnsureButtonsFit(); this._filterButtonPanel.Resize += (sender, e) => { this.EnsureButtonsFit(); }; layoutManager.AddControl(_controlPanel, BorderLayoutManager.Position.Centre); layoutManager.AddControl(_filterButtonPanel, BorderLayoutManager.Position.East); Height = 50; this._controlPanel.Resize += (sender, e) => { this.Height = this._controlPanel.Height + layoutManager.BorderSize; if ((this.FilterGroupBox.Height - layoutManager.BorderSize) < this.Height) { this.FilterGroupBox.Height = this.Height; } }; _filterControlManager = new FilterControlManager(controlFactory, new FlowLayoutManager(_controlPanel, controlFactory)); }
public OKCancelPanelWin(IControlFactory controlFactory) { _controlFactory = controlFactory; // create content panel _contentPanel = _controlFactory.CreatePanel(); // create buttons _buttonGroupControl = _controlFactory.CreateButtonGroupControl(); _cancelButton = ButtonGroupControl.AddButton("Cancel"); _okButton = ButtonGroupControl.AddButton("OK"); _okButton.NotifyDefault(true); BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this); layoutManager.AddControl(_contentPanel, BorderLayoutManager.Position.Centre); layoutManager.AddControl(ButtonGroupControl, BorderLayoutManager.Position.South); }
private static IPanel CreateColoredPanel(IControlFactory controlFactory, string labelPrefix) { System.Windows.Forms.Panel panel = (System.Windows.Forms.Panel)controlFactory.CreatePanel(); ILabel label = controlFactory.CreateLabel(labelPrefix + "Left-Click to grow, Right-Click to shrink."); label.Height = 15; label.BackColor = Color.White; panel.Controls.Add((System.Windows.Forms.Control)label); panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; panel.MouseDown += (sender, e) => { if (e.Button == System.Windows.Forms.MouseButtons.Left) panel.Height += 5; if (e.Button == System.Windows.Forms.MouseButtons.Right) panel.Height -= 5; }; panel.BackColor = Color.FromArgb(TestUtil.GetRandomInt(255), TestUtil.GetRandomInt(255), TestUtil.GetRandomInt(255)); return (IPanel)panel; }
/// <summary> /// Initialises the WizardControl with the IWizardController. No logic is performed other than storing the wizard controller. /// </summary> /// <param name="wizardController"></param> /// <param name="controlFactory">The control factory that this control will use to create a button</param> public WizardControlWin(IWizardController wizardController, IControlFactory controlFactory) { if (wizardController == null) throw new ArgumentNullException("wizardController"); if (controlFactory == null) throw new ArgumentNullException("controlFactory"); _wizardController = wizardController; ControlFactory = controlFactory; _wizardControlManager = new WizardControlManager(this); var buttonPanel = CreateButtonPanel(); _wizardStepPanel = ControlFactory.CreatePanel(); BorderLayoutManagerWin borderLayoutManager = new BorderLayoutManagerWin(this, ControlFactory); borderLayoutManager.AddControl(_wizardStepPanel, BorderLayoutManager.Position.Centre); borderLayoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.South); }
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 ----------------------- }
private void SetupGridAndBOEditorControlVWG(IControlFactory controlFactory, IBOEditorControl iboEditorControl, IClassDef classDef, string gridUiDefName) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } if (iboEditorControl == null) { throw new ArgumentNullException("iboEditorControl"); } _controlFactory = controlFactory; _iboEditorControl = iboEditorControl; IPanel panel = _controlFactory.CreatePanel(); SetupReadOnlyGridControl(classDef, gridUiDefName); SetupButtonGroupControl(); UpdateControlEnabledState(); GridLayoutManager manager = new GridLayoutManager(panel, _controlFactory); manager.SetGridSize(2, 1); manager.FixAllRowsBasedOnContents(); manager.AddControl(_iboEditorControl); manager.AddControl(_buttonGroupControl); this.FilterControl = _controlFactory.CreateGenericGridFilter(_readOnlyGridControl.Grid); BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(this); layoutManager.AddControl(this.FilterControl, BorderLayoutManager.Position.North); layoutManager.AddControl(_readOnlyGridControl, BorderLayoutManager.Position.West); layoutManager.AddControl(panel, BorderLayoutManager.Position.Centre); //layoutManager.AddControl(_selectButtonGroupControl, BorderLayoutManager.Position.South); _readOnlyGridControl.BusinessObjectSelected += ((sender, e) => FireBusinessObjectSelected(e.BusinessObject)); _readOnlyGridControl.Grid.SelectionChanged += GridSelectionChanged; }
private void SetupDisplayBox() { //ControlsHelper.SafeGui(_dateTimePicker, delegate() //{ _displayBox = _controlFactory.CreatePanel(); //_displayBox.BorderStyle = BorderStyle.None; //_displayBox.Location = new Point(2, 2); ResizeDisplayBox(); _displayBox.BackColor = _dateTimePicker.BackColor; _displayBox.ForeColor = _dateTimePicker.ForeColor; //_displayBox.MouseUp += DateTimePicker_MouseUp; //_displayBox.KeyDown += DateTimePicker_KeyDown; _displayText = _controlFactory.CreateLabel(); //_displayText.Location = new Point(0, 0); _displayText.AutoSize = true; _displayText.Text = ""; //_displayText.MouseUp += DateTimePicker_MouseUp; //_displayText.KeyDown += DateTimePicker_KeyDown; _displayBox.Controls.Add(_displayText); _dateTimePicker.Controls.Add(_displayBox); _displayBox.Visible = false; //}); }
private static IPanel CreateColoredPanel(IControlFactory controlFactory, string labelPrefix) { System.Windows.Forms.Panel panel = (System.Windows.Forms.Panel)controlFactory.CreatePanel(); ILabel label = controlFactory.CreateLabel(labelPrefix + "Left-Click to grow, Right-Click to shrink."); label.Height = 15; label.BackColor = Color.White; panel.Controls.Add((System.Windows.Forms.Control)label); panel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; panel.MouseDown += (sender, e) => { if (e.Button == System.Windows.Forms.MouseButtons.Left) { panel.Height += 5; } if (e.Button == System.Windows.Forms.MouseButtons.Right) { panel.Height -= 5; } }; panel.BackColor = Color.FromArgb(TestUtil.GetRandomInt(255), TestUtil.GetRandomInt(255), TestUtil.GetRandomInt(255)); return((IPanel)panel); }
/// <summary> /// Initialises the WizardControl with the IWizardController. No logic is performed other than storing the wizard controller. /// </summary> /// <param name="wizardController"></param> /// <param name="controlFactory">The control factory that this control will use to create a button</param> public WizardControlVWG(IWizardController wizardController, IControlFactory controlFactory) { if (wizardController == null) { throw new ArgumentNullException("wizardController"); } if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } _wizardController = wizardController; _controlFactory = controlFactory; _wizardControlManager = new WizardControlManager(this); IPanel buttonPanel = CreateButtonPanel(); _wizardStepPanel = _controlFactory.CreatePanel(); BorderLayoutManagerVWG borderLayoutManager = new BorderLayoutManagerVWG(this, _controlFactory); borderLayoutManager.AddControl(_wizardStepPanel, BorderLayoutManager.Position.Centre); borderLayoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.South); }
private IPanel CreateButtonPanel() { IPanel buttonPanel = _controlFactory.CreatePanel(); const int buttonWidth = 75; const int buttonHeight = 38; var buttonSize = new Size(buttonWidth, buttonHeight); FlowLayoutManager layoutManager = new FlowLayoutManager(buttonPanel, _controlFactory); layoutManager.Alignment = FlowLayoutManager.Alignments.Right; CancelButton = _controlFactory.CreateButton("Cancel"); CancelButton.Click += this.CancelButton_Click; CancelButton.Size = new Size(75, 38); CancelButton.TabIndex = 3; layoutManager.AddControl(CancelButton); FinishButton = _controlFactory.CreateButton("Finish"); FinishButton.Click += this.FinishButton_Click; FinishButton.Size = buttonSize; FinishButton.TabIndex = 2; layoutManager.AddControl(FinishButton); NextButton = _controlFactory.CreateButton("Next"); NextButton.Click += this.NextButton_Click; NextButton.Size = new Size(75, 38); NextButton.TabIndex = 1; layoutManager.AddControl(NextButton); PreviousButton = _controlFactory.CreateButton("Previous"); PreviousButton.Click += this.PreviousButton_Click; PreviousButton.Size = new Size(75, 38); PreviousButton.TabIndex = 0; layoutManager.AddControl(PreviousButton); return(buttonPanel); }
/// <summary> /// Constructs a <see cref="MainTitleIconControlVWG"/> /// </summary> public MainTitleIconControlVWG(IControlFactory controlFactory) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } _controlFactory = controlFactory; _panel = _controlFactory.CreatePanel(); ((PanelVWG)_panel).BackgroundImage = @"Images.headergradient.png"; _panel.BackColor = Color.Transparent; _panel.Dock = Habanero.Faces.Base.DockStyle.Top; _panel.Height = 23; this.Size = new Size(_panel.Width, _panel.Height); _icon = _controlFactory.CreateLabel(); ((LabelVWG)_icon).BackgroundImage = ""; _icon.BackColor = Color.Transparent; ((LabelVWG)_icon).BackgroundImageLayout = ImageLayout.Center; _icon.Dock = Habanero.Faces.Base.DockStyle.Left; _icon.Size = new Size(20, 20); _title = _controlFactory.CreateLabel(); _title.Font = new Font("Verdana", 10); _title.Dock = Habanero.Faces.Base.DockStyle.Fill; _title.BackColor = Color.Transparent; _title.TextAlign = ContentAlignment.MiddleLeft; _title.ForeColor = Color.White; _panel.Controls.Add(_title); _panel.Controls.Add(_icon); this.Dock = DockStyleVWG.GetDockStyle(DockStyle.Top); this.Controls.Add((PanelVWG)_panel); this.Height = 23; }
public void TestShowDatePickersFormWithVisualStyles() { //---------------Set up test pack------------------- //Application.EnableVisualStyles(); IFormHabanero formWin = new FormWin(); IControlFactory controlFactory = GetControlFactory(); IDateTimePicker dateTimePicker = controlFactory.CreateDateTimePicker(); dateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Custom; dateTimePicker.CustomFormat = @"dddd MMMM yyyy"; dateTimePicker.NullDisplayValue = "Please Click"; //dateTimePicker.ShowCheckBox = true; ITextBox textBox = controlFactory.CreateTextBox(); IButton button = controlFactory.CreateButton("Check/Uncheck", delegate { //dateTimePicker.Checked = !dateTimePicker.Checked; if (dateTimePicker.ValueOrNull.HasValue) { dateTimePicker.ValueOrNull = null; } else { dateTimePicker.ValueOrNull = dateTimePicker.Value; } }); IButton enableButton = controlFactory.CreateButton("Enable/Disable", delegate { dateTimePicker.Enabled = !dateTimePicker.Enabled; }); IPanel panel = controlFactory.CreatePanel(); panel.Dock = DockStyle.Fill; formWin.Controls.Add(panel); GridLayoutManager gridLayoutManager = new GridLayoutManager(panel, controlFactory); gridLayoutManager.SetGridSize(9, 1); gridLayoutManager.BorderSize = 25; gridLayoutManager.AddControl(dateTimePicker); gridLayoutManager.AddControl(button); gridLayoutManager.AddControl(textBox); gridLayoutManager.AddControl(enableButton); gridLayoutManager.AddControl(controlFactory.CreateButton("ChangeColor", delegate { Random random = new Random(); dateTimePicker.ForeColor = Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)); dateTimePicker.BackColor = Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)); })); IDateTimePicker anotherDateTimePicker; anotherDateTimePicker = controlFactory.CreateDateTimePicker(); anotherDateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Long; gridLayoutManager.AddControl(anotherDateTimePicker); anotherDateTimePicker = controlFactory.CreateDateTimePicker(); anotherDateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Short; gridLayoutManager.AddControl(anotherDateTimePicker); anotherDateTimePicker = controlFactory.CreateDateTimePicker(); anotherDateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Time; gridLayoutManager.AddControl(anotherDateTimePicker); anotherDateTimePicker = controlFactory.CreateDateTimePicker(); anotherDateTimePicker.Format = Habanero.Faces.Base.DateTimePickerFormat.Long; anotherDateTimePicker.Font = new Font(FontFamily.GenericSansSerif, 18); anotherDateTimePicker.Height = 60; gridLayoutManager.AddControl(anotherDateTimePicker); dateTimePicker.ValueChanged += delegate { textBox.Text = dateTimePicker.ValueOrNull.HasValue ? dateTimePicker.Value.ToString() : ""; }; //---------------Execute Test ---------------------- formWin.ShowDialog(); //---------------Test Result ----------------------- //---------------Tear down ------------------------- }