Ejemplo n.º 1
0
        public virtual int GetAutoHeight(Resco.Controls.AdvancedComboBox.ListItem li, int index, ItemSpecificCellProperties preRscp)
        {
            ItemSpecificCellProperties properties = (preRscp == null) ? this.GetItemSpecificProperties(li) : preRscp;

            properties.CachedAutoHeight = this.m_Bounds.Height;
            return(properties.CachedAutoHeight);
        }
Ejemplo n.º 2
0
        internal bool CustomizeCells(Resco.Controls.AdvancedComboBox.ListItem item)
        {
            bool flag = false;

            if (!this.HasCustomizedCells || (this.Parent == null))
            {
                return(false);
            }
            int count = this.m_CellTemplates.Count;

            for (int i = 0; i < count; i++)
            {
                Cell cell = this.m_CellTemplates[i];
                if (cell.CustomizeCell)
                {
                    object data = cell[item, i];
                    CustomizeCellEventArgs e = new CustomizeCellEventArgs(cell, data, item);
                    this.OnCustomizeCell(e);
                    ItemSpecificCellProperties itemSpecificProperties = cell.GetItemSpecificProperties(item);
                    bool flag2 = itemSpecificProperties.Visible.HasValue ? itemSpecificProperties.Visible.Value : cell.Visible;
                    itemSpecificProperties.Visible          = new bool?(e.Cell.Visible);
                    itemSpecificProperties.CachedAutoHeight = e.Cell.GetAutoHeight(e.DataItem, i, itemSpecificProperties);
                    itemSpecificProperties.Cea = e;
                    if (e.Cell.Visible != flag2)
                    {
                        flag = true;
                    }
                }
            }
            return(flag);
        }
Ejemplo n.º 3
0
        public bool IsVisible(Resco.Controls.AdvancedComboBox.ListItem li)
        {
            ItemSpecificCellProperties itemSpecificProperties = this.GetItemSpecificProperties(li);

            if (!itemSpecificProperties.Visible.HasValue)
            {
                return(this.Visible);
            }
            return(itemSpecificProperties.Visible.Value);
        }
Ejemplo n.º 4
0
 internal int GetCellClick(int pos_x, int pos_y, Resco.Controls.AdvancedComboBox.ListItem item)
 {
     for (int i = this.m_CellTemplates.Count - 1; i >= 0; i--)
     {
         ItemSpecificCellProperties itemSpecificProperties = this.m_CellTemplates[i].GetItemSpecificProperties(item);
         if ((itemSpecificProperties.Visible.Value && itemSpecificProperties.CachedBounds.HasValue) && itemSpecificProperties.CachedBounds.Value.Contains(pos_x, pos_y))
         {
             return(i);
         }
     }
     return(-1);
 }
Ejemplo n.º 5
0
        internal ItemSpecificCellProperties GetItemSpecificProperties(Resco.Controls.AdvancedComboBox.ListItem li)
        {
            ItemSpecificCellProperties properties = null;

            if (li != null)
            {
                properties = (ItemSpecificCellProperties)li.ItemSpecificCellProperties[this];
                if (properties == null)
                {
                    properties = new ItemSpecificCellProperties(this);
                    li.ItemSpecificCellProperties[this] = properties;
                }
            }
            return(properties);
        }
Ejemplo n.º 6
0
        protected internal virtual void Draw(Graphics gr, Rectangle rect, Resco.Controls.AdvancedComboBox.ListItem item)
        {
            this.CurrentItem = item;
            int height = this.GetHeight(item);

            if ((this.Parent != null) && (this.m_BackColor != Color.Transparent))
            {
                gr.FillRectangle(Resco.Controls.AdvancedComboBox.AdvancedComboBox.GetBrush(this.m_BackColor), rect.Left, rect.Top, rect.Width, height);
            }
            for (int i = 0; i < this.m_CellTemplates.Count; i++)
            {
                Cell cell = this.m_CellTemplates[i];
                ItemSpecificCellProperties iscp = null;
                object data = null;
                if (cell.CustomizeCell && (this.Parent != null))
                {
                    iscp = cell.GetItemSpecificProperties(item);
                    if (iscp.Cea != null)
                    {
                        cell = iscp.Cea.Cell;
                        data = iscp.Cea.Data;
                    }
                }
                else
                {
                    data = cell[item, i];
                }
                if (cell is ButtonCell)
                {
                    ((ButtonCell)cell).Pressed = item.PressedButtonIndex == i;
                }
                if ((cell != null) && cell.Visible)
                {
                    cell.Draw(gr, 0, rect.Top, rect.Width, data, iscp);
                }
                if (iscp != null)
                {
                    iscp.Cea = null;
                }
            }
        }
Ejemplo n.º 7
0
        public override int GetAutoHeight(Resco.Controls.AdvancedComboBox.ListItem item, int index, ItemSpecificCellProperties preRscp)
        {
            int num = 0;

            if (!base.AutoHeight)
            {
                return(base.Bounds.Height);
            }
            ItemSpecificCellProperties properties = (preRscp == null) ? base.GetItemSpecificProperties(item) : preRscp;

            if (properties.CachedAutoHeight >= 0)
            {
                return(properties.CachedAutoHeight);
            }
            string text = this.GetText(base[item, index]);

            if ((text == null) || (text.Length == 0))
            {
                return(0);
            }
            int gridWidth = 0;

            if (base.Parent != null)
            {
                gridWidth = base.Parent.List.Width - (base.Parent.List.ScrollbarVisible ? base.Parent.List.ClientScrollbarWidth : 0);
            }
            if (gridWidth != 0)
            {
                Rectangle rectangle = base.CalculateCellWidth(gridWidth);
                rectangle.Width -= 3;
                if (rectangle.Width > base.Parent.List.ClientScrollbarWidth)
                {
                    WrapTextData data = Utility.WrapText(base.Graphics, text, this.m_Font, rectangle.Width);
                    num = (data != null) ? (data.Height + 2) : 0;
                }
            }
            properties.CachedAutoHeight = num;
            return(num);
        }
Ejemplo n.º 8
0
        protected internal virtual Rectangle CalculateBounds(int xOffset, int yOffset, Resco.Controls.AdvancedComboBox.ListItem item, int gridWidth, ItemSpecificCellProperties preRscp)
        {
            Rectangle rectangle;
            ItemSpecificCellProperties itemSpecificProperties = preRscp;

            if (itemSpecificProperties == null)
            {
                itemSpecificProperties = this.GetItemSpecificProperties(item);
            }
            if ((itemSpecificProperties != null) && itemSpecificProperties.CachedBounds.HasValue)
            {
                rectangle = itemSpecificProperties.CachedBounds.Value;
            }
            else
            {
                int cachedAutoHeight = 0;
                if ((itemSpecificProperties != null) && (itemSpecificProperties.CachedAutoHeight >= 0))
                {
                    cachedAutoHeight = itemSpecificProperties.CachedAutoHeight;
                }
                rectangle = this.CalculateCellWidth(gridWidth);
                if (this.AutoHeight && (cachedAutoHeight > this.m_Bounds.Height))
                {
                    rectangle.Height = cachedAutoHeight;
                }
                if ((this.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom)
                {
                    if ((this.Anchor & AnchorStyles.Top) == AnchorStyles.Top)
                    {
                        rectangle.Height = item.ActualHeight - (this.m_anchorSizeTop + this.m_anchorSizeBottom);
                        if (rectangle.Height < 0)
                        {
                            rectangle.Height = 0;
                        }
                    }
                    else
                    {
                        rectangle.Y = item.ActualHeight - (this.m_anchorSizeBottom + rectangle.Height);
                        if (rectangle.Y < 0)
                        {
                            rectangle.Y = 0;
                        }
                    }
                }
                else if (rectangle.Bottom > item.ActualHeight)
                {
                    rectangle.Height = item.ActualHeight - rectangle.Y;
                }
                if ((this.Parent != null) ? this.Parent.RightToLeft : false)
                {
                    rectangle.X = this.Parent.Width - rectangle.Right;
                    xOffset    *= -1;
                }
                if (itemSpecificProperties != null)
                {
                    itemSpecificProperties.CachedBounds = new Rectangle?(rectangle);
                }
            }
            rectangle.Offset(xOffset, yOffset);
            return(rectangle);
        }
Ejemplo n.º 9
0
        protected internal virtual void Draw(System.Drawing.Graphics gr, int xOffset, int yOffset, int gridWidth, object data, ItemSpecificCellProperties iscp)
        {
            this.CurrentData = data;
            Rectangle drawbounds = this.CalculateBounds(xOffset, yOffset, this.Owner.CurrentItem, gridWidth, iscp);

            if (this.m_bVisible)
            {
                this.DrawBackground(gr, drawbounds);
                this.DrawContent(gr, drawbounds, data);
                this.DrawBorder(gr, drawbounds);
                if (this.Selectable)
                {
                    Cell cell = (iscp != null) ? iscp.OriginalCell : this.Parent.SelectedCell;
                    if ((cell == this) && ((this.Owner.CurrentItem == this.Parent.List.SelectedItem) || (this.Owner.CurrentItem == this.Parent.m_textBoxItem)))
                    {
                        this.DrawSelection(gr, drawbounds);
                    }
                }
            }
            this.CurrentData = null;
        }
Ejemplo n.º 10
0
        protected internal virtual void Draw(Graphics gr, int xOffset, int yOffset, Resco.Controls.AdvancedComboBox.ListItem item, int width, int height)
        {
            int   num       = (((this.Parent != null) ? this.Parent.RightToLeft : false) && this.Parent.List.ScrollbarVisible) ? this.Parent.List.ClientScrollbarWidth : 0;
            Color backColor = this.m_BackColor;

            this.CurrentItem = item;
            if (height == -1)
            {
                height = this.GetHeight(item);
            }
            if (backColor == Color.Transparent)
            {
                if (this.Parent.List.UseGradient)
                {
                    backColor = this.Parent.m_colorKey;
                }
                else
                {
                    backColor = this.Parent.BackColor;
                }
            }
            if (!this.m_useGradient && (this.Parent != null))
            {
                if ((this.Parent.DoubleBuffered && (this.Parent.List.GradientBackColor.FillDirection == FillDirection.Vertical)) || (!this.Parent.List.UseGradient || (this.m_BackColor != Color.Transparent)))
                {
                    gr.FillRectangle(Resco.Controls.AdvancedComboBox.AdvancedComboBox.GetBrush(backColor), xOffset + num, yOffset, width, height);
                }
            }
            else
            {
                this.m_bgRect.X      = xOffset + num;
                this.m_bgRect.Y      = yOffset;
                this.m_bgRect.Width  = width;
                this.m_bgRect.Height = height;
                this.m_gradientBackColor.DrawGradient(gr, this.m_bgRect);
            }
            int count = this.m_CellTemplates.Count;

            for (int i = 0; i < count; i++)
            {
                Cell cell = this.m_CellTemplates[i];
                ItemSpecificCellProperties iscp = null;
                object data = null;
                if (cell.CustomizeCell && (this.Parent != null))
                {
                    iscp = cell.GetItemSpecificProperties(item);
                    if (iscp.Cea != null)
                    {
                        cell = iscp.Cea.Cell;
                        data = iscp.Cea.Data;
                    }
                }
                else
                {
                    data = cell[item, i];
                }
                if (cell is ButtonCell)
                {
                    ((ButtonCell)cell).Pressed = item.PressedButtonIndex == i;
                }
                if ((cell != null) && cell.Visible)
                {
                    cell.Draw(gr, xOffset, yOffset, width, data, iscp);
                }
                if (iscp != null)
                {
                    iscp.Cea = null;
                }
            }
        }
Ejemplo n.º 11
0
 internal ItemSpecificCellProperties GetItemSpecificProperties(Resco.Controls.AdvancedComboBox.ListItem li)
 {
     ItemSpecificCellProperties properties = null;
     if (li != null)
     {
         properties = (ItemSpecificCellProperties) li.ItemSpecificCellProperties[this];
         if (properties == null)
         {
             properties = new ItemSpecificCellProperties(this);
             li.ItemSpecificCellProperties[this] = properties;
         }
     }
     return properties;
 }
Ejemplo n.º 12
0
 protected internal virtual void Draw(System.Drawing.Graphics gr, int xOffset, int yOffset, int gridWidth, object data, ItemSpecificCellProperties iscp)
 {
     this.CurrentData = data;
     Rectangle drawbounds = this.CalculateBounds(xOffset, yOffset, this.Owner.CurrentItem, gridWidth, iscp);
     if (this.m_bVisible)
     {
         this.DrawBackground(gr, drawbounds);
         this.DrawContent(gr, drawbounds, data);
         this.DrawBorder(gr, drawbounds);
         if (this.Selectable)
         {
             Cell cell = (iscp != null) ? iscp.OriginalCell : this.Parent.SelectedCell;
             if ((cell == this) && ((this.Owner.CurrentItem == this.Parent.List.SelectedItem) || (this.Owner.CurrentItem == this.Parent.m_textBoxItem)))
             {
                 this.DrawSelection(gr, drawbounds);
             }
         }
     }
     this.CurrentData = null;
 }
Ejemplo n.º 13
0
 protected internal virtual Rectangle CalculateBounds(int xOffset, int yOffset, Resco.Controls.AdvancedComboBox.ListItem item, int gridWidth, ItemSpecificCellProperties preRscp)
 {
     Rectangle rectangle;
     ItemSpecificCellProperties itemSpecificProperties = preRscp;
     if (itemSpecificProperties == null)
     {
         itemSpecificProperties = this.GetItemSpecificProperties(item);
     }
     if ((itemSpecificProperties != null) && itemSpecificProperties.CachedBounds.HasValue)
     {
         rectangle = itemSpecificProperties.CachedBounds.Value;
     }
     else
     {
         int cachedAutoHeight = 0;
         if ((itemSpecificProperties != null) && (itemSpecificProperties.CachedAutoHeight >= 0))
         {
             cachedAutoHeight = itemSpecificProperties.CachedAutoHeight;
         }
         rectangle = this.CalculateCellWidth(gridWidth);
         if (this.AutoHeight && (cachedAutoHeight > this.m_Bounds.Height))
         {
             rectangle.Height = cachedAutoHeight;
         }
         if ((this.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom)
         {
             if ((this.Anchor & AnchorStyles.Top) == AnchorStyles.Top)
             {
                 rectangle.Height = item.ActualHeight - (this.m_anchorSizeTop + this.m_anchorSizeBottom);
                 if (rectangle.Height < 0)
                 {
                     rectangle.Height = 0;
                 }
             }
             else
             {
                 rectangle.Y = item.ActualHeight - (this.m_anchorSizeBottom + rectangle.Height);
                 if (rectangle.Y < 0)
                 {
                     rectangle.Y = 0;
                 }
             }
         }
         else if (rectangle.Bottom > item.ActualHeight)
         {
             rectangle.Height = item.ActualHeight - rectangle.Y;
         }
         if ((this.Parent != null) ? this.Parent.RightToLeft : false)
         {
             rectangle.X = this.Parent.Width - rectangle.Right;
             xOffset *= -1;
         }
         if (itemSpecificProperties != null)
         {
             itemSpecificProperties.CachedBounds = new Rectangle?(rectangle);
         }
     }
     rectangle.Offset(xOffset, yOffset);
     return rectangle;
 }
Ejemplo n.º 14
0
 public virtual int GetAutoHeight(Resco.Controls.AdvancedComboBox.ListItem li, int index, ItemSpecificCellProperties preRscp)
 {
     ItemSpecificCellProperties properties = (preRscp == null) ? this.GetItemSpecificProperties(li) : preRscp;
     properties.CachedAutoHeight = this.m_Bounds.Height;
     return properties.CachedAutoHeight;
 }
Ejemplo n.º 15
0
 public override int GetAutoHeight(Resco.Controls.AdvancedComboBox.ListItem item, int index, ItemSpecificCellProperties preRscp)
 {
     int num = 0;
     if (!base.AutoHeight)
     {
         return base.Bounds.Height;
     }
     ItemSpecificCellProperties properties = (preRscp == null) ? base.GetItemSpecificProperties(item) : preRscp;
     if (properties.CachedAutoHeight >= 0)
     {
         return properties.CachedAutoHeight;
     }
     string text = this.GetText(base[item, index]);
     if ((text == null) || (text.Length == 0))
     {
         return 0;
     }
     int gridWidth = 0;
     if (base.Parent != null)
     {
         gridWidth = base.Parent.List.Width - (base.Parent.List.ScrollbarVisible ? base.Parent.List.ClientScrollbarWidth : 0);
     }
     if (gridWidth != 0)
     {
         Rectangle rectangle = base.CalculateCellWidth(gridWidth);
         rectangle.Width -= 3;
         if (rectangle.Width > base.Parent.List.ClientScrollbarWidth)
         {
             WrapTextData data = Utility.WrapText(base.Graphics, text, this.m_Font, rectangle.Width);
             num = (data != null) ? (data.Height + 2) : 0;
         }
     }
     properties.CachedAutoHeight = num;
     return num;
 }