A Cell with a CheckBox. This Cell is of type bool.
Inheritance: Cell
コード例 #1
0
        public void Fill(CalendarOptions options)
        {
            this.Rows.Clear();
            createGridHeader();
            for (int i = 0; i < PluginsManager.Instance.Modules.Length; i++)
            {
                int newRowIndex = Rows.Count;
                Rows.Insert(newRowIndex);
                var row    = Rows[newRowIndex];
                var module = PluginsManager.Instance.Modules[i];
                row.Tag = module.GlobalId;
                string text = EntryObjectLocalizationManager.Instance.GetString(module.EntryObjectType, LocalizationConstants.EntryObjectName);
                var    cell = new SourceGrid.Cells.Cell(text);
                cell.Image           = module.ModuleImage;
                this[newRowIndex, 0] = cell;

                bool isChecked = true;
                if (options.ShowIcons.ContainsKey(module.GlobalId))
                {
                    isChecked = options.ShowIcons[module.GlobalId];
                }
                cell = new SourceGrid.Cells.CheckBox(null, isChecked);
                this[newRowIndex, 1] = cell;
                isChecked            = options.GetDefaultEntry(module.GlobalId);
                cell = new SourceGrid.Cells.CheckBox(null, isChecked);
                this[newRowIndex, 2] = cell;
            }
            Columns.AutoSizeColumn(0);
        }
コード例 #2
0
        private void TransmitChanged(object sender, EventArgs e)
        {
            CellContext context = (CellContext)sender;
            CheckBox    cell    = (CheckBox)context.Cell;

            if (cell.Checked != true)
            {
                return;
            }

            PluginBase plugin = cell.Row.Tag as PluginBase;

            if (plugin == null)
            {
                return;
            }

            for (int row = 1; row < gridPlugins.RowsCount; row++)
            {
                CheckBox checkBox = gridPlugins[row, ColTransmit] as CheckBox;

                if (checkBox != null && checkBox.Checked == true &&
                    !gridPlugins[row, ColName].DisplayText.Equals(plugin.Name, StringComparison.OrdinalIgnoreCase))
                {
                    checkBox.Checked = false;
                }
            }
        }
コード例 #3
0
        public void Bug0001()
        {
            var grid1 = new Grid();

            grid1.Redim(4, 12);
            grid1.FixedRows = 2;

            grid1[0, 3]            = new Cell("5 Column Header");
            grid1[0, 3].ColumnSpan = 5;

            //2 Header Row
            grid1[1, 0] = new Cell("1");
            grid1[1, 1] = new Cell("2");

            var cell = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span", false);

            grid1[2, 2]            = cell;
            grid1[2, 2].ColumnSpan = 2;
            grid1[2, 2].RowSpan    = 2;

            // test that all cells point to the same cell
            Assert.AreEqual(cell, grid1.GetCell(2, 3));
            Assert.AreEqual(cell, grid1.GetCell(3, 2));
            Assert.AreEqual(cell, grid1.GetCell(3, 3));
        }
コード例 #4
0
ファイル: CrudGrid.cs プロジェクト: Sphere10/Framework
        private Cell CreateCheckBoxCell(ICrudGridColumn columnBinding, object entity, object cellValue)
        {
            var checkbox = new SourceGrid.Cells.CheckBox(null, (bool?)cellValue)
            {
                Editor = { EnableEdit = AllowCellEditing && columnBinding.CanEditCell }
            };

            return(checkbox);
        }
コード例 #5
0
        private void PluginDoubleClick(object sender, EventArgs e)
        {
            CellContext context = (CellContext)sender;
            Cell        cell    = (Cell)context.Cell;

            CheckBox checkBoxReceive = gridPlugins[cell.Row.Index, ColReceive] as CheckBox;

            if (checkBoxReceive != null)
            {
                checkBoxReceive.Checked = true;
            }

            CheckBox checkBoxTransmit = gridPlugins[cell.Row.Index, ColTransmit] as CheckBox;

            if (checkBoxTransmit != null)
            {
                checkBoxTransmit.Checked = true;
            }
        }
コード例 #6
0
ファイル: Config.cs プロジェクト: Azzuro/IR-Server-Suite
    private void CreateGrid()
    {
      IrssLog.Info("Creating configuration grid ...");

      try
      {
        int row = 0;

        gridPlugins.Rows.Clear();
        gridPlugins.Columns.SetCount(5);

        // Setup Column Headers
        gridPlugins.Rows.Insert(row);

        ColumnHeader header = new ColumnHeader(" ");
        header.AutomaticSortEnabled = false;
        gridPlugins[row, ColIcon] = header;

        gridPlugins[row, ColName] = new ColumnHeader("Name");
        gridPlugins[row, ColReceive] = new ColumnHeader("Receive");
        gridPlugins[row, ColTransmit] = new ColumnHeader("Transmit");
        gridPlugins[row, ColConfigure] = new ColumnHeader("Configure");
        gridPlugins.FixedRows = 1;

        foreach (PluginBase transceiver in _transceivers)
        {
          gridPlugins.Rows.Insert(++row);
          gridPlugins.Rows[row].Tag = transceiver;

          // Icon Cell
          if (transceiver.DeviceIcon != null)
          {
            Image iconCell = new Image(transceiver.DeviceIcon);
            iconCell.Editor.EnableEdit = false;

            gridPlugins[row, ColIcon] = iconCell;
          }
          else
          {
            gridPlugins[row, ColIcon] = new Cell();
          }

          // Name Cell
          Cell nameCell = new Cell(transceiver.Name);

          CustomEvents nameCellController = new CustomEvents();
          nameCellController.DoubleClick += PluginDoubleClick;
          nameCell.AddController(nameCellController);

          nameCell.AddController(new ToolTipText());
          nameCell.ToolTipText = String.Format("{0}\nVersion: {1}\nAuthor: {2}\n{3}", transceiver.Name,
                                               transceiver.Version, transceiver.Author, transceiver.Description);

          gridPlugins[row, ColName] = nameCell;

          // Receive Cell
          if (transceiver is IRemoteReceiver || transceiver is IMouseReceiver || transceiver is IKeyboardReceiver)
          {
            gridPlugins[row, ColReceive] = new CheckBox();
          }
          else
          {
            gridPlugins[row, ColReceive] = new Cell();
          }

          // Transmit Cell
          if (transceiver is ITransmitIR)
          {
            CheckBox checkbox = new CheckBox();

            CustomEvents checkboxcontroller = new CustomEvents();
            checkboxcontroller.ValueChanged += TransmitChanged;
            checkbox.Controller.AddController(checkboxcontroller);

            gridPlugins[row, ColTransmit] = checkbox;
          }
          else
          {
            gridPlugins[row, ColTransmit] = new Cell();
          }

          // Configure Cell
          if (transceiver is IConfigure)
          {
            Button button = new Button("Configure");

            SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button();
            buttonClickEvent.Executed += buttonClickEvent_Executed;
            button.Controller.AddController(buttonClickEvent);

            gridPlugins[row, ColConfigure] = button;
          }
          else
          {
            gridPlugins[row, ColConfigure] = new Cell();
          }
        }

        gridPlugins.Columns[ColIcon].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
        gridPlugins.Columns[ColName].AutoSizeMode = SourceGrid.AutoSizeMode.Default;
        gridPlugins.Columns[ColReceive].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
        gridPlugins.Columns[ColTransmit].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
        gridPlugins.Columns[ColConfigure].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
        gridPlugins.AutoStretchColumnsToFitWidth = true;
        gridPlugins.AutoSizeCells();
        gridPlugins.SortRangeRows(new RangeFullGridNoFixedRows(), ColName, true, new ValueCellComparer());
      }
      catch (Exception ex)
      {
        IrssLog.Error(ex);
        MessageBox.Show(this, ex.ToString(), "Error setting up plugin grid", MessageBoxButtons.OK, MessageBoxIcon.Error);
      }
    }
コード例 #7
0
        private void CreateGrid()
        {
            IrssLog.Info("Creating configuration grid ...");

            try
            {
                int row = 0;

                gridPlugins.Rows.Clear();
                gridPlugins.Columns.SetCount(5);

                // Setup Column Headers
                gridPlugins.Rows.Insert(row);

                ColumnHeader header = new ColumnHeader(" ");
                header.AutomaticSortEnabled = false;
                gridPlugins[row, ColIcon]   = header;

                gridPlugins[row, ColName]      = new ColumnHeader("Name");
                gridPlugins[row, ColReceive]   = new ColumnHeader("Receive");
                gridPlugins[row, ColTransmit]  = new ColumnHeader("Transmit");
                gridPlugins[row, ColConfigure] = new ColumnHeader("Configure");
                gridPlugins.FixedRows          = 1;

                foreach (PluginBase transceiver in _transceivers)
                {
                    gridPlugins.Rows.Insert(++row);
                    gridPlugins.Rows[row].Tag = transceiver;

                    // Icon Cell
                    if (transceiver.DeviceIcon != null)
                    {
                        Image iconCell = new Image(transceiver.DeviceIcon);
                        iconCell.Editor.EnableEdit = false;

                        gridPlugins[row, ColIcon] = iconCell;
                    }
                    else
                    {
                        gridPlugins[row, ColIcon] = new Cell();
                    }

                    // Name Cell
                    Cell nameCell = new Cell(transceiver.Name);

                    CustomEvents nameCellController = new CustomEvents();
                    nameCellController.DoubleClick += PluginDoubleClick;
                    nameCell.AddController(nameCellController);

                    nameCell.AddController(new ToolTipText());
                    nameCell.ToolTipText = String.Format("{0}\nVersion: {1}\nAuthor: {2}\n{3}", transceiver.Name,
                                                         transceiver.Version, transceiver.Author, transceiver.Description);

                    gridPlugins[row, ColName] = nameCell;

                    // Receive Cell
                    if (transceiver is IRemoteReceiver || transceiver is IMouseReceiver || transceiver is IKeyboardReceiver)
                    {
                        gridPlugins[row, ColReceive] = new CheckBox();
                    }
                    else
                    {
                        gridPlugins[row, ColReceive] = new Cell();
                    }

                    // Transmit Cell
                    if (transceiver is ITransmitIR)
                    {
                        CheckBox checkbox = new CheckBox();

                        CustomEvents checkboxcontroller = new CustomEvents();
                        checkboxcontroller.ValueChanged += TransmitChanged;
                        checkbox.Controller.AddController(checkboxcontroller);

                        gridPlugins[row, ColTransmit] = checkbox;
                    }
                    else
                    {
                        gridPlugins[row, ColTransmit] = new Cell();
                    }

                    // Configure Cell
                    if (transceiver is IConfigure)
                    {
                        Button button = new Button("Configure");

                        SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button();
                        buttonClickEvent.Executed += buttonClickEvent_Executed;
                        button.Controller.AddController(buttonClickEvent);

                        gridPlugins[row, ColConfigure] = button;
                    }
                    else
                    {
                        gridPlugins[row, ColConfigure] = new Cell();
                    }
                }

                gridPlugins.Columns[ColIcon].AutoSizeMode      = SourceGrid.AutoSizeMode.EnableAutoSize;
                gridPlugins.Columns[ColName].AutoSizeMode      = SourceGrid.AutoSizeMode.Default;
                gridPlugins.Columns[ColReceive].AutoSizeMode   = SourceGrid.AutoSizeMode.EnableAutoSize;
                gridPlugins.Columns[ColTransmit].AutoSizeMode  = SourceGrid.AutoSizeMode.EnableAutoSize;
                gridPlugins.Columns[ColConfigure].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
                gridPlugins.AutoStretchColumnsToFitWidth       = true;
                gridPlugins.AutoSizeCells();
                gridPlugins.SortRangeRows(new RangeFullGridNoFixedRows(), ColName, true, new ValueCellComparer());
            }
            catch (Exception ex)
            {
                IrssLog.Error(ex);
                MessageBox.Show(this, ex.ToString(), "Error setting up plugin grid", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #8
0
ファイル: TestGrid_Span.cs プロジェクト: wsrf2009/KnxUiEditor
		public void Bug0001()
		{
			var grid1 = new Grid();
			grid1.Redim(4, 12);
			grid1.FixedRows = 2;
			
			grid1[0, 3] = new Cell("5 Column Header");
			grid1[0, 3].ColumnSpan = 5;

			//2 Header Row
			grid1[1, 0] = new Cell("1");
			grid1[1, 1] = new Cell("2");
			
			var cell = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span", false);
			grid1[2, 2] = cell;
			grid1[2, 2].ColumnSpan = 2;
			grid1[2, 2].RowSpan = 2;
			
			// test that all cells point to the same cell
			Assert.AreEqual(cell, grid1.GetCell(2, 3));
			Assert.AreEqual(cell, grid1.GetCell(3, 2));
			Assert.AreEqual(cell, grid1.GetCell(3, 3));
		}
コード例 #9
0
ファイル: RuleGrid.cs プロジェクト: lulalala/uniform-renamer
        public void AddRule(int rule, int r)
        {
            Rows.Insert(r);
            if (rule == (int)RuleType.RuleDelete)
            {
                //this[r, ColType] = new SourceGrid.Cells.Cell("Delete", ruleTypeEditor);
                this[r, ColType] = createReadOnlyCell("delete");
                this[r, ColDestination] = createEmptyCell();
                this[r, ColReplacement] = createEmptyCell();
            }
            if (rule == (int)RuleType.RuleCopy)
            {
                //this[r, ColType] = new SourceGrid.Cells.Cell("Copy", ruleTypeEditor);
                this[r, ColType] = createReadOnlyCell("copy");
                this[r, ColDestination] = createOneClickCell();
                this[r, ColReplacement] = createEmptyCell();
            }
            if (rule == (int)RuleType.RuleReplace)
            {
                //this[r, ColType] = new SourceGrid.Cells.Cell("Replace", ruleTypeEditor);
                this[r, ColType] = createReadOnlyCell("replace");
                this[r, ColDestination] = createOneClickCell();
                this[r, ColReplacement] = createOneClickCell();
            }
            this[r, ColType].AddController(popMenu);
            //this[r, ColType].View = SourceGrid.Cells.Views.ComboBox.Default;
            this[r, ColControl] = new SourceGrid.Cells.CheckBox(String.Empty, true);
            this[r, ColControl].AddController(popMenu);
            this[r, ColPattern] = createOneClickTabCell();
            //this[r, ColPattern].AddController(new TabKeyEvent());

            AutoSizeCells();
        }