public TableCoordinatorBase(ITableManager tableManager, PlacementDrivenLogicalControl logicalControl, int mgColumn) { _tableManager = tableManager; _logicalControl = logicalControl; MgColumn = mgColumn; MgRow = logicalControl._mgRow; }
/// <summary> /// Gets logical control cell rect in table /// </summary> /// <param name="lg"></param> /// <returns></returns> public override Rectangle GetCellRect(PlacementDrivenLogicalControl lg) { LogicalControl logicalControl = (LogicalControl)lg; TableCoordinator tableCoordinator = (TableCoordinator)lg.Coordinator; return(tableCoordinator.GetCellRect(lg._mgColumn, logicalControl._mgRow)); }
/// <summary> /// calculate foreground color /// </summary> /// <param name="isSelected"></param><param name="lg"></param> /// <returns></returns> protected Color computeControlFgColor(bool isSelected, bool isRowMarked, PlacementDrivenLogicalControl lg) { Color fgColor; if (!IsControlEnable(lg)) { fgColor = DisabledTextColor; } else if ((isSelected || isRowMarked) && RowHighlitingStyle == RowHighlightType.BackgroundControls) { if (isRowMarked) { fgColor = HightlightFgColor; } else { fgColor = GetForegroundColor(lg); } } else { fgColor = GetForegroundColor(lg); } return(fgColor); }
public override void PaintControl(PlacementDrivenLogicalControl lg, Rectangle cellRect, Graphics g, bool isRowMarked, bool isSelected, ColumnsManager columnsManager) { base.PaintControl(lg, cellRect, g, isRowMarked, isSelected, columnsManager); LogicalControl logicalControl = (LogicalControl)lg; // paint controls if (GuiUtilsBase.isOwnerDrawControl(logicalControl.GuiMgControl)) { var tableCoordinator = (TableCoordinator)lg.Coordinator; ILogicalColumn lgColumn = columnsManager.getLgColumnByMagicIdx(lg._mgColumn); if (lg.Visible && lgColumn.Visible && tableCoordinator.getEditorControl() == null) { bool keepColor; //calculate background color Color controlBgColor = computeControlBgColor((LogicalControl)lg, columnsManager, null, isRowMarked, false, OnGetGuiRowIndex(lg._mgRow), true, out keepColor); Rectangle displayRect = tableCoordinator.getDisplayRect(cellRect, false); //calculate foreground color Color fgColor = computeControlFgColor(isSelected, isRowMarked, (LogicalControl)lg); //paint the control logicalControl.paint(g, displayRect, controlBgColor, fgColor, keepColor); } } }
protected virtual Color GetColumnBackgroundColor(PlacementDrivenLogicalControl logicalControl, ColumnsManager columnsManager) { return(Color.Empty); }
protected virtual bool IsControlEnable(PlacementDrivenLogicalControl logicalControl) { return(true); }
protected virtual Color GetForegroundColor(PlacementDrivenLogicalControl logicalControl) { return(Color.Empty); }
protected virtual Color GetBackgroundColor(PlacementDrivenLogicalControl logicalControl, bool ownerDraw) { return(Color.Empty); }
protected virtual bool IsComboControl(PlacementDrivenLogicalControl logicalControl) { return(false); }
protected override Color GetBackgroundColor(PlacementDrivenLogicalControl logicalControl, bool ownerDraw) { return(((LogicalControl)logicalControl).getBackgroundColor(ownerDraw)); }
protected override bool IsButtonControl(PlacementDrivenLogicalControl logicalControl) { return(((LogicalControl)logicalControl).GuiMgControl.IsButtonPushButton()); }
protected override Color GetColumnBackgroundColor(PlacementDrivenLogicalControl logicalControl, ColumnsManager columnsManager) { return(((LgColumn)columnsManager.getLgColumnByMagicIdx(((TableCoordinator)logicalControl.Coordinator).MgColumn)).BgColor); }
protected override bool IsControlEnable(PlacementDrivenLogicalControl logicalControl) { return(((LogicalControl)logicalControl).Enabled); }
protected override bool IsControlModifiable(PlacementDrivenLogicalControl logicalControl) { return(((LogicalControl)logicalControl).Modifable); }
protected override Color GetForegroundColor(PlacementDrivenLogicalControl logicalControl) { return(((LogicalControl)logicalControl).FgColor); }
public virtual Rectangle GetCellRect(PlacementDrivenLogicalControl lg) { return(new Rectangle()); }
/// <summary> compute control background color /// </summary> /// <param name="child">table child</param> /// <param name="control">editor control, can be null for painting control without editor</param> /// <param name="isRowMarked">is row marked</param> /// <param name="recievingFocus">TODO</param> /// <param name="guiRow">gui row number</param> /// <returns></returns> public Color computeControlBgColor(PlacementDrivenLogicalControl child, ColumnsManager columnsManager, Control control, bool isRowMarked, bool isFocusedControl, int guiRow, bool ownerDraw, out bool keepColor) { Color bgColor; keepColor = false; //QCR #320284. PushButton is a special case. For all other controls, alternate and //highlight (if RowHighlightStyle=BG & Controls) has precedence over control's //own color. But for PushButtons, it is the other way round. if (IsButtonControl(child)) { return(GetBackgroundColor(child, ownerDraw)); } if (isRowMarked) { if (RowHighlitingStyle == RowHighlightType.BackgroundControls) { if (control != null) { // if the control is in the selected row // check if controls is in focus, we do not use display.getfocusedContol, cause sometimes // it takes time for display.getfocusedContol() to be set and wrong results are recieved //bool isFocusedControl = false;// TODO: ((getFocusedControl(table.getDisplay()) == control) || recievingFocus); // if control is modifable and is focused take the BG color of the control if ((IsControlModifiable(child) && isFocusedControl) || IsComboControl(child)) { bgColor = GetBackgroundColor(child, ownerDraw); keepColor = true; } else { bgColor = HightlightBgColor; } } else { bgColor = HightlightBgColor; } } else if (_tableControl.HasAlternateColor && !(IsControlModifiable(child) && isFocusedControl)) { bgColor = _tableControl.GetColorbyRow(guiRow); } else { bgColor = GetBackgroundColor(child, ownerDraw); keepColor = true; } } else if (_tableControl.HasAlternateColor) { bgColor = _tableControl.GetColorbyRow(guiRow); } else { bgColor = GetBackgroundColor(child, ownerDraw); if (_tableControl.ColorBy == TableColorBy.Column && bgColor == null) { //transparent control, should have column color bgColor = GetColumnBackgroundColor(child, columnsManager); } else { keepColor = true; } } return(bgColor); }
/// <summary> /// Paints logical control /// </summary> /// <param name="lg"></param> /// <param name="cellRect"></param> /// <param name="g"></param> /// <param name="isRowMarked"></param> /// <param name="isSelected"></param> /// <param name="columnsManager"></param> public virtual void PaintControl(PlacementDrivenLogicalControl lg, Rectangle cellRect, Graphics g, bool isRowMarked, bool isSelected, ColumnsManager columnsManager) { }
protected override bool IsComboControl(PlacementDrivenLogicalControl logicalControl) { return(((LogicalControl)logicalControl).GuiMgControl.Type == MgControlType.CTRL_TYPE_COMBO); }