internal void CalculateGroupGrid(Rect drawRect)
        {
            if (_columns < 1)
            {
                throw new ArgumentException("The number of columns must not be less than one!");
            }

            if (_group.groupType != GUI_Group_type.Scroll && _groupLabel != string.Empty)
            {
                _groupLabelRect = new Rect(drawRect.x + 2, drawRect.y, drawRect.width - 4, _itemHeight);

                drawRect.y = drawRect.y + (_itemHeight - (_verticalSpace / 2));
            }

            List <List <GUI_content> > rowContents = _group.GetContentMatrix();

            rects.Clear();

            float yPos = _verticalSpace;

            for (int i = 0; i < rowContents.Count; i++)
            {
                List <GUI_content> item = rowContents[i];

                float totalFixedWidth      = GetRowFixedWiths(item, out int contentsWithFixedWiths);
                float nonFixedContentWidth = (drawRect.width - (totalFixedWidth + (item.Count + 1) * _horizontalSpace)) / (item.Count - contentsWithFixedWiths);

                float maxFixedHeight = GetRowMaxFixedHeight(item);
                float newHeight      = maxFixedHeight != 0 ? maxFixedHeight : _itemHeight;

                float xPos = _horizontalSpace;

                for (int j = 0; j < item.Count; j++)
                {
                    GUI_content content = item[j];

                    float newWidth = content.FixedWidth != 0 ? content.FixedWidth : nonFixedContentWidth;

                    rects.Add(new Rect(drawRect.x + xPos, drawRect.y + yPos, newWidth, newHeight));

                    xPos += newWidth + _horizontalSpace;
                }

                yPos += newHeight + _verticalSpace;
            }

            if (_group.groupType != GUI_Group_type.Scroll)
            {
                float nextYpos = rects.GetLast().y + _itemHeight + _verticalSpace;
                _guiWindow.RemainDrawableArea = new Rect(drawRect.x, nextYpos, drawRect.width, _guiWindow.WindowRect.height - nextYpos);
            }
        }
 public GUI_item(int id, bool enabled, Rect rect, GUI_content itemContent)
 {
     ID          = id;
     Enabled     = enabled;
     DrawingRect = rect;
     ContentType = itemContent.ContentType;
     State       = itemContent.InitialState;
     TextColor   = itemContent.TextColor;
     Content     = new GUIContent(itemContent.Text, itemContent.ToolTip ?? string.Empty);
     FontStyle   = itemContent.FontStyle;
     Align       = itemContent.TextAlign;
     WordWrap    = false;
     Clipping    = TextClipping.Overflow;
 }