Beispiel #1
0
 public BasicNode(BasicNodeStructure structure, RectangleRenderElementStyle border_style)
 {
     Structure     = structure;
     BorderStyle   = border_style;
     BorderElement = new RectangleRenderElement(Position, Width, Height, border_style.FillColor, border_style.BorderColor, border_style.BorderWidth);
     TriggerAreas.Add(new RectangleHitbox(Position, Width, Height));
 }
Beispiel #2
0
 public LabelNode(BasicTextNodeStructure structure, TextRenderElementStyle text_style,
                  RectangleRenderElementStyle border_style) : base(structure, border_style)
 {
     Structure   = structure;
     TextStyle   = text_style;
     TextElement = new TextRenderElement(Position, Text, text_style.Color, text_style.FontSize, text_style.FontStyle);
 }
Beispiel #3
0
 public TextBoxNode(BasicTextNodeStructure structure, TextRenderElementStyle text_style,
                    RectangleRenderElementStyle border_style) : base(structure, text_style, border_style)
 {
     TriggerAreas.Add(new RectangleHitbox(Position, Width, Height));
     OnKeyPress  += HandleKey;
     OnFocused   += (sender, args) => FillColor = Color.CadetBlue;
     OnUnfocused += (sender, args) => FillColor = Color.White;
 }
Beispiel #4
0
 public ButtonNode(ButtonStructure structure, RectangleRenderElementStyle style, TextRenderElementStyle text_style)
 {
     Structure     = structure;
     BorderStyle   = style;
     TextStyle     = text_style;
     BorderElement = new RectangleRenderElement(Position, Width, Height, style.FillColor, style.BorderColor, style.BorderWidth);
     TextElement   = new TextRenderElement(Position, Text, TextColor, TextStyle.FontSize, TextStyle.FontStyle);
     TriggerAreas.Add(new RectangleHitbox(Position, Width, Height));
     ButtonAction  = Structure.ButtonAction;
     OnMouseClick += (object sender, EventArgs e) =>
     {
         ButtonAction.Invoke();
         OnUnfocused?.Invoke(this, new NodeEventArgs(this));
     };
 }
Beispiel #5
0
        public MethodNode(MethodStructure codeStructure, BasicNodeStructure structure, RectangleRenderElementStyle border_style)
            : base(new PropertyStructure(codeStructure.Position, codeStructure.Name, codeStructure.Type, codeStructure.AccessModifier, codeStructure.Modifier), structure, border_style)
        {
            CodeStructure = codeStructure;
            LeftBracket   = new LabelNode(new BasicTextNodeStructure(Position + new Vector(AccessModifierButton.Width + NameTextBox.Width, 0),
                                                                     Renderer.SingleTextWidth, Height, "("),
                                          TextRenderElementStyle.Default, RectangleRenderElementStyle.Textbox);
            string argum = codeStructure.Arguments;

            ArgumentsTextBox = new TextBoxNode(new BasicTextNodeStructure(Position + new Vector(AccessModifierButton.Width + NameTextBox.Width + LeftBracket.Width, 0),
                                                                          Renderer.GetTextWidth(argum.Length), Height, argum),
                                               TextRenderElementStyle.Default, RectangleRenderElementStyle.Textbox);
            RightBracket = new LabelNode(new BasicTextNodeStructure(Position + new Vector(NameTextBox.Width + AccessModifierButton.Width + ArgumentsTextBox.Width + LeftBracket.Width, 0),
                                                                    Renderer.SingleTextWidth, Height, ")"),
                                         TextRenderElementStyle.Default, RectangleRenderElementStyle.Textbox);
            Children.Add(LeftBracket);
            Children.Add(RightBracket);
            Children.Add(ArgumentsTextBox);
            GenerateMenu();
            GenerateOptions();
        }
 public ClassDiagramNode(ClassStructure codestructure, BasicNodeStructure structure, RectangleRenderElementStyle border_style) : base(structure, border_style)
 {
     CodeStructure = codestructure;
     NameTextBox   = new TextBoxNode(new BasicTextNodeStructure(Position, Renderer.GetTextWidth(Name.Length), Renderer.SingleTextHeight, Name), TextRenderElementStyle.Default, RectangleRenderElementStyle.Textbox);
     NameLine      = new LineRenderElement(new Vector(Position.X, Position.Y + Renderer.SingleTextHeight), new Vector(Position.X + Width, Position.Y + Renderer.SingleTextHeight), 1, Color.Black);
     SeparatorLine = new LineRenderElement(new Vector(Position.X, Position.Y + Renderer.SingleTextHeight), new Vector(Position.X + Width, Position.Y + Renderer.SingleTextHeight), 1, Color.Black);
     Children.Add(NameTextBox);
     GeneratePrefab();
     RepositionChildren();
     SetEvents();
 }
Beispiel #7
0
 public PropertyNode(PropertyStructure codeStructure, BasicNodeStructure structure, RectangleRenderElementStyle border_style) : base(structure, border_style)
 {
     CodeStructure        = codeStructure;
     AccessModifierButton = new ButtonNode(new ButtonStructure(Position, "+", Renderer.SingleTextWidth, Height, () => OnMenuShow?.Invoke(this, EventArgs.Empty)), RectangleRenderElementStyle.Textbox, TextRenderElementStyle.Default);
     NameTextBox          = new TextBoxNode(new BasicTextNodeStructure(Position, Renderer.GetTextWidth(Name.Length), Height, Name), TextRenderElementStyle.Default, RectangleRenderElementStyle.Textbox);
     Separator            = new LabelNode(new BasicTextNodeStructure(Position, Renderer.SingleTextWidth, Height, ":"), TextRenderElementStyle.Default, RectangleRenderElementStyle.Textbox);
     TypeTextBox          = new TextBoxNode(new BasicTextNodeStructure(Position, Renderer.GetTextWidth(Type.Length), Height, Type), TextRenderElementStyle.Default, RectangleRenderElementStyle.Textbox);
     Children.Add(AccessModifierButton);
     Children.Add(NameTextBox);
     Children.Add(Separator);
     Children.Add(TypeTextBox);
     OnUnfocused += OnUnFocus;
     GenerateMenu();
     GenerateOptions();
 }