From 82101053ff9a7fd32cc5bb6a5b75bd9ad65d4bfe Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Wed, 11 Aug 2021 15:22:54 -0400 Subject: [PATCH] removed StackSidebar and replaced with TabContainer with TabStyle = Sidebar --- .../Dialogs/DocumentPropertiesDialogV2.cs | 17 ++++---- .../Editors/Contact/ContactEditor.cs | 40 +++++++------------ 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/Libraries/UniversalEditor.UserInterface/Dialogs/DocumentPropertiesDialogV2.cs b/Libraries/UniversalEditor.UserInterface/Dialogs/DocumentPropertiesDialogV2.cs index 25921c3e..8f2d3e46 100644 --- a/Libraries/UniversalEditor.UserInterface/Dialogs/DocumentPropertiesDialogV2.cs +++ b/Libraries/UniversalEditor.UserInterface/Dialogs/DocumentPropertiesDialogV2.cs @@ -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 ("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 ("ar", acc); + TabPage ct = new TabPage(); + ct.SetExtraData ("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)); diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.AddressBook.UserInterface/Editors/Contact/ContactEditor.cs b/Plugins.UserInterface/UniversalEditor.Plugins.AddressBook.UserInterface/Editors/Contact/ContactEditor.cs index 786ec907..63f294c2 100644 --- a/Plugins.UserInterface/UniversalEditor.Plugins.AddressBook.UserInterface/Editors/Contact/ContactEditor.cs +++ b/Plugins.UserInterface/UniversalEditor.Plugins.AddressBook.UserInterface/Editors/Contact/ContactEditor.cs @@ -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()); } }