Esempio n. 1
0
        /// <summary>
        /// Creates a column with the given header and list box.
        /// </summary>
        /// <param name="header">The header panel.</param>
        /// <param name="listBox">The list box.</param>
        public void AddColumn(XNAPanel header, XNAListBox listBox)
        {
            AdjustExistingListBoxes();

            int width = GetExistingWidth();

            header.ClientRectangle = new Rectangle(width, 0, header.Width, header.Height);

            headers.Add(header);

            listBox.Name            = Name + "_lb" + listBoxes.Count;
            listBox.ClientRectangle = new Rectangle(width, header.Bottom - 1,
                                                    header.Width, Height - header.Bottom + 1);
            listBox.DrawBorders             = DrawListBoxBorders;
            listBox.LineHeight              = LineHeight;
            listBox.TopIndexChanged        += ListBox_TopIndexChanged;
            listBox.SelectedIndexChanged   += ListBox_SelectedIndexChanged;
            listBox.AllowMultiLineItems     = false;
            listBox.AllowKeyboardInput      = this.AllowKeyboardInput;
            listBox.AllowRightClickUnselect = AllowRightClickUnselect;
            listBox.RightClick             += ListBox_RightClick;

            listBoxes.Add(listBox);
            AddChild(listBox);
            AddChild(header);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a column with the given header and an automatically generated list box.
        /// The width of the header defines the width of the list box.
        /// </summary>
        /// <param name="header">The header panel.</param>
        public void AddColumn(XNAPanel header)
        {
            XNAListBox listBox = new XNAListBox(WindowManager);

            listBox.FontIndex          = FontIndex;
            listBox.TextBorderDistance = 5;

            AddColumn(header, listBox);
        }
Esempio n. 3
0
        /// <summary>
        /// Adjusts the positions and sizes of the columns
        /// when the size of the list box is changed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void XNAMultiColumnListBox_ClientRectangleUpdated(object sender, EventArgs e)
        {
            if (listBoxes.Count == 0)
            {
                return;
            }

            // Adjust size of columns

            foreach (XNAListBox lb in listBoxes)
            {
                lb.Height = Height - lb.Y;
            }

            XNAListBox lastListBox = listBoxes[listBoxes.Count - 1];
            XNAPanel   lastHeader  = headers[headers.Count - 1];

            int lastColumnWidth = Width -
                                  listBoxes[listBoxes.Count - 1].X;

            lastListBox.Width = lastColumnWidth;
            lastHeader.Width  = lastColumnWidth;
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a column with the given header text and width.
        /// </summary>
        /// <param name="headerText"></param>
        /// <param name="width"></param>
        public void AddColumn(string headerText, int width)
        {
            XNALabel headerLabel = new XNALabel(WindowManager);

            headerLabel.FontIndex = HeaderFontIndex;
            headerLabel.X         = 3;
            headerLabel.Y         = 2;
            headerLabel.Text      = headerText;

            XNAPanel headerPanel = new XNAPanel(WindowManager);

            headerPanel.Height = headerLabel.Height + 3;
            if (DrawListBoxBorders)
            {
                headerPanel.Width = width + 1;
            }
            else
            {
                headerPanel.Width = width;
            }
            headerPanel.AddChild(headerLabel);

            AddColumn(headerPanel);
        }