/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (m_helpProvider != null) { m_helpProvider.Dispose(); } } m_cache = null; m_fs = null; m_mediator = null; m_cache = null; m_bvList = null; m_valuesCombo = null; base.Dispose(disposing); }
/// <summary> /// Paints the background of the control. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"/> that contains the event data.</param> protected override void OnPaintBackground(PaintEventArgs e) { VisualStyleRenderer renderer = FwComboBox.CreateRenderer(m_state, m_useVisualStyleBackColor, true, ContainsFocus, m_hasBorder); if (renderer != null) { renderer.DrawBackground(e.Graphics, ClientRectangle, e.ClipRectangle); if (!m_useVisualStyleBackColor) { e.Graphics.FillRectangle(new SolidBrush(BackColor), ContentRectangle); } if (ContainsFocus) { Rectangle contentRect = ContentRectangle; Rectangle focusRect = new Rectangle(contentRect.Left + 1, contentRect.Top + 1, m_textBoxPanel.Width - 2, contentRect.Height - 2); ControlPaint.DrawFocusRectangle(e.Graphics, focusRect); } } else { base.OnPaintBackground(e); } }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_combo != null) { m_combo.SelectedIndexChanged -= new EventHandler(SelectionChanged); Control.Controls.Remove(m_combo); m_combo.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_combo = null; m_mediator = null; m_persistProvider = null; base.Dispose(disposing); }
/// <summary> /// Display the combo box at the specified location, or the list box pulled down from the specified location. /// </summary> /// <param name="loc"></param> public void Activate(Rect loc) { CheckDisposed(); FwComboBox combo = m_combo as FwComboBox; if (combo != null) { combo.Location = new System.Drawing.Point(loc.left, loc.top); // 21 is the default height of a combo, the smallest reasonable size. combo.Size = new System.Drawing.Size(Math.Max(loc.right - loc.left + 30, 200), Math.Max(loc.bottom - loc.top, 50)); if (!m_owner.Controls.Contains(combo)) { m_owner.Controls.Add(combo); } } else { ComboListBox c = (m_combo as ComboListBox); c.AdjustSize(500, 400); // these are maximums! c.LaunchingForm = m_owner.ParentForm; c.FormHidden += ComboListHidden; c.Launch(m_owner.RectangleToScreen(loc), Screen.GetWorkingArea(m_owner)); } }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (m_helpProvider != null) { m_helpProvider.Dispose(); } } if (m_cache != null) { IVwCacheDa cda = m_cache.MainCacheAccessor as IVwCacheDa; cda.CacheVecProp(m_cache.LangProject.Hvo, m_fakeFlid, null, 0); cda = null; m_cache = null; } m_ctxt = null; m_mediator = null; m_bvList = null; m_valuesCombo = null; base.Dispose(disposing); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (components != null) { components.Dispose(); } } m_cache = null; m_fs = null; m_mediator = null; m_cache = null; m_bvList = null; m_valuesCombo = null; base.Dispose(disposing); }
// Handles a change in the item selected in the affix slot combo box. void HandleComboSlotChange(object sender, EventArgs ea) { if (m_skipEvents) { return; } FwComboBox combo = sender as FwComboBox; HvoTssComboItem selItem = combo.SelectedItem as HvoTssComboItem; m_selectedSlotHvo = (selItem == null) ? -1 : selItem.Hvo; }
// Handles a change in the item selected in the affix slot combo box. void HandleComboSlotChange(object sender, EventArgs ea) { if (m_skipEvents) { return; } FwComboBox combo = sender as FwComboBox; HvoTssComboItem selItem = combo.SelectedItem as HvoTssComboItem; m_selectedSlot = (selItem == null) ? null : m_cache.ServiceLocator.GetInstance <IMoInflAffixSlotRepository>().GetObject(selItem.Hvo); }
public FeatureConstraintChooserDlg() { // // Required for Windows Form Designer support // InitializeComponent(); AccessibleName = GetType().Name; m_valuesCombo = new FwComboBox(); m_valuesCombo.DropDownStyle = ComboBoxStyle.DropDownList; m_valuesCombo.AdjustStringHeight = false; m_valuesCombo.Padding = new Padding(0, 1, 0, 0); m_valuesCombo.BackColor = SystemColors.Window; m_valuesCombo.SelectedIndexChanged += new EventHandler(m_valuesCombo_SelectedIndexChanged); }
/// <summary> /// Get rid of the combo, typically when the user clicks outside it. /// </summary> public void Hide() { CheckDisposed(); FwComboBox combo = m_combo as FwComboBox; if (combo != null && m_owner.Controls.Contains(combo)) { m_owner.Controls.Remove(combo); } ComboListBox clb = m_combo as ComboListBox; if (clb != null) { clb.HideForm(); } }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> public ReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider, Mediator mediator) : base(new UserControl(), cache, obj, flid) { m_mediator = mediator; m_persistProvider = persistenceProvider; m_combo = new FwComboBox(); m_combo.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; m_combo.DropDownStyle = ComboBoxStyle.DropDownList; m_combo.Font = new System.Drawing.Font( cache.LangProject.DefaultVernacularWritingSystemFont, 10); if (!Application.RenderWithVisualStyles) { m_combo.HasBorder = false; } m_combo.Dock = DockStyle.Left; m_combo.Width = 200; Control.Height = m_combo.Height; // Combo has sensible default height, UserControl does not. Control.Controls.Add(m_combo); m_combo.SelectedIndexChanged += new EventHandler(SelectionChanged); // Load the special strings from the string table if possible. If not, use the // default (English) values. if (mediator != null && mediator.HasStringTable) { StringTbl = mediator.StringTbl; if (StringTbl != null) { m_sNullItemLabel = StringTbl.GetString("NullItemLabel", "DetailControls/ReferenceComboBox"); } } if (m_sNullItemLabel == null || m_sNullItemLabel == "" || m_sNullItemLabel == "*NullItemLabel*") { m_sNullItemLabel = DetailControlsStrings.ksNullLabel; } }
public FeatureConstraintChooserDlg() { // // Required for Windows Form Designer support // InitializeComponent(); m_valuesCombo = new FwComboBox(); m_valuesCombo.DropDownStyle = ComboBoxStyle.DropDownList; m_valuesCombo.AdjustStringHeight = false; m_valuesCombo.Padding = new Padding(0, 1, 0, 0); m_valuesCombo.BackColor = SystemColors.Window; m_valuesCombo.SelectedIndexChanged += new EventHandler(m_valuesCombo_SelectedIndexChanged); if (FwApp.App != null) // Will be null when running tests { m_helpProvider = new System.Windows.Forms.HelpProvider(); m_helpProvider.HelpNamespace = FwApp.App.HelpFile; m_helpProvider.SetHelpKeyword(this, FwApp.App.GetHelpString(s_helpTopic, 0)); m_helpProvider.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); } }
/// <summary> /// Constructor. /// </summary> /// <param name="obj">CmObject that is being displayed.</param> /// <param name="flid">The field identifier for the attribute we are displaying.</param> public ReferenceComboBoxSlice(FdoCache cache, ICmObject obj, int flid, IPersistenceProvider persistenceProvider) : base(new UserControl(), cache, obj, flid) { m_persistProvider = persistenceProvider; m_combo = new FwComboBox(); m_combo.WritingSystemFactory = cache.WritingSystemFactory; m_combo.DropDownStyle = ComboBoxStyle.DropDownList; m_combo.Font = new System.Drawing.Font( cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.DefaultFontName, 10); if (!Application.RenderWithVisualStyles) { m_combo.HasBorder = false; } m_combo.Dock = DockStyle.Left; m_combo.Width = 200; Control.Height = m_combo.Height; // Combo has sensible default height, UserControl does not. Control.Controls.Add(m_combo); m_combo.SelectedIndexChanged += SelectionChanged; }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected virtual void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****************** Missing Dispose() call for " + GetType().Name + " ******************"); // Must not be run more than once. if (m_isDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_combo != null) { m_combo.SelectedIndexChanged -= new EventHandler(m_combo_SelectedIndexChanged); FwComboBox combo = m_combo as FwComboBox; if (combo != null && combo.Parent == null) { combo.Dispose(); } else { ComboListBox clb = (m_combo as ComboListBox); if (clb != null) { clb.Dispose(); } } } } // Dispose unmanaged resources here, whether disposing is true or false. m_cache = null; m_owner = null; m_isDisposed = true; }
// Handles a change in the item selected in the MSA Types combo box. void HandleComboMSATypesChange(object sender, EventArgs ea) { if (m_skipEvents) { return; } FwComboBox combo = sender as FwComboBox; ITsString selTss = combo.SelectedItem as ITsString; string label = selTss.Text; if (label == LexTextControls.ksNotSure) { MSAType = MsaType.kUnclassified; } else if (label == LexTextControls.ksInflectional) { MSAType = MsaType.kInfl; } else if (label == LexTextControls.ksDerivational) { MSAType = MsaType.kDeriv; } Debug.WriteLine(label); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LinkAllomorphDlg)); this.label3 = new System.Windows.Forms.Label(); this.m_fwcbAllomorphs = new SIL.FieldWorks.Common.Widgets.FwComboBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.grplbl = new System.Windows.Forms.GroupBox(); this.m_panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_tbForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.m_fwTextBoxBottomMsg)).BeginInit(); this.SuspendLayout(); // // m_btnClose // resources.ApplyResources(this.m_btnClose, "m_btnClose"); // // m_btnOK // resources.ApplyResources(this.m_btnOK, "m_btnOK"); // // m_btnInsert // resources.ApplyResources(this.m_btnInsert, "m_btnInsert"); // // m_btnHelp // resources.ApplyResources(this.m_btnHelp, "m_btnHelp"); // // m_panel1 // resources.ApplyResources(this.m_panel1, "m_panel1"); // // m_matchingObjectsBrowser // resources.ApplyResources(this.m_matchingObjectsBrowser, "m_matchingObjectsBrowser"); // // m_fwTextBoxBottomMsg // resources.ApplyResources(this.m_fwTextBoxBottomMsg, "m_fwTextBoxBottomMsg"); // // label3 // resources.ApplyResources(this.label3, "label3"); this.label3.Name = "label3"; // // m_fwcbAllomorphs // resources.ApplyResources(this.m_fwcbAllomorphs, "m_fwcbAllomorphs"); this.m_fwcbAllomorphs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_fwcbAllomorphs.DropDownWidth = 200; this.m_fwcbAllomorphs.DroppedDown = false; this.m_fwcbAllomorphs.Name = "m_fwcbAllomorphs"; this.m_fwcbAllomorphs.PreviousTextBoxText = null; this.m_fwcbAllomorphs.SelectedIndex = -1; this.m_fwcbAllomorphs.SelectedItem = null; this.m_fwcbAllomorphs.StyleSheet = null; // // groupBox1 // resources.ApplyResources(this.groupBox1, "groupBox1"); this.groupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaption; this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // // grplbl // resources.ApplyResources(this.grplbl, "grplbl"); this.grplbl.ForeColor = System.Drawing.SystemColors.ActiveCaption; this.grplbl.Name = "grplbl"; this.grplbl.TabStop = false; // // LinkAllomorphDlg // resources.ApplyResources(this, "$this"); this.Controls.Add(this.m_fwcbAllomorphs); this.Controls.Add(this.label3); this.Controls.Add(this.groupBox1); this.Controls.Add(this.grplbl); this.m_helpProvider.SetHelpNavigator(this, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("$this.HelpNavigator")))); this.Name = "LinkAllomorphDlg"; this.m_helpProvider.SetShowHelp(this, ((bool)(resources.GetObject("$this.ShowHelp")))); this.Controls.SetChildIndex(this.grplbl, 0); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.label3, 0); this.Controls.SetChildIndex(this.m_fwcbAllomorphs, 0); this.Controls.SetChildIndex(this.m_btnClose, 0); this.Controls.SetChildIndex(this.m_btnOK, 0); this.Controls.SetChildIndex(this.m_btnInsert, 0); this.Controls.SetChildIndex(this.m_btnHelp, 0); this.Controls.SetChildIndex(this.m_panel1, 0); this.Controls.SetChildIndex(this.m_matchingObjectsBrowser, 0); this.Controls.SetChildIndex(this.m_cbWritingSystems, 0); this.Controls.SetChildIndex(this.m_wsLabel, 0); this.Controls.SetChildIndex(this.m_fwTextBoxBottomMsg, 0); this.Controls.SetChildIndex(this.m_objectsLabel, 0); this.m_panel1.ResumeLayout(false); this.m_panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_tbForm)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.m_fwTextBoxBottomMsg)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LinkEntryOrSenseDlg)); this.m_rbEntry = new System.Windows.Forms.RadioButton(); this.m_rbSense = new System.Windows.Forms.RadioButton(); this.m_fwcbSenses = new SIL.FieldWorks.Common.Widgets.FwComboBox(); this.grplbl = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_tbForm)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.m_fwTextBoxBottomMsg)).BeginInit(); this.grplbl.SuspendLayout(); this.SuspendLayout(); // // m_btnClose // resources.ApplyResources(this.m_btnClose, "m_btnClose"); // // m_btnOK // resources.ApplyResources(this.m_btnOK, "m_btnOK"); // // m_btnInsert // resources.ApplyResources(this.m_btnInsert, "m_btnInsert"); // // m_btnHelp // resources.ApplyResources(this.m_btnHelp, "m_btnHelp"); // // m_panel1 // resources.ApplyResources(this.m_panel1, "m_panel1"); // // m_matchingObjectsBrowser // resources.ApplyResources(this.m_matchingObjectsBrowser, "m_matchingObjectsBrowser"); // // m_formLabel // resources.ApplyResources(this.m_formLabel, "m_formLabel"); // // m_tbForm // resources.ApplyResources(this.m_tbForm, "m_tbForm"); // // m_cbWritingSystems // resources.ApplyResources(this.m_cbWritingSystems, "m_cbWritingSystems"); // // label1 // resources.ApplyResources(this.m_wsLabel, "label1"); // // m_fwTextBoxBottomMsg // this.m_fwTextBoxBottomMsg.BackColor = System.Drawing.SystemColors.InactiveCaptionText; resources.ApplyResources(this.m_fwTextBoxBottomMsg, "m_fwTextBoxBottomMsg"); // // label2 // resources.ApplyResources(this.m_objectsLabel, "label2"); // // m_rbEntry // this.m_rbEntry.Checked = true; resources.ApplyResources(this.m_rbEntry, "m_rbEntry"); this.m_rbEntry.Name = "m_rbEntry"; this.m_rbEntry.TabStop = true; this.m_rbEntry.Click += new System.EventHandler(this.m_radioButtonClick); // // m_rbSense // resources.ApplyResources(this.m_rbSense, "m_rbSense"); this.m_rbSense.Name = "m_rbSense"; this.m_rbSense.Click += new System.EventHandler(this.m_radioButtonClick); // // m_fwcbSenses // this.m_fwcbSenses.AdjustStringHeight = true; resources.ApplyResources(this.m_fwcbSenses, "m_fwcbSenses"); this.m_fwcbSenses.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown; this.m_fwcbSenses.Name = "m_fwcbSenses"; // // grplbl // resources.ApplyResources(this.grplbl, "grplbl"); this.grplbl.BackColor = System.Drawing.SystemColors.Control; this.grplbl.Controls.Add(this.m_rbSense); this.grplbl.Controls.Add(this.m_rbEntry); this.grplbl.Controls.Add(this.m_fwcbSenses); this.grplbl.ForeColor = System.Drawing.SystemColors.ControlText; this.grplbl.Name = "grplbl"; this.m_helpProvider.SetShowHelp(this.grplbl, ((bool)(resources.GetObject("grplbl.ShowHelp")))); this.grplbl.TabStop = false; // // groupBox1 // resources.ApplyResources(this.groupBox1, "groupBox1"); this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlText; this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // // LinkEntryOrSenseDlg // resources.ApplyResources(this, "$this"); this.Controls.Add(this.groupBox1); this.Controls.Add(this.grplbl); this.m_helpProvider.SetHelpNavigator(this, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("$this.HelpNavigator")))); this.Name = "LinkEntryOrSenseDlg"; this.m_helpProvider.SetShowHelp(this, ((bool)(resources.GetObject("$this.ShowHelp")))); this.Controls.SetChildIndex(this.m_fwTextBoxBottomMsg, 0); this.Controls.SetChildIndex(this.m_btnInsert, 0); this.Controls.SetChildIndex(this.grplbl, 0); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.m_btnClose, 0); this.Controls.SetChildIndex(this.m_btnOK, 0); this.Controls.SetChildIndex(this.m_btnHelp, 0); this.Controls.SetChildIndex(this.m_panel1, 0); this.Controls.SetChildIndex(this.m_matchingObjectsBrowser, 0); this.Controls.SetChildIndex(this.m_cbWritingSystems, 0); this.Controls.SetChildIndex(this.m_wsLabel, 0); this.Controls.SetChildIndex(this.m_objectsLabel, 0); this.m_panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.m_tbForm)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.m_fwTextBoxBottomMsg)).EndInit(); this.grplbl.ResumeLayout(false); this.grplbl.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); }