Пример #1
0
        private void InitTextWindow()
        {
            UIScrollWindow textWindow = new UIScrollWindow();

            textWindow.Location = new Vector2(300, 300);
            textWindow.ScrollPanel.Restriction = ScrollRestriction.Vertical;
            textWindow.Size = new Vector2(180);
            textWindow.AddConstraint(Edge.Horizontal | Edge.Bottom, null, Edge.Horizontal | Edge.Bottom, 5, ConstraintCategory.Initialization);

            string str = "A multiline UILabel in a UIScrollPanel. ";

            for (int i = 0; i < 6; i++)
            {
                str += str;
            }

            UILabel label = new UILabel(str, true);

            label.AddConstraint(Edge.TopLeft, textWindow.ScrollPanel, Edge.TopLeft, ConstraintCategory.Initialization);
            label.AddConstraint(Edge.Right, textWindow.ScrollPanel, Edge.Right, ConstraintCategory.Initialization);

            textWindow.AddChild(label);

            uiManager.Add(textWindow);
        }
Пример #2
0
        private void InitScrollWindow()
        {
            UIScrollWindow sw = new UIScrollWindow();

            sw.Location = new Vector2(100, 200);
            sw.Size     = new Vector2(100);

            UIImage img = new UIImage("graphics/arrow_down");

            img.AddConstraint(Edge.CenterXY, sw, Edge.TopLeft, ConstraintCategory.Initialization);
            sw.AddChild(img);

            uiManager.Add(sw);
        }
Пример #3
0
        private void InitTextWindow()
        {
            UIScrollWindow textWindow = new UIScrollWindow();

            textWindow.Position = new Vector2(300, 300);
            textWindow.ScrollPanel.Restriction = ScrollRestriction.Vertical;
            textWindow.Size = new Vector2(0, 180);
            textWindow.AddConstraint(Edge.Bottom, null, Edge.Bottom, 5);
            textWindow.AddConstraint(Edge.Horizontal, null, Edge.Horizontal, 5);

            string  text  = NativeFile.ReadAllText(Path.Combine(Environment.CurrentDirectory, "Lorem Ipsum.txt"));
            UILabel label = new UILabel(text, true);

            label.AddConstraint(Edge.TopLeft, textWindow.ScrollPanel, Edge.TopLeft, ConstraintCategory.Initialization);
            label.AddConstraint(Edge.Right, textWindow.ScrollPanel, Edge.Right, ConstraintCategory.Initialization);
            textWindow.AddChild(label);

            uiManager.Add(textWindow);
        }
Пример #4
0
        private void InitWindow()
        {
            var window = new UIWindow();

            window.AddConstraint(Edge.CenterY, null, Edge.CenterY, 0f, ConstraintCategory.Initialization);
            window.AddConstraint(Edge.Right, null, Edge.Right, 50f, ConstraintCategory.Initialization);

            var contentPanel = new UIScrollWindow(UIScrollWindow.ScrollBarMode.Both);

            contentPanel.AddConstraint(Edge.Dock, window.BodyPanel, Edge.Dock);

            var img = new UIImage("graphics/map");

            img.Tag = "Map";
            img.AddConstraint(Edge.TopLeft, contentPanel.ScrollPanel, Edge.TopLeft, ConstraintCategory.Initialization);
            contentPanel.AddChild(img);

            window.BodyPanel.AddChild(contentPanel);
            uiManager.Add(window);
        }