/// <summary> /// Write the content of the tag specified /// </summary> /// <param name="p_Cell"></param> /// <param name="p_Position"></param> /// <param name="p_Export"></param> /// <param name="p_Writer"></param> /// <param name="p_ElementTagName"></param> protected override void ExportHTML_Element(Cells.ICellVirtual p_Cell, Position p_Position, IHTMLExport p_Export, System.Xml.XmlTextWriter p_Writer, string p_ElementTagName) { ICellCheckBox l_CheckBox = (ICellCheckBox)p_Cell; CheckBoxStatus l_Status = l_CheckBox.GetCheckBoxStatus(p_Position); if (p_ElementTagName == "td") { if (l_Status.Checked == true) { p_Writer.WriteRaw("<input type=\"checkbox\" checked>"); } else { p_Writer.WriteRaw("<input type=\"checkbox\">"); } base.ExportHTML_Element(p_Cell, p_Position, p_Export, p_Writer, p_ElementTagName); } else if (p_ElementTagName == "font") { Utility.ExportHTML_Element_Font(p_Writer, l_Status.Caption, GetCellFont()); //do not call base ExportHTML_Element because we use the caption not the display text //base.ExportHTML_Element(p_Cell, p_Position, p_Export, p_Writer, p_ElementTagName); } else { base.ExportHTML_Element(p_Cell, p_Position, p_Export, p_Writer, p_ElementTagName); } }
private void _SetCheckBoxAllState() { int num = 0; int num2 = 0; for (int i = 0; i < _checkbox_states.Length; i++) { if (_checkbox_states[i] == CheckBoxStatus.DISABLE) { num++; } else if (_checkbox_states[i] == CheckBoxStatus.ON) { num2++; } } if (_checkbox_states.Length == num) { _checkbox_all_state = CheckBoxStatus.DISABLE; } else if (_checkbox_states.Length == num2 + num) { _checkbox_all_state = CheckBoxStatus.ON; } else { _checkbox_all_state = CheckBoxStatus.OFF; } }
public void ClickCheckBoxAll() { CheckBoxStatus checkbox_all_state = this._checkbox_all_state; if (checkbox_all_state == CheckBoxStatus.OFF) { for (int i = 0; i < this._target_ships.get_Count(); i++) { ShipModel shipModel = this._target_ships.get_Item(i); if (shipModel != null && this.CheckBoxStates[i] != CheckBoxStatus.DISABLE) { this._ForceOnCheckStatus(shipModel.MemId); } } } else if (checkbox_all_state == CheckBoxStatus.ON) { for (int j = 0; j < this._target_ships.get_Count(); j++) { ShipModel shipModel2 = this._target_ships.get_Item(j); if (shipModel2 != null) { this._ForceOffCheckStatus(shipModel2.MemId); } } } for (int k = 0; k < this._target_ships.get_Count(); k++) { this._checkbox_states[k] = this._GetCheckBoxStatus(this._target_ships.get_Item(k), this._selected_deck); } this._CalcMaterialForSupply(); this._SetCheckBoxAllState(); }
private string ToString(CheckBoxStatus cb) { if (cb == CheckBoxStatus.DISABLE) { return(" - "); } if (cb == CheckBoxStatus.OFF) { return("[ ]"); } return("[o]"); }
public void ChangeAllStatus(CheckBoxStatus status) { if (status == CheckBoxStatus.Checked) { SelectedRows = new HashSet <TItem>(DataSource); } else { SelectedRows = new HashSet <TItem>(); } RefreshSelectAllStatus(); }
public void ChangeAllStatus(CheckBoxStatus status) { if (status == CheckBoxStatus.Checked) { SelectedRows = new HashSet <object>(Rows); } else { SelectedRows = new HashSet <object>(); } RefreshSelectAllStatus(); }
void SetCheckBoxStatus(CheckBoxStatus checkBoxStatus) { if (checkBoxStatus == null) { return; } WholeWords = checkBoxStatus.WholeWords; MatchCase = checkBoxStatus.MatchCase; MultiLine = checkBoxStatus.MultiLine; IsRegex = checkBoxStatus.IsRegex; EntireSelection = checkBoxStatus.EntireSelection; }
private string ToString(CheckBoxStatus cb) { switch (cb) { case CheckBoxStatus.DISABLE: return(" - "); case CheckBoxStatus.OFF: return("[ ]"); default: return("[o]"); } }
public void ChangeRowStatus(CheckBoxStatus status, TItem row) { if (status == CheckBoxStatus.Checked) { if (IsSingleSelect) { SelectedRows = new HashSet <TItem>(); } SelectedRows.Add(row); } else { SelectedRows.Remove(row); } RefreshSelectAllStatus(); }
protected void RefreshSelectAllStatus() { if (DataSource.Count == 0 || SelectedRows.Count == 0) { selectAllStatus = CheckBoxStatus.UnChecked; } else if (DataSource.Count > SelectedRows.Count) { selectAllStatus = CheckBoxStatus.Indeterminate; } else { selectAllStatus = CheckBoxStatus.Checked; } StateHasChanged(); }
void SetCheckBoxStatus(CheckBoxStatus checkBoxStatus) { if (checkBoxStatus == null) { return; } WholeWords = checkBoxStatus.WholeWords; MatchCase = checkBoxStatus.MatchCase; MultiLine = checkBoxStatus.MultiLine; IsRegex = checkBoxStatus.IsRegex; RegexGroups = checkBoxStatus.RegexGroups; EntireSelection = checkBoxStatus.EntireSelection; KeepMatching = checkBoxStatus.KeepMatching; RemoveMatching = checkBoxStatus.RemoveMatching; AddMatches = checkBoxStatus.AddMatches; }
/// <summary> /// Draw the image and the displaystring of the specified cell. /// </summary> /// <param name="p_Cell">The cell.</param> /// <param name="p_CellPosition">The cell position.</param> /// <param name="e">Paint arguments</param> /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param> /// <param name="p_Status">Cell status</param> protected override void DrawCell_ImageAndText(ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e, System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status) { //base.DrawCell_ImageAndText (p_Cell, p_CellPosition, e, p_ClientRectangle, p_ForeColor, p_CellBorder); if (p_ClientRectangle.Width == 0 || p_ClientRectangle.Height == 0) { return; } RectangleBorder l_Border = Border; Color l_ForeColor = ForeColor; if (p_Status == DrawCellStatus.Focus) { l_Border = FocusBorder; l_ForeColor = FocusForeColor; } else if (p_Status == DrawCellStatus.Selected) { l_Border = SelectionBorder; l_ForeColor = SelectionForeColor; } ICellCheckBox l_CheckBox = (ICellCheckBox)p_Cell; CheckBoxStatus l_Status = l_CheckBox.GetCheckBoxStatus(p_CellPosition); Image l_CheckImage = GetImageForState(l_Status.Checked, p_Cell.Grid.MouseCellPosition == p_CellPosition, l_Status.CheckEnable); Font l_CurrentFont = GetCellFont(); bool l_lastExpandedCell = p_Cell is ICell && ((ICell)p_Cell).IsLastExpandedCell; // Image and Text VisualModelBase.PaintImageAndText(e.Graphics, p_ClientRectangle, l_CheckImage, checkBoxAlignment, ImageStretch, l_Status.Caption, StringFormat, AlignTextToImage, l_Border, l_ForeColor, l_CurrentFont, false, l_lastExpandedCell); }
private CheckBoxOption <TModel, TValue> ConvertModelItem(TModel modelItem) { if (!ModelItemIsSimpleType) { return(null); } CheckBoxStatus status = CheckBoxStatus.Checked; if (IsChecked != null) { status = IsChecked(modelItem) ? CheckBoxStatus.Checked : CheckBoxStatus.UnChecked; } if (IsIndeterminate != null) { status = IsIndeterminate(modelItem) ? CheckBoxStatus.Indeterminate : CheckBoxStatus.UnChecked; } if (SelectedItems != null) { status = SelectedItems.Contains(modelItem) ? CheckBoxStatus.Checked : CheckBoxStatus.UnChecked; } var label = string.Empty; if (Label != null) { label = Label(modelItem); } else if (ModelItemIsSimpleType) { label = Convert.ToString(modelItem); } var option = new CheckBoxOption <TModel, TValue>() { Status = status, Value = Value == null ? (TValue)TypeHelper.ChangeType(label, typeof(TValue)) : Value(modelItem), IsDisabled = false, Label = label, Model = modelItem }; return(option); }
/// <summary> /// Draw the image and the displaystring of the specified cell. /// </summary> /// <param name="p_Cell"></param> /// <param name="p_CellPosition"></param> /// <param name="e">Paint arguments</param> /// <param name="p_ClientRectangle">Rectangle position where draw the current cell, relative to the current view,</param> /// <param name="p_Status"></param> protected override void DrawCell_ImageAndText(ICellVirtual p_Cell, Position p_CellPosition, System.Windows.Forms.PaintEventArgs e, System.Drawing.Rectangle p_ClientRectangle, DrawCellStatus p_Status) { //in questo caso non chiamo la classe base perch� devo disegnare una textbox //base.DrawCell_ImageAndText (p_Cell, p_CellPosition, e, p_ClientRectangle, p_ForeColor, p_CellBorder); RectangleBorder l_Border = Border; Color l_ForeColor = ForeColor; if (p_Status == DrawCellStatus.Focus) { l_Border = FocusBorder; l_ForeColor = FocusForeColor; } else if (p_Status == DrawCellStatus.Selected) { l_Border = SelectionBorder; l_ForeColor = SelectionForeColor; } ICellCheckBox l_CheckBox = (ICellCheckBox)p_Cell; CheckBoxStatus l_Status = l_CheckBox.GetCheckBoxStatus(p_CellPosition); Image l_CheckImage = GetImageForState(l_Status.Checked, p_Cell.Grid.MouseCellPosition == p_CellPosition, l_Status.CheckEnable); Font l_CurrentFont = GetCellFont(); //Image and Text Utility.PaintImageAndText(e.Graphics, p_ClientRectangle, l_CheckImage, m_CheckBoxAlignment, ImageStretch, l_Status.Caption, StringFormat, AlignTextToImage, l_Border, l_ForeColor, l_CurrentFont); }
protected void OnInnerStatusChanged(CheckBoxStatus status, TModel model) { if (SelectedItems == null) { return; } if (status == CheckBoxStatus.Checked) { lock (SelectedItems) { if (!SelectedItems.Contains(model)) { SelectedItems.Add(model); } } } else if (status == CheckBoxStatus.UnChecked) { lock (SelectedItems) { SelectedItems.Remove(model); } } }
void SetCheckBoxStatus(CheckBoxStatus checkBoxStatus) { if (checkBoxStatus == null) return; WholeWords = checkBoxStatus.WholeWords; MatchCase = checkBoxStatus.MatchCase; MultiLine = checkBoxStatus.MultiLine; IsRegex = checkBoxStatus.IsRegex; RegexGroups = checkBoxStatus.RegexGroups; EntireSelection = checkBoxStatus.EntireSelection; KeepMatching = checkBoxStatus.KeepMatching; RemoveMatching = checkBoxStatus.RemoveMatching; }