Ejemplo n.º 1
0
 public TableCoordinatorBase(ITableManager tableManager, PlacementDrivenLogicalControl logicalControl, int mgColumn)
 {
     _tableManager   = tableManager;
     _logicalControl = logicalControl;
     MgColumn        = mgColumn;
     MgRow           = logicalControl._mgRow;
 }
Ejemplo n.º 2
0
        /// <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));
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        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);
                }
            }
        }
Ejemplo n.º 5
0
 protected virtual Color GetColumnBackgroundColor(PlacementDrivenLogicalControl logicalControl, ColumnsManager columnsManager)
 {
     return(Color.Empty);
 }
Ejemplo n.º 6
0
 protected virtual bool IsControlEnable(PlacementDrivenLogicalControl logicalControl)
 {
     return(true);
 }
Ejemplo n.º 7
0
 protected virtual Color GetForegroundColor(PlacementDrivenLogicalControl logicalControl)
 {
     return(Color.Empty);
 }
Ejemplo n.º 8
0
 protected virtual Color GetBackgroundColor(PlacementDrivenLogicalControl logicalControl, bool ownerDraw)
 {
     return(Color.Empty);
 }
Ejemplo n.º 9
0
 protected virtual bool IsComboControl(PlacementDrivenLogicalControl logicalControl)
 {
     return(false);
 }
Ejemplo n.º 10
0
 protected override Color GetBackgroundColor(PlacementDrivenLogicalControl logicalControl, bool ownerDraw)
 {
     return(((LogicalControl)logicalControl).getBackgroundColor(ownerDraw));
 }
Ejemplo n.º 11
0
 protected override bool IsButtonControl(PlacementDrivenLogicalControl logicalControl)
 {
     return(((LogicalControl)logicalControl).GuiMgControl.IsButtonPushButton());
 }
Ejemplo n.º 12
0
 protected override Color GetColumnBackgroundColor(PlacementDrivenLogicalControl logicalControl, ColumnsManager columnsManager)
 {
     return(((LgColumn)columnsManager.getLgColumnByMagicIdx(((TableCoordinator)logicalControl.Coordinator).MgColumn)).BgColor);
 }
Ejemplo n.º 13
0
 protected override bool IsControlEnable(PlacementDrivenLogicalControl logicalControl)
 {
     return(((LogicalControl)logicalControl).Enabled);
 }
Ejemplo n.º 14
0
 protected override bool IsControlModifiable(PlacementDrivenLogicalControl logicalControl)
 {
     return(((LogicalControl)logicalControl).Modifable);
 }
Ejemplo n.º 15
0
 protected override Color GetForegroundColor(PlacementDrivenLogicalControl logicalControl)
 {
     return(((LogicalControl)logicalControl).FgColor);
 }
Ejemplo n.º 16
0
 public virtual Rectangle GetCellRect(PlacementDrivenLogicalControl lg)
 {
     return(new Rectangle());
 }
Ejemplo n.º 17
0
        /// <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);
        }
Ejemplo n.º 18
0
 /// <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)
 {
 }
Ejemplo n.º 19
0
 protected override bool IsComboControl(PlacementDrivenLogicalControl logicalControl)
 {
     return(((LogicalControl)logicalControl).GuiMgControl.Type == MgControlType.CTRL_TYPE_COMBO);
 }