Esempio n. 1
0
    private static List <ICommand> HelpScreen(UmlWindow umlWindow)
    {
        var titled = new TitledWindow(umlWindow, "About...")
        {
            BackGround = ConsoleColor.DarkBlue,
            Foreground = ConsoleColor.White
        };
        var pop = new Popup(titled, @"
*  *  ****  *     ****    
*  *  *     *     *  *    
****  **    *     ****    
*  *  *     *     *       
*  *  ****  ****  *       
space ................ (un)select object at cursor or choose object
s .................... select an object
cursor keys........... move cursor or selected object
shift + cursor ....... move object under cursor
r .................... rotate selected object (only text label)
ctrl + cursor ........ move selected object (only box)
b .................... Create a Box
c .................... Create a connection line between boxes
d .................... Create a Database
t .................... Create a text label
l .................... Create a free-style line
x / Del............... Delete selected object
enter ................ Enter command mode
Esc .................. Abort input
ctrl+c ............... Exit program")
        {
            Foreground = titled.Foreground, BackGround = titled.BackGround
        };

        return(Noop);
    }
Esempio n. 2
0
        public ConnectForm(GuiComponent parent, Coord position, int[] legalInput)
        {
            this.legalInput = legalInput;
            titled          = new TitledWindow(parent, "Connect...")
            {
                Position = position
            };

            new TextLabel(titled, "From object:", new Coord(0, 0));
            from = new TextBox(titled, 5, new Coord(0, 1))
            {
                OnUserEscape = titled.RemoveMeAndChildren
            };
            new TextLabel(titled, "To object:", new Coord(0, 2));
            to = new TextBox(titled, 5, new Coord(0, 3))
            {
                OnUserEscape = titled.RemoveMeAndChildren, OnUserSubmit = Submit
            };

            from.OnUserSubmit = to.Focus;

            validationErrors = new TextLabel(titled, "", new Coord(0, 4))
            {
                BackGround = ConsoleColor.White,
                Foreground = ConsoleColor.Red
            };
        }
Esempio n. 3
0
        public Popup(GuiComponent parent, string message)
        {
            var titled = new TitledWindow(parent, "About...")
            {
                BackGround = ConsoleColor.DarkBlue,
                Foreground = ConsoleColor.White
            };

            var label = new TextLabel(titled, message, new Coord(4, 1));

            titled.Dimensions = label.GetSize();
            titled.Dimensions.Height.Pixels += 5;
            titled.Dimensions.Width.Pixels  += 6;
            titled.Position = new Coord((State.MaxX - titled.Dimensions.Width.Pixels) / 2,
                                        ((State.MaxY - titled.Dimensions.Height.Pixels) / 2) - 1);

            label.AdjustWhenParentsReposition();

            var screenCenter = new Coord(titled.Dimensions.Width.Pixels / 2, label.Height + 2);
            var ok           = new Button(titled, "OK", () => { titled.RemoveMeAndChildren(); }, screenCenter)
            {
                BackGround = ConsoleColor.DarkGray,
                Foreground = ConsoleColor.Green
            };

            ok.Focus();
        }
Esempio n. 4
0
    public Program()
    {
        Application  app = new Application();
        TitledWindow win = new TitledWindow("A nice Title!");

        _last_char   = (char)0;
        _is_key_down = false;
        win.PointerButtonPressActions += OnLeftClick;
        win.ExposeActions             += OnPaint;
        win.CharActions    += OnChar;
        win.KeyDownActions += OnKeyDown;
        win.KeyUpActions   += OnKeyUp;
        win.CloseActions   += OnClose;
        win.Show();
        win.SetWidth(200);
        win.SetHeight(200);
        app.Launch();
    }
Esempio n. 5
0
        public SelectObjectForm(GuiComponent parent, int[] legalInput, Coord position)
        {
            this.legalInput = legalInput;
            titled          = new TitledWindow(parent, "Select object")
            {
                Position = position
            };

            new TextLabel(titled, "Object:", new Coord(0, 0));
            selected = new TextBox(titled, 5, new Coord(0, 1))
            {
                OnUserEscape = titled.RemoveMeAndChildren, OnUserSubmit = Submit
            };

            validationErrors = new TextLabel(titled, "", new Coord(0, 2))
            {
                BackGround = ConsoleColor.White,
                Foreground = ConsoleColor.Red
            };
        }
Esempio n. 6
0
        public SinglelineInputForm(GuiComponent parent, string title, string explanation, string errorMessage, int width, Coord position)
        {
            this.errorMessage = errorMessage;
            titled            = new TitledWindow(parent, title)
            {
                Position = position
            };

            new TextLabel(titled, explanation, new Coord(0, 0));
            selected = new TextBox(titled, width, new Coord(0, 1))
            {
                OnUserEscape = titled.RemoveMeAndChildren, OnUserSubmit = Submit
            };

            validationErrors = new TextLabel(titled, "", new Coord(0, 2))
            {
                BackGround = ConsoleColor.White,
                Foreground = ConsoleColor.Red
            };
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            var state = new State
            {
                TheCurser = new Cursor(new Coord(10, 10))
            };

            var man       = new WindowManager("AsciiUML (c) Kasper B. Graversen 2016-");
            var topmenu   = new TopMenu(man, state);
            var umlWindow = new UmlWindow(topmenu, state);

            //var umlWindow = new UmlWindow(topmenu, TempModelForPlayingAround(state));
            umlWindow.Focus();
            //ShowLogo(umlWindow);

            var title = new TitledWindow(umlWindow, "Connect objects");
            var f     = new ConnectForm(title, new Coord(5, 5));

            f.Focus();
            man.Start();
        }
Esempio n. 8
0
        public MultilineInputForm(GuiComponent parent, string title, string explanation, string content, Coord position)
        {
            titled = new TitledWindow(parent, title)
            {
                Position = position
            };

            new TextLabel(titled, explanation, new Coord(0, 0));
            var textHeight = 10;

            textArea = new TextArea(titled, 12, textHeight, content, new Coord(0, 1))
            {
                OnUserEscape = titled.RemoveMeAndChildren
            };
            var ok = new Button(titled, "Ok", () => Submit(),
                                new Coord(2, textArea.RelativePositionToParent.Y + textArea.Dimensions.Height.Pixels + 1))
            {
                BackGround = ConsoleColor.DarkGray,
                Foreground = ConsoleColor.Green
            };
            var border = new TextLabel(titled, "", new Coord(0, ok.RelativePositionToParent.Y + 1));
        }