public override void DrawRow(Graphics g, Rectangle rc, JetListViewNode itemNode, RowState state) { MultiLineColumnScheme scheme = _columnSchemeProvider.GetColumnScheme(itemNode.Data); int indent = GetRowIndent(itemNode, scheme); Rectangle rcFocus = GetFocusRect(itemNode, rc); bool focusRow = false, dropTargetRow = false; if (((state & RowState.Focused) != 0 && _searchHighlightText != null && _searchHighlightText.Length > 0)) { state |= RowState.IncSearchMatch; } if (_fullRowSelect) { FillFullRowSelectBar(g, rcFocus, state); } ClearRowSelectState(ref state, ref focusRow, ref dropTargetRow); foreach (MultiLineColumnSetting setting in scheme.ColumnSettings) { if (_fullRowSelect) { if ((state & RowState.IncSearchMatch) != 0 && (state & RowState.ActiveSelected) != 0) { state &= ~RowState.ActiveSelected; state |= RowState.InactiveSelected; } } _lastTextColor = setting.TextColor; _lastItemColorCallback = setting.Column.ForeColorCallback; _lastItemFontCallback = setting.Column.FontCallback; if ((state & (RowState.ActiveSelected | RowState.InactiveSelected)) == 0) { setting.Column.ForeColorCallback = new ItemColorCallback(GetColumnForeColor); } HorizontalAlignment lastAlignment = setting.Column.Alignment; int oldMargin = setting.Column.RightMargin; setting.Column.Alignment = setting.TextAlign; if (setting.TextAlign == HorizontalAlignment.Right) { setting.Column.RightMargin = 5; } Rectangle rcCol = GetRectangleFromSetting(scheme, setting, indent); rcCol.Offset(_borderSize, rc.Top); DrawColumnWithHighlight(g, rcCol, itemNode, setting.Column, state); setting.Column.ForeColorCallback = _lastItemColorCallback; setting.Column.Alignment = lastAlignment; setting.Column.RightMargin = oldMargin; } DrawRowSelectRect(g, rcFocus, dropTargetRow, focusRow); }
protected internal override Rectangle GetFocusRect(JetListViewNode itemNode, Rectangle rc) { MultiLineColumnScheme scheme = _columnSchemeProvider.GetColumnScheme(itemNode.Data); int indent = GetRowIndent(itemNode, scheme); return(new Rectangle(_borderSize + indent, rc.Top, _visibleWidth - _borderSize - indent, rc.Height)); }
public override void UpdateItem(object item) { MultiLineColumnScheme scheme = _columnSchemeProvider.GetColumnScheme(item); foreach (MultiLineColumnSetting setting in scheme.ColumnSettings) { setting.Column.UpdateItem(item); } }
public MultiLineColumnScheme(MultiLineColumnScheme rhs) { _columnSettings = new ArrayList(rhs._columnSettings.Count); foreach (MultiLineColumnSetting setting in rhs._columnSettings) { _columnSettings.Add(new MultiLineColumnSetting(setting)); } _columns = new ArrayList(rhs._columns); }
public override Rectangle GetColumnBounds(JetListViewColumn col, JetListViewNode node) { MultiLineColumnScheme scheme = _columnSchemeProvider.GetColumnScheme(node.Data); foreach (MultiLineColumnSetting setting in scheme.ColumnSettings) { if (setting.Column == col) { int indent = GetRowIndent(node, scheme); return(GetRectangleFromSetting(scheme, setting, indent)); } } throw new Exception("The specified column is not found in the column scheme for the specified node"); }
private int GetRowIndent(JetListViewNode node, MultiLineColumnScheme scheme) { if (!node.HasChildren && node.Level == 0 && !scheme.AlignTopLevelItems) { return(0); } foreach (JetListViewColumn col in scheme.Columns) { if (col.IsIndentColumn()) { return(col.GetIndent(node)); } } return(0); }
protected override JetListViewColumn GetColumnAndDelta(JetListViewNode node, int x, int y, out int deltaX, out int deltaY) { MultiLineColumnScheme scheme = _columnSchemeProvider.GetColumnScheme(node.Data); foreach (MultiLineColumnSetting setting in scheme.ColumnSettings) { int indent = GetRowIndent(node, scheme); Rectangle rcCol = GetRectangleFromSetting(scheme, setting, indent); if (rcCol.Contains(x, y)) { deltaX = x - rcCol.Left; deltaY = y - rcCol.Top; return(setting.Column); } } deltaX = 0; deltaY = 0; return(null); }
private Rectangle GetRectangleFromSetting(MultiLineColumnScheme scheme, MultiLineColumnSetting setting, int indent) { if (setting.Column.IsIndentColumn()) { return(new Rectangle(0, _topMargin, indent, _rowHeight)); } int baseWidth = scheme.BaseWidth; int deltaWidth = _visibleWidth - baseWidth - indent; int startX = setting.StartX + indent; int width = setting.Width; if ((setting.Anchor & ColumnAnchor.Left) == 0) { startX += deltaWidth; } if ((setting.Anchor & (ColumnAnchor.Left | ColumnAnchor.Right)) == (ColumnAnchor.Left | ColumnAnchor.Right)) { width += deltaWidth; } return(new Rectangle(startX, _topMargin + setting.StartRow * _rowHeight, width, (setting.EndRow - setting.StartRow + 1) * _rowHeight)); }
protected override IEnumerable GetColumnEnumerable(JetListViewNode node) { MultiLineColumnScheme scheme = _columnSchemeProvider.GetColumnScheme(node.Data); return(scheme.Columns); }
public override int GetRowHeight(JetListViewNode node) { MultiLineColumnScheme scheme = _columnSchemeProvider.GetColumnScheme(node.Data); return(scheme.RowCount * _rowHeight + _topMargin); }