Ejemplo n.º 1
0
        public override void Update()
        {
            if (binding != null)
            {
                selectedValues = binding.GetValueAsInt();
            }
            else
            {
                selectedValues = -1;
            }

            var v = enums.Select((_, i) => Tuple.Create(_, i)).Where(_ => _.Item1 == selectedValues).FirstOrDefault();

            if (Manager.NativeManager.BeginCombo(id, FieldNames[v.Item2], swig.ComboFlags.None, icons[v.Item2]))
            {
                for (int i = 0; i < FieldNames.Count; i++)
                {
                    bool is_selected = (FieldNames[v.Item2] == FieldNames[i]);

                    if (Manager.NativeManager.Selectable(FieldNames[i], is_selected, swig.SelectableFlags.None, icons[i]))
                    {
                        selectedValues = enums[i];
                        binding.SetValue(selectedValues);
                    }

                    if (is_selected)
                    {
                        Manager.NativeManager.SetItemDefaultFocus();
                    }
                }

                Manager.NativeManager.EndCombo();
            }
        }
Ejemplo n.º 2
0
        void Read()
        {
            if (!Reading)
            {
                throw new Exception();
            }

            if (binding != null)
            {
                for (int i = 0; i < enums.Length; i++)
                {
                    if (enums[i] == binding.GetValueAsInt())
                    {
                        SelectedIndex = i;
                        break;
                    }
                }

                Enabled = true;
            }
            else
            {
                SelectedIndex = -1;
                Enabled       = false;
            }
        }
Ejemplo n.º 3
0
        public void Update()
        {
            if (binding != null)
            {
                selectedValues = binding.GetValueAsInt();
            }
            else
            {
                selectedValues = -1;
            }

            var v = enums.Select((_, i) => Tuple.Create(_, i)).Where(_ => _.Item1 == selectedValues).FirstOrDefault();

            if (Manager.NativeManager.BeginCombo(Label + id, names[v.Item2], swig.ComboFlags.None))
            {
                for (int i = 0; i < names.Count; i++)
                {
                    bool is_selected = (names[v.Item2] == names[i]);
                    if (Manager.NativeManager.Selectable(names[i], is_selected))
                    {
                        selectedValues = enums[i];
                        binding.SetValue(selectedValues);
                    }

                    if (is_selected)
                    {
                        Manager.NativeManager.SetItemDefaultFocus();
                    }
                }

                Manager.NativeManager.EndCombo();
            }

            Console.WriteLine("Not implemented.");
        }
Ejemplo n.º 4
0
        public override void Update()
        {
            if (binding != null)
            {
                selectedValues = binding.GetValueAsInt();
            }
            else
            {
                selectedValues = -1;
            }

            if (EnableUndo)
            {
                valueChangingProp.Enable(binding);
            }

            var v = enums.Select((_, i) => Tuple.Create(_, i)).Where(_ => _.Item1 == selectedValues).FirstOrDefault();

            if (Manager.NativeManager.BeginCombo(InternalLabel + id, FieldNames[v.Item2].ToString(), swig.ComboFlags.None))
            {
                for (int i = 0; i < FieldNames.Count; i++)
                {
                    bool is_selected = (FieldNames[v.Item2] == FieldNames[i]);

                    if (Manager.NativeManager.Selectable(FieldNames[i].ToString(), is_selected, swig.SelectableFlags.None))
                    {
                        selectedValues = enums[i];

                        if (EnableUndo)
                        {
                            binding.SetValue(selectedValues);
                        }
                        else
                        {
                            binding.SetValueDirectly(selectedValues);
                        }
                    }

                    if (is_selected)
                    {
                        Manager.NativeManager.SetItemDefaultFocus();
                    }
                }

                Manager.NativeManager.EndCombo();
            }

            if (EnableUndo)
            {
                valueChangingProp.Disable();
            }
        }