private void ShowResolutions(object sender, EventArgs args) { var dropdown = new DropDownControl(); dropdown.Bounds = new UniRectangle( new UniScalar(0), new UniScalar(0), new UniScalar(1, 0), new UniScalar(1, 0) ); Children.Add(dropdown); dropdown.BringToFront(); foreach (var d in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes) { if ((d.Format != SurfaceFormat.Color)) { continue; } if (!(Math.Abs(d.AspectRatio - 1.33) < 0.03 || Math.Abs(d.AspectRatio - 1.6) < 0.03 || Math.Abs(d.AspectRatio - 1.77) < 0.03)) { continue; } if (d.Height < 768) { continue; } dropdown.AddItem(d.Width + "x" + d.Height); } dropdown.ItemSelected += i => { _resolutionButton.Text = i; Children.Remove(dropdown); }; }
protected override void OnMouseWheel(MouseEventArgs e) { var items = DropDownItems; if (items == null || items.Count <= 1) { return; } var index = SelectedItem == null ? -1 : items.IndexOf(SelectedItem); if (e.Delta > 0) { if (--index < 0) { return; } } else { if (++index >= items.Count) { return; } } var item = items[index]; DropDownControl.FocusAndSelectItem(item); SelectedItem = item as TItem; Invalidate(); base.OnMouseWheel(e); }
/// <summary> /// Updates properties in property viewer by adding them as controls after clearing the property viewer first. /// </summary> public void UpdateProperties() { PropertyStackPanel.Children.Clear(); ObjectManager objectManager = MainWindowViewModel.viewModel.objectManager; if (objectManager.SelectionObject.Selection != null) { foreach (KeyValuePair <string, GameObjectProperty> propertyPair in CurrentProperties) { CreatePropertyBox(propertyPair.Value, PropertyStackPanel); } foreach (ComponentInfo info in CurrentComponents) { DropDownControl componentStrip = new DropDownControl(); componentStrip.HeaderText.Text = info.RealName; componentStrip.Width = PropertyStackPanel.Width; PropertyStackPanel.Children.Add(componentStrip); foreach (KeyValuePair <string, ComponentProperty> pair in info.Properties) { CreatePropertyBox(pair.Value, componentStrip.ContentPanel); } } Console.WriteLine(PropertyStackPanel.Children.Count); } }
public BasePage(IWebDriver driver) { elementControl = new ElementControl(); dropdownControl = new DropDownControl(); alertControl = new AlertControl(driver); windowControl = new WindowsControl(driver); }
}//TODO - to check public void SelectHartfordFromDropdown() { DropDownControl dropDown = new DropDownControl(driver, By.XPath("//span[@aria-activedescendant='CurrentClient_option_selected']")); dropDown.selectElementByValue(By.XPath("//li[.='TheHartford']")); Logger.Trace("The Hartford client is selected."); } //Прикручен внешний контрол
void DropDownControl_KeyDown(object sender, KeyEventArgs e) { if (!DropDownControl.ProcessKeys) { switch (e.KeyCode) { case Keys.F4: case Keys.Escape: case Keys.Up: case Keys.Down: case Keys.PageDown: case Keys.PageUp: case Keys.Enter: DropDownControl.ProcessKey(e.KeyCode, e.Modifiers); e.Handled = true; e.SuppressKeyPress = true; break; } if (!e.Handled) { OnKeyDown(e); } } }
public void Close() { if (this.dropDownControl != null) { this.dropDownControl.Close(); this.dropDownControl = null; } }
private void timerAutoFocus_Tick(object sender, EventArgs e) { if (m_popupCtrl.Visible && !DropDownControl.Focused) { DropDownControl.Focus(); m_timerAutoFocus.Enabled = false; } if (base.DroppedDown) { base.DroppedDown = false; } }
public void Open(RibbonContainer ribbonContainer, Point relativeLocation) { Point p = (ribbonContainer as IRibbonItemContainerServices).GetLocationInScreen(); if (this.dropDownControl != null) { Close(); } this.dropDownControl = this.ribbonContainer.ResourceManager.Allocate <DropDownControl>(GetDropDownControlType()); this.dropDownControl.Owner = this; this.dropDownControl.RibbonItems = this.RibbonItems; this.dropDownControl.ParentDropDownControl = null; this.dropDownControl.Show(p.X + relativeLocation.X, p.Y + relativeLocation.Y); }
public override void CreateAttributes() { DropDownControl DropDown = new DropDownControl(PressIn, this); Hu_DropDownAttribute Attr_DropDown = new Hu_DropDownAttribute(this, MenuNames, DropDown); Normal_DropDownAttribute Attr_DropDownNormal = new Normal_DropDownAttribute(this, MenuNames, DropDown); if (Properties.Settings.Default.Is_Hu_Attribute) { m_attributes = Attr_DropDown; } else { m_attributes = Attr_DropDownNormal; } }
public void Open(RibbonItem item, Point relativeLocation) { Point p = item.ItemContainer.Services.GetLocationInScreen(item.ItemContainer); Point pg = item.ItemContainer.Services.GetBounds(item.ItemContainer).Location; Point pi = item.ItemContainer.GetItemBounds(item).Location; if (this.dropDownControl != null) { Close(); } this.dropDownControl = this.ribbonContainer.ResourceManager.Allocate <DropDownControl>(GetDropDownControlType()); this.dropDownControl.Owner = this; this.dropDownControl.RibbonItems = this.RibbonItems; this.dropDownControl.ParentDropDownControl = item.ItemContainer.Services.Host as DropDownControl; this.dropDownControl.Show(p.X + pi.X - pg.X + relativeLocation.X, p.Y + pi.Y - pg.Y + relativeLocation.Y); }
public DropDownProvider(Control container, Control ancora, int segundosTimeOut = 0) { _dropDownControl = new DropDownControl() { Visible = false }; _dropDownControl.Parent = ancora; _ancora = ancora; _dropDownControl.InitializeDropDown(container); _cronometro = 0; _timeOut = segundosTimeOut; _timer = new Timer() { Interval = 1000 }; _timer.Tick += _timer_Tick; }
private string DrawListOfMethods(GameObject go, ActionBase comparer, string propertPath, Type[] accepatbleTypes, DropDownControl<string> dropDown) { string result = propertPath; if (accepatbleTypes == null) { result = DrawManualPropertyEditField(go, propertPath, accepatbleTypes, dropDown); } else { bool isPropertyOrFieldFound = true; if (string.IsNullOrEmpty(result)) { var options = GetFieldsAndProperties(go, comparer, result, accepatbleTypes); isPropertyOrFieldFound = options.Any(); if (isPropertyOrFieldFound) { result = options.First(); } } if (isPropertyOrFieldFound) { dropDown.Draw(go.name + '.', result, () => { try { var options = GetFieldsAndProperties(go, comparer, result, accepatbleTypes); return options.ToArray(); } catch (Exception) { Debug.LogWarning("An exception was thrown while resolving a property list. Resetting property path."); result = ""; return new string[0]; } }, s => result = s); } else { result = DrawManualPropertyEditField(go, propertPath, accepatbleTypes, dropDown); } } return result; }
protected override void Dispose(bool disposing) { try { if (disposing) { if (_ListBoxTemplate != null) { _ListBoxTemplate.Dispose(); _ListBoxTemplate = null; } if (DropDownControl != null) { DropDownControl.Dispose(); DropDownControl = null; } } } finally { base.Dispose(disposing); } }
private string DrawManualPropertyEditField(GameObject go, string propertPath, Type[] acceptableTypes, DropDownControl<string> dropDown) { var propertyResolver = new PropertyResolver { AllowedTypes = acceptableTypes }; IList<string> list; var loadProps = new Func<string[]> (() => { try { list = propertyResolver.GetFieldsAndPropertiesUnderPath (go, propertPath); } catch (ArgumentException) { list = propertyResolver.GetFieldsAndPropertiesUnderPath (go, ""); } return list.ToArray (); }); EditorGUILayout.BeginHorizontal(); var labelSize = EditorStyles.label.CalcSize(new GUIContent(go.name + '.')); GUILayout.Label (go.name + (propertPath.Length > 0 ? "." : ""), EditorStyles.label, GUILayout.Width (labelSize.x)); string btnName = "hintBtn"; if ( GUI.GetNameOfFocusedControl () == btnName && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.DownArrow) { Event.current.Use (); dropDown.PrintMenu (loadProps ()); GUI.FocusControl (""); focusBackToEdit = true; } EditorGUI.BeginChangeCheck (); GUI.SetNextControlName (btnName); var result = GUILayout.TextField(propertPath, EditorStyles.textField); if (EditorGUI.EndChangeCheck ()) { errorType = DoesPropertyExist (go, result); } if (focusBackToEdit) { focusBackToEdit = false; GUI.FocusControl (btnName); } if (GUILayout.Button ("clear", EditorStyles.miniButton, GUILayout.Width (38))) { result = ""; GUI.FocusControl (null); focusBackToEdit = true; errorType = DoesPropertyExist (go, result); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal (); GUILayout.Label ("", GUILayout.Width (labelSize.x)); dropDown.Draw("", result ?? "", loadProps, s => { result = s; GUI.FocusControl (null); focusBackToEdit = true; errorType = DoesPropertyExist (go, result); }); EditorGUILayout.EndHorizontal(); if (errorType != ErrorType.None) { if (errorType == ErrorType.MissingComponent) EditorGUILayout.HelpBox ("This property or field is not attached or set. It will fail unless it will be attached before check is perfomed.", MessageType.Warning); else if (errorType == ErrorType.DoesNotExist) EditorGUILayout.HelpBox ("This property does not exist", MessageType.Error); } return result; }
public void ExpandSelectDataVersionDropdown() { DropDownControl dropDown = new DropDownControl(driver, By.XPath("html/body/div[2]/div[3]/div/table/tbody/tr/td[1]/table/tbody/tr[1]/td[2]/form/span/span")); dropDown.expandDropDown(By.XPath("html/body/div[2]/div[3]/div/table/tbody/tr/td[1]/table/tbody/tr[1]/td[2]/form/span/span")); }
//将Parameter固定为12*20的方块大小 public Normal_DropDownAttribute(GH_Component owner, List <string> MenuNames, DropDownControl DropDown) : base(owner) { this.ContextMenuName = MenuNames; this.DropDownControl = DropDown; }
public void LoadData(Repository repository) { DropDownControl.LoadData(repository); }
public void ExpandDNISControl() { DropDownControl dropDown = new DropDownControl(driver, By.XPath("//span[@aria-activedescendant='CurrentClient_option_selected']")); dropDown.expandDropDown(By.XPath("html/body/div[2]/div[3]/div/table/tbody/tr/td[1]/table/tbody/tr[2]/td[2]/form/span/span/span[2]/span")); }
public void EndUpdate() { DropDownControl.EndUpdate(); }
public void BeginUpdate() { DropDownControl.BeginUpdate(); }
void DropDownControl_MouseMove(object sender, MouseEventArgs e) { Point converted = PointToClient(DropDownControl.PointToScreen(e.Location)); OnMouseMove(new MouseEventArgs(e.Button, e.Clicks, converted.X, converted.Y, e.Delta)); }
public void ExpandClientDropdown() { DropDownControl dropDown = new DropDownControl(driver, By.XPath("//span[@aria-activedescendant='CurrentClient_option_selected']")); dropDown.expandDropDown(By.XPath("html/body/div[1]/div[1]/div/div/div[2]/div[1]/form/span/span")); }//TODO - to check