1
0
mirror of synced 2024-12-05 04:17:59 +01:00
Switch-Toolbox/File_Format_Library/GUI/BFLYT/LayoutProperties.cs

82 lines
2.3 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library.Forms;
namespace LayoutBXLYT
{
2019-08-30 01:01:47 +02:00
public partial class LayoutProperties : LayoutDocked
{
private UserDataEditor userDataEditor;
public LayoutProperties()
{
InitializeComponent();
stTabControl1.myBackColor = FormThemes.BaseTheme.FormBackColor;
userDataEditor = new UserDataEditor();
userDataEditor.Dock = DockStyle.Fill;
tabPage2.Controls.Add(userDataEditor);
2019-09-05 22:24:03 +02:00
BackColor = FormThemes.BaseTheme.FormBackColor;
ForeColor = FormThemes.BaseTheme.FormForeColor;
}
2019-08-30 01:01:47 +02:00
public void Reset()
{
stPropertyGrid1.LoadProperty(null);
2019-08-30 01:01:47 +02:00
}
public void UpdateProperties()
{
stPropertyGrid1.UpdateProperties();
}
public void LoadProperties(object prop, Action propChanged)
{
LoadPropertyTab("Properties", prop, propChanged);
}
public void LoadProperties(BasePane prop, Action propChanged)
{
LoadPropertyTab("Pane", prop, propChanged);
}
private void LoadPropertyTab(string text, object prop, Action propChanged)
{
userDataEditor.Reset();
if (prop is IUserDataContainer)
LoadUserData((IUserDataContainer)prop);
DoubleBufferedTabPage page = new DoubleBufferedTabPage();
page.Enabled = false;
page.Text = text;
stPropertyGrid1.LoadProperty(prop, propChanged);
}
private void LoadUserData(IUserDataContainer container)
{
if (container.UserData != null && container.UserData.Entries != null)
userDataEditor.LoadUserData(container.UserData.Entries);
}
class DoubleBufferedTabPage : System.Windows.Forms.TabPage
{
public DoubleBufferedTabPage()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
}
}
private void stTabControl1_TabIndexChanged(object sender, EventArgs e)
{
}
}
}