add TextBox implementation to New World Computing window layout definition file
This commit is contained in:
parent
5d80b16e37
commit
7ba01e91a9
@ -57,6 +57,12 @@ namespace UniversalEditor.DataFormats.NWCSceneLayout.NewWorldComputing.BIN
|
||||
new Property(ScenePropertyGuids.Button.BackgroundImageFileName, "Background image file name"),
|
||||
new Property(ScenePropertyGuids.Button.BackgroundImageIndex, "Background image index")
|
||||
}, Button_Render));
|
||||
NWCSceneLayoutLibrary.Components.Add(new Component(SceneObjectGuids.TextBox, "Text box", new Property[]
|
||||
{
|
||||
new Property(ScenePropertyGuids.TextBox.BackgroundImageFileName, "Background image file name"),
|
||||
new Property(ScenePropertyGuids.TextBox.BackgroundImageIndex, "Background image index"),
|
||||
new Property(ScenePropertyGuids.TextBox.Text, "Text")
|
||||
}, TextBox_Render));
|
||||
NWCSceneLayoutLibrary.Components.Add(new Component(SceneObjectGuids.Image, "Image", new Property[]
|
||||
{
|
||||
new Property(ScenePropertyGuids.Image.BackgroundImageFileName, "Background image file name"),
|
||||
@ -96,6 +102,25 @@ namespace UniversalEditor.DataFormats.NWCSceneLayout.NewWorldComputing.BIN
|
||||
}
|
||||
|
||||
}
|
||||
static void TextBox_Render(ComponentInstance instance, PaintEventArgs e, Rectangle bounds)
|
||||
{
|
||||
Property propBackgroundImage = NWCSceneLayoutLibrary.Components[DesignerObjectGuids.Common].Properties[DesignerPropertyGuids.Common.BackgroundImage];
|
||||
if (propBackgroundImage != null)
|
||||
{
|
||||
PropertyValue propVal = instance.PropertyValues[propBackgroundImage];
|
||||
if (propVal != null)
|
||||
{
|
||||
PictureObjectModel pic = propVal.Value as PictureObjectModel;
|
||||
if (pic != null)
|
||||
{
|
||||
e.Graphics.DrawImage(pic.ToImage(), bounds.X, bounds.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PropertyValue pv = instance.PropertyValues[NWCSceneLayoutLibrary.Components[SceneObjectGuids.TextBox].Properties[ScenePropertyGuids.TextBox.Text]];
|
||||
e.Graphics.DrawText(pv?.Value?.ToString(), null, bounds.Location, new MBS.Framework.UserInterface.Drawing.SolidBrush(MBS.Framework.UserInterface.SystemColors.WindowForeground));
|
||||
}
|
||||
static void ListBox_Render(ComponentInstance instance, PaintEventArgs e, Rectangle bounds)
|
||||
{
|
||||
Property propBackgroundImage = NWCSceneLayoutLibrary.Components[DesignerObjectGuids.Common].Properties[DesignerPropertyGuids.Common.BackgroundImage];
|
||||
@ -237,6 +262,14 @@ namespace UniversalEditor.DataFormats.NWCSceneLayout.NewWorldComputing.BIN
|
||||
ushort u3a = reader.ReadUInt16();
|
||||
ushort u4a = reader.ReadUInt16();
|
||||
}
|
||||
PictureObjectModel pic = LoadICN(icnFileName, 0);
|
||||
|
||||
designer.Designs[0].ComponentInstances.Add(new ComponentInstance(NWCSceneLayoutLibrary.Components[SceneObjectGuids.TextBox], new Rectangle(x, y, width, height), new PropertyValue[]
|
||||
{
|
||||
new PropertyValue(NWCSceneLayoutLibrary.Components[SceneObjectGuids.TextBox].Properties[ScenePropertyGuids.TextBox.Text], text),
|
||||
new PropertyValue(NWCSceneLayoutLibrary.Components[SceneObjectGuids.TextBox].Properties[ScenePropertyGuids.TextBox.BackgroundImageFileName], icnFileName),
|
||||
new PropertyValue(NWCSceneLayoutLibrary.Components[DesignerObjectGuids.Common].Properties[DesignerPropertyGuids.Common.BackgroundImage], pic)
|
||||
}));
|
||||
break;
|
||||
}
|
||||
case BINComponentType.ListBox:
|
||||
|
||||
@ -28,5 +28,6 @@ namespace UniversalEditor.ObjectModels.NWCSceneLayout
|
||||
public static Guid Label { get; } = new Guid("{061ded85-99fd-43b0-b23d-e31c904ba397}");
|
||||
public static Guid DropDownList { get; } = new Guid("{0fef5a86-c4e9-47b7-9d19-3e6d4e5b8d63}");
|
||||
public static Guid ListBox { get; } = new Guid("{b9eb1120-5326-46b3-81a7-741f9b19d74f}");
|
||||
public static Guid TextBox { get; } = new Guid("{b3e34d63-9be9-4477-83d2-ed0c31d7e769}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,5 +43,11 @@ namespace UniversalEditor.ObjectModels.NWCSceneLayout
|
||||
public static Guid BackgroundImageFileName { get; } = new Guid("{df3a8c45-a6bf-44d3-bf46-d8569e78bc71}");
|
||||
public static Guid BackgroundImageIndex { get; } = new Guid("{e4226ed5-0ffa-468a-972f-146c934b0aa2}");
|
||||
}
|
||||
public static class TextBox
|
||||
{
|
||||
public static Guid BackgroundImageFileName { get; } = new Guid("{df3a8c45-a6bf-44d3-bf46-d8569e78bc71}");
|
||||
public static Guid BackgroundImageIndex { get; } = new Guid("{e4226ed5-0ffa-468a-972f-146c934b0aa2}");
|
||||
public static Guid Text { get; } = new Guid("{e8aeb0d6-a0fd-4f96-93b4-4a955953ce03}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user