Ejemplo n.º 1
0
        /// <summary>
        ///   Changes in the columns, items or subitems
        /// </summary>
        /// <param name = "ctType"></param>
        /// <param name = "column"></param>
        /// <param name = "item"></param>
        /// <param name = "subItem"></param>
        public ChangedEventArgs(ChangedTypes ctType, CColumn column, CListItem item, CListSubItem subItem)
        {
            Column  = column;
            Item    = item;
            SubItem = subItem;

            m_ctType = ctType;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Get the column index that corresponds to the column name
        /// </summary>
        /// <param name = "strColumnName"></param>
        /// <returns></returns>
        public int GetColumnIndex(string strColumnName)
        {
            for (int index = 0; index < List.Count; index++)
            {
                CColumn column = (CColumn)List[index];
                if (column.Name == strColumnName)
                {
                    return(index);
                }
            }

            return(-1);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   Add Column to collection
        /// </summary>
        /// <param name = "strColumnName"></param>
        /// <param name = "nColumnWidth"></param>
        /// <param name = "align"></param>
        public CColumn Add(string strColumnName, int nColumnWidth, HorizontalAlignment align)
        {
            CColumn newColumn = new CColumn();

            newColumn.Text          = strColumnName;
            newColumn.Name          = strColumnName;
            newColumn.Width         = nColumnWidth;
            newColumn.State         = ColumnStates.csNone;
            newColumn.TextAlignment = ContentAlignment.MiddleLeft;

            Add(newColumn);

            return(newColumn);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///   Required for correct collection editor use
        /// </summary>
        /// <param name = "context"></param>
        /// <param name = "culture"></param>
        /// <param name = "value"></param>
        /// <param name = "destinationType"></param>
        /// <returns></returns>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value,
                                         Type destinationType)
        {
            if (destinationType == typeof(InstanceDescriptor) && value is CColumn)
            {
                CColumn column = (CColumn)value;

                ConstructorInfo ci = typeof(CColumn).GetConstructor(new Type[] { });
                if (ci != null)
                {
                    return(new InstanceDescriptor(ci, null, false));
                }
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Ejemplo n.º 5
0
        /// <summary>
        ///   Add a column to collection
        /// </summary>
        /// <param name = "newColumn"></param>
        public void Add(CColumn newColumn)
        {
            newColumn.Parent = Parent;

            //item.ChangedEvent += new BSLItem.ChangedEventHandler( BSLItem_Changed );				// listen to event changes inside the item
            newColumn.ChangedEvent += GLColumn_Changed;

            while (GetColumnIndex(newColumn.Name) != -1)
            {
                newColumn.Name += "x"; // change the name till it is not the same
            }
            int nIndex = List.Add(newColumn);

            if (ChangedEvent != null)
            {
                ChangedEvent(this, new ChangedEventArgs(ChangedTypes.ColumnCollectionChanged, newColumn, null, null));
            }
            // fire the column clicked event
        }
Ejemplo n.º 6
0
        /// <summary>
        ///   Changes in the columns, items or subitems
        /// </summary>
        /// <param name = "ctType"></param>
        /// <param name = "column"></param>
        /// <param name = "item"></param>
        /// <param name = "subItem"></param>
        public ChangedEventArgs(ChangedTypes ctType, CColumn column, CListItem item, CListSubItem subItem)
        {
            Column = column;
            Item = item;
            SubItem = subItem;

            m_ctType = ctType;
        }
Ejemplo n.º 7
0
 /// <summary>
 ///   Return index of column in collection
 /// </summary>
 /// <param name = "column"></param>
 /// <returns></returns>
 public int IndexOf(CColumn column)
 {
     return(List.IndexOf(column));
 }
Ejemplo n.º 8
0
 /// <summary>
 ///   Return index of column in collection
 /// </summary>
 /// <param name = "column"></param>
 /// <returns></returns>
 public int IndexOf(CColumn column)
 {
     return List.IndexOf(column);
 }
Ejemplo n.º 9
0
 /// <summary>
 ///   Add Range of columns to collection
 /// </summary>
 /// <param name = "columns"></param>
 public void AddRange(CColumn[] columns)
 {
     lock (List.SyncRoot)
     {
         for (int i = 0; i < columns.Length; i++)
             Add(columns[i]);
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        ///   Add Column to collection
        /// </summary>
        /// <param name = "strColumnName"></param>
        /// <param name = "nColumnWidth"></param>
        /// <param name = "align"></param>
        public CColumn Add(string strColumnName, int nColumnWidth, HorizontalAlignment align)
        {
            CColumn newColumn = new CColumn();
            newColumn.Text = strColumnName;
            newColumn.Name = strColumnName;
            newColumn.Width = nColumnWidth;
            newColumn.State = ColumnStates.csNone;
            newColumn.TextAlignment = ContentAlignment.MiddleLeft;

            Add(newColumn);

            return newColumn;
        }
Ejemplo n.º 11
0
        /// <summary>
        ///   Add a column to collection
        /// </summary>
        /// <param name = "newColumn"></param>
        public void Add(CColumn newColumn)
        {
            newColumn.Parent = Parent;

            //item.ChangedEvent += new BSLItem.ChangedEventHandler( BSLItem_Changed );				// listen to event changes inside the item
            newColumn.ChangedEvent += GLColumn_Changed;

            while (GetColumnIndex(newColumn.Name) != -1)
                newColumn.Name += "x"; // change the name till it is not the same

            int nIndex = List.Add(newColumn);

            if (ChangedEvent != null)
                ChangedEvent(this, new ChangedEventArgs(ChangedTypes.ColumnCollectionChanged, newColumn, null, null));
            // fire the column clicked event
        }
Ejemplo n.º 12
0
        /// <summary>
        ///   Draw column in header control
        /// </summary>
        /// <param name = "graphicsColumn"></param>
        /// <param name = "rectColumn"></param>
        /// <param name = "column"></param>
        public virtual void DrawColumnHeader(Graphics graphicsColumn, Rectangle rectColumn, CColumn column)
        {
            if (ControlStyle == GLControlStyles.SuperFlat)
            {
                SolidBrush brush = new SolidBrush(SuperFlatHeaderColor);
                graphicsColumn.FillRectangle(brush, rectColumn);
                brush.Dispose();
            }
            else if ((ControlStyle == GLControlStyles.XP) && ThemesAvailable)
            {
                // this is really the only thing we care about for themeing right now inside the control
                IntPtr hDC = graphicsColumn.GetHdc();
                ;

                RECT colrect = new RECT(rectColumn.X, rectColumn.Y, rectColumn.Right, rectColumn.Bottom);
                RECT cliprect = new RECT(rectColumn.X, rectColumn.Y, rectColumn.Right, rectColumn.Bottom);

                if (column.State == ColumnStates.csNone)
                {
                    //Debug.WriteLine( "Normal" );
                    ThemeRoutines.DrawThemeBackground(m_hTheme, hDC, 1, 1, ref colrect, ref cliprect);
                }
                else if (column.State == ColumnStates.csPressed)
                {
                    //Debug.WriteLine( "Pressed" );
                    ThemeRoutines.DrawThemeBackground(m_hTheme, hDC, 1, 3, ref colrect, ref cliprect);
                }
                else if (column.State == ColumnStates.csHot)
                {
                    //Debug.WriteLine( "Hot" );
                    ThemeRoutines.DrawThemeBackground(m_hTheme, hDC, 1, 2, ref colrect, ref cliprect);
                }

                graphicsColumn.ReleaseHdc(hDC);
            }
            else // normal state
            {
                if (column.State != ColumnStates.csPressed)
                    ControlPaint.DrawButton(graphicsColumn, rectColumn, ButtonState.Normal);
                else
                    ControlPaint.DrawButton(graphicsColumn, rectColumn, ButtonState.Pushed);
            }


            // if there is an image, this routine will RETURN with exactly the space left for everything else after the image is drawn (or not drawn due to lack of space)
            if ((column.ImageIndex > -1) && (ImageList != null) && (column.ImageIndex < ImageList.Images.Count))
                rectColumn = DrawCellGraphic(graphicsColumn, rectColumn, ImageList.Images[column.ImageIndex],
                                             HorizontalAlignment.Left);

            DrawCellText(graphicsColumn, rectColumn, column.Text, column.TextAlignment, ForeColor, false, HeaderWordWrap);
        }