Exemplo n.º 1
0
        private void DisplayWindow(int width, int height, Drawing.Theme theme)
        {
            WPFFormattedTextViewer viewer =
                new WPFFormattedTextViewer(width, height, 8, 17, 14.5, theme);

            Window window = new Window();

            window.Content       = viewer;
            window.Background    = new SolidColorBrush(theme.Palette[MooTUI.Drawing.Color.Base03]);
            window.SizeToContent = SizeToContent.WidthAndHeight;

            new MooInterface(viewer, Widget);
            Widget.ClaimFocus();
            Widget.Render();

            //System.Console.WriteLine("Showing window");
            Widget.Render();
            window.ShowDialog();
            //System.Console.WriteLine("Window closed");
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            Widget.Style       = MooTUI.Drawing.Style.Light.Value;
            BoxDrawing.Default = BoxDrawing.Square;

            TabBox tabs = new TabBox(
                new LayoutRect(
                    new FlexSize(80),
                    new FlexSize(40)));

            WPFMooViewer viewer = new WPFFormattedTextViewer(tabs.Width, tabs.Height, 8, 17, 14.725,
                                                             Theme.Basic.Value);

            Content    = viewer;
            Background = new SolidColorBrush(Theme.Basic.Value.Palette[MooTUI.Drawing.Color.Base03]);

            new MooInterface(viewer, tabs);

            Container = new LayoutContainer(
                new LayoutRect(
                    new FlexSize(70),
                    new FlexSize(35)),
                Orientation.Vertical,
                crossJustification: LayoutContainer.CrossAxisJustification.STRETCH);

            ScrollBox scroll = new ScrollBox(
                new LayoutRect(75, 30),
                Container);

            tabs.AddTab(scroll, TextSpan.Parse("{base03/altyellow}Tab 01"));

            Button bigboi = new Button(new LayoutRect(new FlexSize(30), new FlexSize(10)),
                                       new TextSpan("This is a beeg boi"));

            tabs.AddTab(bigboi, TextSpan.Parse("This tab has a button"));

            ListBox list = new ListBox(
                new LayoutRect(
                    new FlexSize(20),
                    new Size(10)),
                new TextSpan("List!"),
                true);

            Container.AddChild(list);

            Button addToList = new Button(
                new LayoutRect(
                    new FlexSize(35),
                    new Size(1)),
                TextSpan.Parse("{green/}add an item to the list!"));

            addToList.Click += (s, e) =>
            {
                list.Add("This is a {yellow/}listitem!");
            };
            Button removeList = new Button(
                new LayoutRect(
                    new FlexSize(35),
                    new Size(1)),
                TextSpan.Parse("{red/}remove selected listitem!"));

            removeList.Click += (s, e) =>
            {
                list.RemoveElementUnderCursor();
            };

            Container.AddChild(addToList);
            Container.AddChild(removeList);

            SimpleTextInput t = new SimpleTextInput(
                new FlexSize(10),
                10,
                false,
                "Prompt!!!");

            ScrollBox b = new ScrollBox(
                new LayoutRect(
                    new FlexSize(35),
                    new Size(3)),
                t,
                vScrollbarVisibility: ScrollBox.ScrollBarVisibility.DISABLED);

            Button setText = new Button(
                new LayoutRect(
                    new FlexSize(35),
                    new Size(1)),
                new TextSpan("set the text of the textInput"));

            setText.Click += (s, e) => t.SetText("TEXT :)");

            Container.AddChild(b);
            Container.AddChild(setText);

            Container.AddChild(new Toggle(TextSpan.Parse("Check?")));
        }