removed StackSidebar and replaced with TabContainer with TabStyle = Sidebar

This commit is contained in:
Michael Becker 2021-08-11 15:22:54 -04:00
parent bcbe308e34
commit 82101053ff
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C
2 changed files with 22 additions and 35 deletions

View File

@ -64,10 +64,10 @@ namespace UniversalEditor.UserInterface.Dialogs
void cmdOK_Click (object sender, EventArgs e)
{
StackSidebarPanel pnl = sidebar.SelectedPanel;
TabPage pnl = sidebar.SelectedTab;
if (pnl == null) return;
Container ct = (pnl.Control as Container);
Container ct = (pnl as Container);
AccessorReference accref = pnl.GetExtraData<AccessorReference> ("ar");
CustomOptionCompatSettingsProvider coll = new CustomOptionCompatSettingsProvider();
@ -129,7 +129,7 @@ namespace UniversalEditor.UserInterface.Dialogs
private Accessor mvarAccessor = null;
public Accessor Accessor { get { return mvarAccessor; } set { mvarAccessor = value; mvarInitialAccesor = value; } }
private StackSidebar sidebar = null;
private TabContainer sidebar = null;
private void fbc_ItemActivated (object sender, EventArgs e)
{
@ -138,7 +138,8 @@ namespace UniversalEditor.UserInterface.Dialogs
private void InitializeComponent()
{
sidebar = new StackSidebar ();
sidebar = new TabContainer();
sidebar.TabStyle = TabContainerTabStyle.Sidebar;
this.Layout = new BoxLayout (Orientation.Vertical);
AccessorReference[] accessors = UniversalEditor.Common.Reflection.GetAvailableAccessors ();
@ -148,10 +149,9 @@ namespace UniversalEditor.UserInterface.Dialogs
// mean we shouldn't be showing it in the UI
continue;
}
StackSidebarPanel panel = new StackSidebarPanel ();
panel.SetExtraData<AccessorReference> ("ar", acc);
TabPage ct = new TabPage();
ct.SetExtraData<AccessorReference> ("ar", acc);
Container ct = new Container ();
ct.Layout = new GridLayout ();
ct.Name = acc.AccessorType.FullName;
ct.Text = acc.Title;
@ -287,8 +287,7 @@ namespace UniversalEditor.UserInterface.Dialogs
}
}
panel.Control = ct;
sidebar.Items.Add (panel);
sidebar.TabPages.Add(ct);
}
this.Controls.Add (sidebar, new BoxLayout.Constraints(true, true));

View File

@ -52,19 +52,17 @@ namespace UniversalEditor.Editors.Contact
private DefaultTreeModel tmAddresses;
private ListViewControl lvPhysicalAddresses;
private Container ct;
private Container ctName;
private void InitializeComponent()
{
this.Layout = new BoxLayout(Orientation.Vertical);
this.Padding = new Padding(26);
StackSidebar sidebar = new StackSidebar();
TabContainer sidebar = new TabContainer();
#region Summary Panel
{
ct = new Container();
TabPage ct = new TabPage();
ct.Name = "ctSummary";
ct.Text = "Summary";
ct.Layout = new GridLayout();
@ -73,7 +71,7 @@ namespace UniversalEditor.Editors.Contact
btnPhoto.Size = new Dimension2D(128, 128);
ct.Controls.Add(btnPhoto, new GridLayout.Constraints(0, 0, 1, 1, ExpandMode.None));
ctName = new Container();
Container ctName = new Container();
ctName.Layout = new GridLayout();
Label lblGivenName = new Label();
@ -133,14 +131,12 @@ namespace UniversalEditor.Editors.Contact
ct.Controls.Add(ctName, new GridLayout.Constraints(0, 1, 2, 1, ExpandMode.None));
StackSidebarPanel panel = new StackSidebarPanel();
panel.Control = ct;
sidebar.Items.Add(panel);
sidebar.TabPages.Add(ct);
}
#endregion
#region Addresses
{
Container ct = new Container();
TabPage ct = new TabPage();
ct.Name = "ctAddresses";
ct.Text = "Addresses";
ct.Layout = new BoxLayout(Orientation.Vertical);
@ -152,14 +148,12 @@ namespace UniversalEditor.Editors.Contact
lvPhysicalAddresses.Model = tmAddresses;
ct.Controls.Add(lvPhysicalAddresses, new BoxLayout.Constraints(true, true));
StackSidebarPanel panel = new StackSidebarPanel();
panel.Control = ct;
sidebar.Items.Add(panel);
sidebar.TabPages.Add(ct);
}
#endregion
#region Family
{
Container ct = new Container();
TabPage ct = new TabPage();
ct.Name = "ctFamily";
ct.Text = "Family and Relationships";
ct.Layout = new BoxLayout(Orientation.Vertical);
@ -170,14 +164,12 @@ namespace UniversalEditor.Editors.Contact
lvAddresses.Columns.Add(new ListViewColumn("Address", new CellRenderer[] { new CellRendererText(tmAddresses.Columns[0]) }));
ct.Controls.Add(lvAddresses, new BoxLayout.Constraints(true, true));
StackSidebarPanel panel = new StackSidebarPanel();
panel.Control = ct;
sidebar.Items.Add(panel);
sidebar.TabPages.Add(ct);
}
#endregion
#region Digital IDs
{
Container ct = new Container();
TabPage ct = new TabPage();
ct.Name = "ctDigitalIDs";
ct.Text = "Digital IDs";
ct.Layout = new BoxLayout(Orientation.Vertical);
@ -188,14 +180,12 @@ namespace UniversalEditor.Editors.Contact
lvAddresses.Columns.Add(new ListViewColumn("Address", new CellRenderer[] { new CellRendererText(tmAddresses.Columns[0]) }));
ct.Controls.Add(lvAddresses, new BoxLayout.Constraints(true, true));
StackSidebarPanel panel = new StackSidebarPanel();
panel.Control = ct;
sidebar.Items.Add(panel);
sidebar.TabPages.Add(ct);
}
#endregion
#region Notes
{
Container ct = new Container();
TabPage ct = new TabPage();
ct.Name = "ctNotes";
ct.Text = "Notes";
ct.Layout = new BoxLayout(Orientation.Vertical);
@ -204,16 +194,14 @@ namespace UniversalEditor.Editors.Contact
txtNotes.Multiline = true;
ct.Controls.Add(txtNotes, new BoxLayout.Constraints(true, true));
StackSidebarPanel panel = new StackSidebarPanel();
panel.Control = ct;
sidebar.Items.Add(panel);
sidebar.TabPages.Add(ct);
}
#endregion
this.Controls.Add(sidebar, new BoxLayout.Constraints(true, true));
}
private void AddDetailRow(int iRow, string detailType, string value)
private void AddDetailRow(Container ct, int iRow, string detailType, string value)
{
ComboBox cboDetail = new ComboBox();
cboDetail.Text = detailType;
@ -265,7 +253,7 @@ namespace UniversalEditor.Editors.Contact
foreach (ContactPhysicalAddress addr in contact.PhysicalAddresses)
{
AddDetailRow(0, "Address", addr.ToString());
// AddDetailRow(0, "Address", addr.ToString());
}
}