public static HeightContainer GetHeightContainer(double baseHeight)
        {
            // Find the best unit for this height


            var heightContainer = new HeightContainer(baseHeight, HeightUnit.Feet);

            return(heightContainer);
        }
Example #2
0
        public override void DoWindowContents(Rect inRect)
        {
            doCloseX           = true;
            doCloseButton      = false;
            doWindowBackground = true;

            // Create a flex container to hold our settings
            VerticalFlexContainer flexContainer = new VerticalFlexContainer(DEFAULT_SPACING);

            // Server details (address and [dis]connect button) container
            if (Client.Instance.Connected)
            {
                flexContainer.Add(GenerateConnectedServerDetails());
            }
            else
            {
                flexContainer.Add(GenerateDisconnectedServerDetails());
            }

            // Display name and preview
            if (Client.Instance.Online)
            {
                flexContainer.Add(GenerateEditableDisplayName());
                flexContainer.Add(GenerateNamePreview());
            }
            ;

            // Calculate height and constrain the container so we have even row heights with fluid contents
            float contentHeight = 0f;

            foreach (Displayable item in flexContainer.Contents)
            {
                contentHeight += item.IsFluidHeight ? ROW_HEIGHT : item.CalcHeight(inRect.width);
            }
            contentHeight += (flexContainer.Contents.Count - 1) * DEFAULT_SPACING;
            HeightContainer heightContainer = new HeightContainer(flexContainer, contentHeight);

            // Draw the container with 5f padding at the top to avoid clipping with the close button
            // flexContainer.Draw(inRect.BottomPartPixels(inRect.height - 5f));
            heightContainer.Draw(inRect.BottomPartPixels(inRect.height - 5f));
        }
Example #3
0
        public override void DoWindowContents(Rect inRect)
        {
            if (needsUpdate)
            {
                // Update contents and reset the flag
                contents.Update();
                needsUpdate = false;
            }

            // Calculate height and constrain the container so we have even row heights with fluid contents
            float contentHeight = 0f;

            foreach (Displayable item in contents.Contents)
            {
                contentHeight += item.IsFluidHeight ? ROW_HEIGHT : item.CalcHeight(inRect.width);
            }
            contentHeight += (contents.Contents.Count - 1) * DEFAULT_SPACING;
            HeightContainer heightContainer = new HeightContainer(contents, contentHeight);

            // Draw the container with 5f padding at the top to avoid clipping with the close button
            heightContainer.Draw(inRect.BottomPartPixels(inRect.height - 5f));
        }