public int Add(string text, int width)
        {
            LBColumnTitle ct = new LBColumnTitle();

            ct.Text  = text;
            ct.Width = width;
            return(fList.Add(ct));
        }
        public void Delete(int index)
        {
            LBColumnTitle ct = GetItem(index);

            if (ct != null)
            {
                fList.Delete(index);
            }
        }
        public LBColumnTitle GetItem(int index)
        {
            LBColumnTitle result = null;

            if (index >= 0 && index < fList.Count)
            {
                result = fList[index];
            }
            return(result);
        }
Example #4
0
        protected ExtRect GetItemRect(int itemIndex, int subIndex)
        {
            ExtRect r   = base.IntRect;
            int     idx = itemIndex - fTopIndex;
            int     row = idx % fColumnSize;
            int     ax  = r.Left;
            int     ay  = r.Top;

            ExtRect result = ExtRect.Empty;

            if (fMode != MODE_LIST)
            {
                if (fMode == MODE_REPORT)
                {
                    if (subIndex < 0)
                    {
                        LBColumnTitle title = fColumnTitles.GetItem(0);
                        if (title == null)
                        {
                            result = ExtRect.Create(ax, ay + row * ItemHeight, ax + (r.Right - r.Left + 1), ay + (row + 1) * ItemHeight);
                        }
                        else
                        {
                            result = ExtRect.Create(ax, ay + row * ItemHeight, ax + title.Width, ay + (row + 1) * ItemHeight);
                        }
                    }
                    else
                    {
                        int offset = 0;
                        int i      = 0;
                        if (subIndex >= i)
                        {
                            int num = subIndex + 1;
                            do
                            {
                                LBColumnTitle title = fColumnTitles.GetItem(i);
                                offset += title.Width;
                                i++;
                            } while (i != num);
                        }
                        int w;
                        if (subIndex == fItems.GetItem(itemIndex).SubItems.Count - 1)
                        {
                            w = r.Right - r.Left + 1 - offset;
                        }
                        else
                        {
                            LBColumnTitle title = fColumnTitles.GetItem(subIndex + 1);
                            if (title == null)
                            {
                                w = 0;
                            }
                            else
                            {
                                w = title.Width;
                            }
                        }
                        result = ExtRect.Create(ax + offset, ay + row * ItemHeight, ax + offset + w, ay + (row + 1) * ItemHeight);
                    }
                    return(result);
                }

                if (fMode != MODE_ICONS)
                {
                    return(result);
                }
            }
            int col = idx / fColumnSize;

            result = ExtRect.Create(ax + col * fColumnWidth, ay + row * ItemHeight, ax + (col + 1) * fColumnWidth, ay + (row + 1) * ItemHeight);
            return(result);
        }