Ejemplo n.º 1
0
        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);
            };
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        /// <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);
 }
Ejemplo n.º 5
0
        }//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.");
        } //Прикручен внешний контрол
Ejemplo n.º 6
0
    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);
            }
        }
    }
Ejemplo n.º 7
0
 public void Close()
 {
     if (this.dropDownControl != null)
     {
         this.dropDownControl.Close();
         this.dropDownControl = null;
     }
 }
Ejemplo n.º 8
0
        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;
            }
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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;
            }
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
 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;
 }
Ejemplo n.º 13
0
        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;
        }
Ejemplo n.º 14
0
 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;
		}
Ejemplo n.º 16
0
        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"));
        }
Ejemplo n.º 17
0
 //将Parameter固定为12*20的方块大小
 public Normal_DropDownAttribute(GH_Component owner, List <string> MenuNames, DropDownControl DropDown) : base(owner)
 {
     this.ContextMenuName = MenuNames;
     this.DropDownControl = DropDown;
 }
Ejemplo n.º 18
0
 public void LoadData(Repository repository)
 {
     DropDownControl.LoadData(repository);
 }
Ejemplo n.º 19
0
        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"));
        }
Ejemplo n.º 20
0
 public void EndUpdate()
 {
     DropDownControl.EndUpdate();
 }
Ejemplo n.º 21
0
 public void BeginUpdate()
 {
     DropDownControl.BeginUpdate();
 }
Ejemplo n.º 22
0
    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));
    }
Ejemplo n.º 23
0
        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