public void HorizontalEqualsMaxPercentage() { FwSplitContainer splitContainer = new FwSplitContainer(); splitContainer.Orientation = Orientation.Horizontal; splitContainer.Bounds = new Rectangle(0, 0, 100, 100); splitContainer.SplitterDistance = 50; splitContainer.MaxFirstPanePercentage = 0.7f; // Moving splitter to 70% should be allowed SplitterCancelEventArgs e = new SplitterCancelEventArgs(50, 70, 50, 70); splitContainer.OnSplitterMoving(e); Assert.IsFalse(e.Cancel); }
public void HorizontalGreaterThenMaxPercentage() { FwSplitContainer splitContainer = new FwSplitContainer(); splitContainer.Orientation = Orientation.Horizontal; splitContainer.Bounds = new Rectangle(0, 0, 100, 100); splitContainer.SplitterDistance = 50; splitContainer.MaxFirstPanePercentage = 0.7f; // Moving splitter to 90% should leave splitter at 70% SplitterCancelEventArgs e = new SplitterCancelEventArgs(50, 90, 50, 90); splitContainer.OnSplitterMoving(e); Assert.AreEqual((int)(splitContainer.Height * splitContainer.MaxFirstPanePercentage), e.SplitY); }
public void HorizontalEqualsMaxPercentage() { using (FwSplitContainer splitContainer = new FwSplitContainer()) { splitContainer.Orientation = Orientation.Horizontal; splitContainer.Bounds = new Rectangle(0, 0, 100, 100); splitContainer.SplitterDistance = 50; splitContainer.MaxFirstPanePercentage = 0.7f; // Moving splitter to 70% should be allowed SplitterCancelEventArgs e = new SplitterCancelEventArgs(50, 70, 50, 70); splitContainer.OnSplitterMoving(e); Assert.IsFalse(e.Cancel); } }
public void VerticalGreaterThenMaxPercentage() { using (FwSplitContainer splitContainer = new FwSplitContainer()) { splitContainer.Orientation = Orientation.Vertical; splitContainer.Bounds = new Rectangle(0, 0, 100, 100); splitContainer.SplitterDistance = 50; splitContainer.MaxFirstPanePercentage = 0.7f; // Moving splitter to 90% should leave splitter at 70% SplitterCancelEventArgs e = new SplitterCancelEventArgs(90, 50, 90, 50); splitContainer.OnSplitterMoving(e); Assert.AreEqual((int)(splitContainer.Width * splitContainer.MaxFirstPanePercentage), e.SplitX); } }
/// ----------------------------------------------------------------------------------- /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> /// ----------------------------------------------------------------------------------- private void InitializeComponent() { this.components = new FwContainer(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FwMainWnd)); this.splitContainer = new SIL.FieldWorks.Common.Controls.FwSplitContainer(); this.m_sideBarContainer = new System.Windows.Forms.Panel(); this.m_infoBarContainer = new System.Windows.Forms.Panel(); this.statusStrip = new System.Windows.Forms.StatusStrip(); this.statusBarFwPanel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.ProgressPanel = new System.Windows.Forms.ToolStripProgressBar(); this.statusBarFilterPanel = new System.Windows.Forms.ToolStripStatusLabel(); this.m_persistence = new SIL.FieldWorks.Common.Controls.Persistence(this.components); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); this.splitContainer.SuspendLayout(); this.statusStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_persistence)).BeginInit(); this.SuspendLayout(); // // splitContainer // this.splitContainer.DesiredFirstPanePercentage = 0F; resources.ApplyResources(this.splitContainer, "splitContainer"); this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; this.splitContainer.MaxFirstPanePercentage = 0F; this.splitContainer.Name = "splitContainer"; // // splitContainer.Panel1 // this.splitContainer.Panel1.Controls.Add(this.m_sideBarContainer); // // splitContainer.Panel2 // this.splitContainer.Panel2.Controls.Add(this.m_infoBarContainer); this.splitContainer.PanelToActivate = this.splitContainer.Panel2; this.splitContainer.SettingsKey = null; // // m_sideBarContainer // resources.ApplyResources(this.m_sideBarContainer, "m_sideBarContainer"); this.m_sideBarContainer.Name = "m_sideBarContainer"; // // m_infoBarContainer // resources.ApplyResources(this.m_infoBarContainer, "m_infoBarContainer"); this.m_infoBarContainer.Name = "m_infoBarContainer"; // // statusStrip // this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusBarFwPanel1, this.ProgressPanel, this.statusBarFilterPanel}); resources.ApplyResources(this.statusStrip, "statusStrip"); this.statusStrip.Name = "statusStrip"; // // statusBarFwPanel1 // this.statusBarFwPanel1.Name = "statusBarFwPanel1"; resources.ApplyResources(this.statusBarFwPanel1, "statusBarFwPanel1"); this.statusBarFwPanel1.Spring = true; // // ProgressPanel // this.ProgressPanel.Maximum = 5000; this.ProgressPanel.Name = "ProgressPanel"; resources.ApplyResources(this.ProgressPanel, "ProgressPanel"); this.ProgressPanel.Step = 500; // // statusBarFilterPanel // resources.ApplyResources(this.statusBarFilterPanel, "statusBarFilterPanel"); this.statusBarFilterPanel.Name = "statusBarFilterPanel"; // // m_persistence // this.m_persistence.Parent = this; this.m_persistence.SaveSettings += new SIL.FieldWorks.Common.Controls.Persistence.Settings(this.SaveSettings); // // FwMainWnd // resources.ApplyResources(this, "$this"); this.Controls.Add(this.splitContainer); this.Controls.Add(this.statusStrip); this.Name = "FwMainWnd"; this.splitContainer.Panel1.ResumeLayout(false); this.splitContainer.Panel2.ResumeLayout(false); this.splitContainer.ResumeLayout(false); this.statusStrip.ResumeLayout(false); this.statusStrip.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_persistence)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a ChecksViewWrapper /// </summary> /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced /// with real parent later.</param> /// <param name="cache">The Cache to give to the views</param> /// <param name="createInfo">Information for creating the draft view to display in the lower /// right corner</param> /// <param name="settingsRegKey">The parent control's ISettings registry key</param> /// ------------------------------------------------------------------------------------ public ChecksViewWrapper(Control parent, FdoCache cache, object createInfo, RegistryKey settingsRegKey) { SuspendLayout(); m_cache = cache; m_scr = m_cache.LangProject.TranslatedScriptureOA; m_mainWnd = parent as FwMainWnd; Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; Dock = DockStyle.Fill; Name = "ChecksViewWrapper"; Visible = false; // If we have a main window, then ignore the one sent to us and use the main // window's extended settings key. Otherwise use the one sent to us. SettingsKey = (m_mainWnd != null ? m_mainWnd.SettingsKeyEx : settingsRegKey); if (parent != null) Site = parent.Site; // Set up the right view m_rightView = new FwSplitContainer(SettingsKey); m_rightView.Name = "ChecksRightView"; m_rightView.Orientation = Orientation.Horizontal; m_rightView.DesiredFirstPanePercentage = 0.7f; m_rightView.PanelToActivate = m_rightView.Panel1; m_rightView.Panel1Collapsed = false; m_rightView.Panel2Collapsed = false; m_rightView.Tag = createInfo; m_rightView.Dock = DockStyle.Fill; Controls.Add(m_rightView); // Note: setting parent needs to come last Parent = parent; ResumeLayout(); // This should only be null when running tests. if (m_mainWnd != null) m_mainWnd.Mediator.AddColleague(this); }