From 47e5f0406f107ce589eded04f032bf6588e40605 Mon Sep 17 00:00:00 2001 From: abdelkader Date: Tue, 27 Jun 2023 12:32:38 -0400 Subject: [PATCH] added UIToolbox to add removable component start --- .../{View/Libs => Model}/PropertyComparer.cs | 2 +- vCardEditor/Presenter/MainPresenter.cs | 6 + vCardEditor/View/SortableBindingList.cs | 3 +- vCardEditor/View/UIToolbox/CollapseBox.cs | 118 +++++++ vCardEditor/View/UIToolbox/CollapseBox.resx | 109 ++++++ .../View/UIToolbox/CollapsibleGroupBox.bmp | Bin 0 -> 824 bytes .../View/UIToolbox/CollapsibleGroupBox.cs | 326 ++++++++++++++++++ .../View/UIToolbox/CollapsibleGroupBox.resx | 166 +++++++++ vCardEditor/View/UIToolbox/ExpandingPanel.cs | 194 +++++++++++ .../View/UIToolbox/ExpandingPanel.resx | 109 ++++++ vCardEditor/View/UIToolbox/ImageButton.cs | 110 ++++++ vCardEditor/View/UIToolbox/ImageButton.resx | 42 +++ vCardEditor/View/UIToolbox/OwnerDrawButton.cs | 136 ++++++++ .../View/UIToolbox/OwnerDrawButton.resx | 109 ++++++ vCardEditor/View/UIToolbox/TRASH01.ICO | Bin 0 -> 1078 bytes .../View/UIToolbox/TRASH01_Pressed.ICO | Bin 0 -> 1078 bytes vCardEditor/vCardEditor.csproj | 35 +- 17 files changed, 1461 insertions(+), 4 deletions(-) rename vCardEditor/{View/Libs => Model}/PropertyComparer.cs (98%) create mode 100644 vCardEditor/View/UIToolbox/CollapseBox.cs create mode 100644 vCardEditor/View/UIToolbox/CollapseBox.resx create mode 100644 vCardEditor/View/UIToolbox/CollapsibleGroupBox.bmp create mode 100644 vCardEditor/View/UIToolbox/CollapsibleGroupBox.cs create mode 100644 vCardEditor/View/UIToolbox/CollapsibleGroupBox.resx create mode 100644 vCardEditor/View/UIToolbox/ExpandingPanel.cs create mode 100644 vCardEditor/View/UIToolbox/ExpandingPanel.resx create mode 100644 vCardEditor/View/UIToolbox/ImageButton.cs create mode 100644 vCardEditor/View/UIToolbox/ImageButton.resx create mode 100644 vCardEditor/View/UIToolbox/OwnerDrawButton.cs create mode 100644 vCardEditor/View/UIToolbox/OwnerDrawButton.resx create mode 100644 vCardEditor/View/UIToolbox/TRASH01.ICO create mode 100644 vCardEditor/View/UIToolbox/TRASH01_Pressed.ICO diff --git a/vCardEditor/View/Libs/PropertyComparer.cs b/vCardEditor/Model/PropertyComparer.cs similarity index 98% rename from vCardEditor/View/Libs/PropertyComparer.cs rename to vCardEditor/Model/PropertyComparer.cs index ef45564..62de842 100644 --- a/vCardEditor/View/Libs/PropertyComparer.cs +++ b/vCardEditor/Model/PropertyComparer.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Reflection; -namespace vCardEditor.View.Libs +namespace vCardEditor.Model { public class PropertyComparer : IComparer { diff --git a/vCardEditor/Presenter/MainPresenter.cs b/vCardEditor/Presenter/MainPresenter.cs index 9eab4f2..7bbd07f 100644 --- a/vCardEditor/Presenter/MainPresenter.cs +++ b/vCardEditor/Presenter/MainPresenter.cs @@ -56,6 +56,12 @@ namespace VCFEditor.Presenter private void LoadFormHandler(object sender, EventArg e) { e.Data = ConfigRepository.Instance.FormState; + var paths = Environment.GetCommandLineArgs(); + if (paths.Length > 1) + { + var evt = new EventArg(paths[1]); + NewFileOpenedHandler(sender, evt); + } } diff --git a/vCardEditor/View/SortableBindingList.cs b/vCardEditor/View/SortableBindingList.cs index 3e1e3c1..32db072 100644 --- a/vCardEditor/View/SortableBindingList.cs +++ b/vCardEditor/View/SortableBindingList.cs @@ -1,7 +1,8 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using vCardEditor.View.Libs; +using vCardEditor.Model; + namespace vCardEditor.View { diff --git a/vCardEditor/View/UIToolbox/CollapseBox.cs b/vCardEditor/View/UIToolbox/CollapseBox.cs new file mode 100644 index 0000000..4538404 --- /dev/null +++ b/vCardEditor/View/UIToolbox/CollapseBox.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Windows.Forms; + +namespace UIToolbox +{ + /// + /// Summary description for CollapseBox. + /// + public class CollapseBox : OwnerDrawButton + { + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + #region Internal variables + private bool m_bIsPlus; + #endregion Internal variables + + public CollapseBox() + { + // This call is required by the Windows.Forms Form Designer. + InitializeComponent(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Component Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + // + // CollapseBox + // + this.Click += new System.EventHandler(this.CollapseBox_Click); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.CollapseBox_Paint); + this.DoubleClick += new System.EventHandler(this.CollapseBox_DoubleClick); + + } + #endregion + + #region Events + private void CollapseBox_Click(object sender, System.EventArgs e) + { + IsPlus = !IsPlus; + } + + private void CollapseBox_DoubleClick(object sender, System.EventArgs e) + { + // fast clicking registers as double-clicking, so map a double-click + // event into a single click. + CollapseBox_Click(sender, e); + } + + private void CollapseBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e) + { + Graphics g = e.Graphics; + + if(m_ButtonState == ButtonState.TrackingInside) + g.FillRectangle(Brushes.LightGray, ClientRectangle); + else + g.FillRectangle(Brushes.White, ClientRectangle); + + Rectangle theRec = new Rectangle(); + theRec = ClientRectangle; + theRec.Width--; + theRec.Height--; + g.DrawRectangle(Pens.Black, theRec); + g.DrawLine(Pens.Black, theRec.X + 2, theRec.Y + (this.Height/2), + theRec.X + this.Width - 3, theRec.Y + (this.Height/2)); + if(m_bIsPlus) + { + g.DrawLine(Pens.Black, theRec.X + (this.Width/2), theRec.Y + 2, + theRec.X + (this.Width/2), theRec.Y + this.Height - 3); + } + } + #endregion Events + + #region Accessors + [DefaultValue(false)] + public bool IsPlus + { + get + { + return m_bIsPlus; + } + set + { + if(m_bIsPlus != value) + { + m_bIsPlus = value; + Invalidate(); + } + } + } + #endregion Accessors + } +} diff --git a/vCardEditor/View/UIToolbox/CollapseBox.resx b/vCardEditor/View/UIToolbox/CollapseBox.resx new file mode 100644 index 0000000..d7d8372 --- /dev/null +++ b/vCardEditor/View/UIToolbox/CollapseBox.resx @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + False + + + CollapseBox + + \ No newline at end of file diff --git a/vCardEditor/View/UIToolbox/CollapsibleGroupBox.bmp b/vCardEditor/View/UIToolbox/CollapsibleGroupBox.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c13fa5a1cf8b2b060246d22813cc3dd8d599adfe GIT binary patch literal 824 zcmd^+F%Ezr3`H^S#?d2q0^{uNnLHYU2h%5&rq)4m^(U>ReSQc`^H_(Zf!q`A8CB>~ z|43^iksC3_twc+SFa{^H%cF$+EuSCc^0k-d?g!4j8=W`2{wTbfs6Pchf{{gF6!e*@ b>~>7W$`%%IwPJbz@pqUmnck(-&qWA3bifR` literal 0 HcmV?d00001 diff --git a/vCardEditor/View/UIToolbox/CollapsibleGroupBox.cs b/vCardEditor/View/UIToolbox/CollapsibleGroupBox.cs new file mode 100644 index 0000000..09285b7 --- /dev/null +++ b/vCardEditor/View/UIToolbox/CollapsibleGroupBox.cs @@ -0,0 +1,326 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.Windows.Forms; + +namespace UIToolbox +{ + /// + /// Summary description for CollapsibleGroupBox. + /// + public class CollapsibleGroupBox : System.Windows.Forms.UserControl + { + public const int kCollapsedHeight = 20; + #region Members + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + private CollapseBox m_CollapseBox; + private ImageButton m_TrashIcon; + public event CollapseBoxClickedEventHandler CollapseBoxClickedEvent; + public event TrashCanClickedEventHandler TrashCanClickedEvent; + + private string m_Caption; + //private bool m_bContainsTrashCan; + //private System.Windows.Forms.GroupBox m_GroupBox; + private Size m_FullSize; + private bool m_bResizingFromCollapse = false; + #endregion Members + + + public CollapsibleGroupBox() + { + // This call is required by the Windows.Forms Form Designer. + InitializeComponent(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Component Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CollapsibleGroupBox)); + this.m_CollapseBox = new UIToolbox.CollapseBox(); + this.m_TrashIcon = new UIToolbox.ImageButton(); + this.SuspendLayout(); + // + // m_CollapseBox + // + this.m_CollapseBox.IsPlus = false; + this.m_CollapseBox.Location = new System.Drawing.Point(12, 1); + this.m_CollapseBox.Name = "m_CollapseBox"; + this.m_CollapseBox.Size = new System.Drawing.Size(11, 11); + this.m_CollapseBox.TabIndex = 1; + this.m_CollapseBox.Click += new System.EventHandler(this.CollapseBox_Click); + this.m_CollapseBox.DoubleClick += new System.EventHandler(this.CollapseBox_DoubleClick); + // + // m_TrashIcon + // + this.m_TrashIcon.Location = new System.Drawing.Point(88, 0); + this.m_TrashIcon.Name = "m_TrashIcon"; + this.m_TrashIcon.NormalImage = ((System.Drawing.Image)(resources.GetObject("m_TrashIcon.NormalImage"))); + this.m_TrashIcon.PressedImage = ((System.Drawing.Image)(resources.GetObject("m_TrashIcon.PressedImage"))); + this.m_TrashIcon.Size = new System.Drawing.Size(16, 16); + this.m_TrashIcon.TabIndex = 2; + this.m_TrashIcon.TabStop = false; + this.m_TrashIcon.Click += new System.EventHandler(this.TrashIcon_Click); + // + // CollapsibleGroupBox + // + this.Controls.Add(this.m_TrashIcon); + this.Controls.Add(this.m_CollapseBox); + this.Name = "CollapsibleGroupBox"; + this.Resize += new System.EventHandler(this.CollapsibleGroupBox_Resize); + this.Load += new System.EventHandler(this.CollapsibleGroupBox_Load); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.CollapsibleGroupBox_Paint); + this.ResumeLayout(false); + + } + #endregion + + #region Events + private void CollapsibleGroupBox_Load(object sender, System.EventArgs e) + { + SetGroupBoxCaption(); + } + + private void CollapsibleGroupBox_Resize(object sender, System.EventArgs e) + { + if(m_bResizingFromCollapse != true) + { + m_FullSize = this.Size; + } + + Invalidate(); + } + + private void CollapsibleGroupBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e) + { + // UG! I originall added a GroupBox control but ran into problems... + // Panes derived from CollapsibleGroupBox would "chew up" controls + // added to them, so I had to get rid of the GroupBox and draw a fake + // group box myself + Graphics g = e.Graphics; + Rectangle theRec = new Rectangle(); + theRec = this.ClientRectangle; + + //Color theEdgeGrayColor = Color.FromArgb(170, 170, 156); + //Pen thePen = new Pen(theEdgeGrayColor); + Pen thePen = SystemPens.ControlDark; + + + int theTextSize = (int)g.MeasureString(m_Caption, this.Font).Width; + if(theTextSize < 1) + theTextSize = 1; + + int theCaptionPosition = (theRec.X + 8) + 2 + m_CollapseBox.Width + 2; + int theEndPosition = theCaptionPosition + theTextSize + 1; + if(m_TrashIcon.Visible) + theEndPosition += (m_TrashIcon.Width + 2); + + + g.DrawLine(thePen, theRec.X + 8, theRec.Y + 5, + theRec.X, theRec.Y + 5); + + g.DrawLine(thePen, theRec.X, theRec.Y + 5, + theRec.X, theRec.Bottom - 2); + + g.DrawLine(thePen, theRec.X, theRec.Bottom - 2, + theRec.Right - 1, theRec.Bottom - 2); + + g.DrawLine(thePen, theRec.Right - 2, theRec.Bottom - 2, + theRec.Right - 2, theRec.Y + 5); + + g.DrawLine(thePen, theRec.Right - 2, theRec.Y + 5, + theRec.X + theEndPosition, theRec.Y + 5); + + + + g.DrawLine(Pens.White, theRec.X + 8, theRec.Y + 6, + theRec.X + 1, theRec.Y + 6); + + g.DrawLine(Pens.White, theRec.X + 1, theRec.Y + 6, + theRec.X + 1, theRec.Bottom - 3); + + g.DrawLine(Pens.White, theRec.X, theRec.Bottom - 1, + theRec.Right, theRec.Bottom - 1); + + g.DrawLine(Pens.White, theRec.Right - 1, theRec.Bottom - 1, + theRec.Right - 1, theRec.Y + 5); + + g.DrawLine(Pens.White, theRec.Right - 3, theRec.Y + 6, + theRec.X + theEndPosition, theRec.Y + 6); + + StringFormat sf = new StringFormat(); + SolidBrush drawBrush = new SolidBrush(Color.Black); + + g.DrawString(m_Caption, this.Font, drawBrush, theCaptionPosition, 0); + } + + public void CollapseBox_Click(object sender, System.EventArgs e) + { + // at this point the control's value has changed but hasn't been + // redrawn on the screen + this.IsCollapsed = m_CollapseBox.IsPlus; + + if(CollapseBoxClickedEvent != null) + { + CollapseBoxClickedEvent(this); + } + } + + private void CollapseBox_DoubleClick(object sender, System.EventArgs e) + { + // fast clicking registers as double-clicking, so map a double-click + // event into a single click. + CollapseBox_Click(sender, e); + } + + private void TrashIcon_Click(object sender, System.EventArgs e) + { + if(TrashCanClickedEvent != null) + { + TrashCanClickedEvent(this); + } + } + #endregion events + + #region Accessors + [DefaultValue("")] + public string Caption + { + get + { + return m_Caption; + } + set + { + m_Caption = value; + SetGroupBoxCaption(); + Invalidate(); + } + } + + [DefaultValue(true)] + public bool ContainsTrashCan + { + get + { + return m_TrashIcon.Visible; + } + set + { + //m_bContainsTrashCan = value; + m_TrashIcon.Visible = value; + SetGroupBoxCaption(); + Invalidate(); + } + } + + [Browsable(false)] + public int FullHeight + { + get + { + return m_FullSize.Height; + } + } + + [DefaultValue(false), Browsable(false)] + public bool IsCollapsed + { + get + { + #if DEBUG + if(m_CollapseBox.IsPlus) + { + Debug.Assert(this.Height == kCollapsedHeight); + } + else + { + Debug.Assert(this.Height > kCollapsedHeight); + } + #endif + return m_CollapseBox.IsPlus; + } + set + { + if(m_CollapseBox.IsPlus != value) + { + m_CollapseBox.IsPlus = value; + } + + if(m_CollapseBox.IsPlus != true) + { + //Expand(); + this.Size = m_FullSize; + } + else + { + //Collapse(); + m_bResizingFromCollapse = true; + Size smallSize = m_FullSize; + smallSize.Height = kCollapsedHeight; + this.Size = smallSize; + m_bResizingFromCollapse = false; + } + + Invalidate(); + } + } + #endregion accessors + + #region Methods + private void SetGroupBoxCaption() + { + RepositionTrashCan(); + } + + private void RepositionTrashCan() + { + if(m_TrashIcon.Visible) + { + // Since the trash icon's location is a function of the caption's width, + // we also need to reposition the trash icon + // first, find the width of the string + Graphics g = CreateGraphics(); + SizeF theTextSize = new SizeF(); + theTextSize = g.MeasureString(m_Caption, this.Font); + // Hmm... MeasureString() doesn't seem to be returning the + // correct width. Close... but not exact + + // 11 is the number of pixels from the beginning of the group box + // to the beginning of text of the group box's caption + //m_TrashIcon.Left = m_GroupBox.Location.X + 29 + (int)theTextSize.Width - 4; + m_TrashIcon.Left = this.Location.X + 29 + (int)theTextSize.Width - 4; + // -4 is a fudge factor. Hey, what can I say... + } + } + #endregion Methods + + + public delegate void CollapseBoxClickedEventHandler(object sender); + public delegate void TrashCanClickedEventHandler(object sender); + } +} diff --git a/vCardEditor/View/UIToolbox/CollapsibleGroupBox.resx b/vCardEditor/View/UIToolbox/CollapsibleGroupBox.resx new file mode 100644 index 0000000..e108cc5 --- /dev/null +++ b/vCardEditor/View/UIToolbox/CollapsibleGroupBox.resx @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + False + + + Private + + + Private + + + False + + + Private + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAJdJREFUOE+VkgEK + wDAIA9ef92n9WYdlEbVR2aB0OM3O6Hj4s0l4JLkuLIV7rXUdiX8n1XFFpkDjlYj785xzyxES+25FGQYQ + uxaYP0ePoaqofBeaygdNgInAx90ZeQhCn/8IIIAbyPHO5ugmAU9IcWriZaTtvTMQVOqD3YEwgZ7A4ict + pOOkG2nw45Son+Uou3WOipXYyX0Bl4EdsYyOw8oAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAJhJREFUOE+VkgEK + wDAIA9dP9gn9/w86LIuojcoGpcNpdkbHw59NwiPJdWEp3Gut60j8O6mOKzIFGq9E3J/nnFuOkNh3K8ow + gNi1wPw5egxVReW70FQ+aAJMBD7uzshDEPr8RwAB3ECOdzZHNwl4QopTEy8jbe+dgaBSH+wOhAn0BBY/ + aSEdJ91Igx+nRP0sR9mtc1SsxE7uC3D26NQxC7BSAAAAAElFTkSuQmCC + + + + False + + + False + + + True + + + True + + + 80 + + + (Default) + + + False + + + Private + + + CollapsibleGroupBox + + + 8, 8 + + \ No newline at end of file diff --git a/vCardEditor/View/UIToolbox/ExpandingPanel.cs b/vCardEditor/View/UIToolbox/ExpandingPanel.cs new file mode 100644 index 0000000..75344ce --- /dev/null +++ b/vCardEditor/View/UIToolbox/ExpandingPanel.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Windows.Forms; + +namespace UIToolbox +{ + /// + /// Summary description for ExpandingPanel. + /// + public class ExpandingPanel : System.Windows.Forms.Panel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + ArrayList m_GroupArray = null; + + + public const int kGap = 6; + public ExpandingPanel() + { + // This call is required by the Windows.Forms Form Designer. + InitializeComponent(); + + m_GroupArray = new ArrayList(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Component Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + // + // ExpandingPanel + // + this.Move += new System.EventHandler(this.ExpandingPanel_Move); + this.Resize += new System.EventHandler(this.ExpandingPanel_Resize); + this.SizeChanged += new System.EventHandler(this.ExpandingPanel_SizeChanged); + this.Layout += new System.Windows.Forms.LayoutEventHandler(this.ExpandingPanel_Layout); + + } + #endregion + + + public void AddGroup(UIToolbox.CollapsibleGroupBox theGroupBox) + { + m_GroupArray.Add(theGroupBox); + + + this.SuspendLayout(); + Size theSize = this.AutoScrollMinSize; + theGroupBox.Location = new System.Drawing.Point(4, theSize.Height + 4); + + + theSize.Height += (theGroupBox.Height + kGap); + this.AutoScrollMinSize = theSize; + theGroupBox.CollapseBoxClickedEvent += new CollapsibleGroupBox.CollapseBoxClickedEventHandler(this.CollapseBox_Click); + theGroupBox.TrashCanClickedEvent += new CollapsibleGroupBox.TrashCanClickedEventHandler(this.TrashCan_Click); + this.Controls.Add(theGroupBox); + this.ResumeLayout(false); + } + + private void ExpandingPanel_Layout(object sender, System.Windows.Forms.LayoutEventArgs e) + { + } + + private void ExpandingPanel_Move(object sender, System.EventArgs e) + { + } + + private void ExpandingPanel_Resize(object sender, System.EventArgs e) + { + } + + private void ExpandingPanel_SizeChanged(object sender, System.EventArgs e) + { + } + + private void CollapseBox_Click(object sender) + { + int nIndex; + nIndex = m_GroupArray.IndexOf(sender); + + CollapsibleGroupBox theGroupBox; + theGroupBox = (CollapsibleGroupBox)m_GroupArray[nIndex]; + + int nDelta; + if(theGroupBox.Height == CollapsibleGroupBox.kCollapsedHeight) + { + nDelta = -(theGroupBox.FullHeight - CollapsibleGroupBox.kCollapsedHeight); + } + else + { + nDelta = (theGroupBox.FullHeight - CollapsibleGroupBox.kCollapsedHeight); + } + + for(int i=(nIndex + 1); i -1 && idx < data.Count) + { + return (data[idx]); + } + else + { + throw new InvalidOperationException("[IndexerArray.get_Item]Index out of range"); + } + } + set + { + if (idx > -1 && idx < data.Count) + { + data[idx] = value; + } + else if (idx == data.Count) + { + data.Add(value); + } + else + { + throw new InvalidOperationException("[IndexerArray.set_Item]Index out of range"); + } + } + } +} + +#endregion NOT USED diff --git a/vCardEditor/View/UIToolbox/ExpandingPanel.resx b/vCardEditor/View/UIToolbox/ExpandingPanel.resx new file mode 100644 index 0000000..a3382f9 --- /dev/null +++ b/vCardEditor/View/UIToolbox/ExpandingPanel.resx @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + False + + + ExpandingPanel + + \ No newline at end of file diff --git a/vCardEditor/View/UIToolbox/ImageButton.cs b/vCardEditor/View/UIToolbox/ImageButton.cs new file mode 100644 index 0000000..4eb0143 --- /dev/null +++ b/vCardEditor/View/UIToolbox/ImageButton.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Windows.Forms; + +namespace UIToolbox +{ + /// + /// Summary description for ImageButton. + /// + public class ImageButton : OwnerDrawButton + { + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + #region Internal variables + private Image m_NormalImage = null; + private Image m_PressedImage = null; + #endregion Internal variables + + public ImageButton() + { + // This call is required by the Windows.Forms Form Designer. + InitializeComponent(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Component Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + // + // ImageButton + // + this.Paint += new System.Windows.Forms.PaintEventHandler(this.ImageButton_Paint); + } + #endregion + + #region Events + private void ImageButton_Paint(object sender, System.Windows.Forms.PaintEventArgs e) + { + Graphics g = e.Graphics; + + if(m_ButtonState == ButtonState.TrackingInside) + { + if(m_PressedImage != null) + { + g.DrawImage(m_PressedImage, 0, 0, m_PressedImage.Width, m_PressedImage.Height); + } + } + else + { + if(m_NormalImage != null) + { + g.DrawImage(m_NormalImage, 0, 0, m_NormalImage.Width, m_NormalImage.Height); + } + } + } + #endregion Events + + #region Accessors + public Image NormalImage + { + get + { + return m_NormalImage; + } + set + { + m_NormalImage = value; + Invalidate(); + } + } + + public Image PressedImage + { + get + { + return m_PressedImage; + } + set + { + m_PressedImage = value; + Invalidate(); + } + } + #endregion Accessors + } +} diff --git a/vCardEditor/View/UIToolbox/ImageButton.resx b/vCardEditor/View/UIToolbox/ImageButton.resx new file mode 100644 index 0000000..3f337e0 --- /dev/null +++ b/vCardEditor/View/UIToolbox/ImageButton.resx @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + diff --git a/vCardEditor/View/UIToolbox/OwnerDrawButton.cs b/vCardEditor/View/UIToolbox/OwnerDrawButton.cs new file mode 100644 index 0000000..f833528 --- /dev/null +++ b/vCardEditor/View/UIToolbox/OwnerDrawButton.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Windows.Forms; + +namespace UIToolbox +{ + /// + /// Summary description for OwnerDrawButton. + /// + public class OwnerDrawButton : System.Windows.Forms.Control + { + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + #region Internal variables + public enum ButtonState + { + Normal, + TrackingInside, + TrackingOutside + } + + protected ButtonState m_ButtonState = ButtonState.Normal; + #endregion Internal variables + + public OwnerDrawButton() + { + // This call is required by the Windows.Forms Form Designer. + InitializeComponent(); + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Component Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + // + // OwnerDrawButton + // + this.Resize += new System.EventHandler(this.OwnerDrawButton_Resize); + this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OwnerDrawButton_MouseUp); + this.Paint += new System.Windows.Forms.PaintEventHandler(this.OwnerDrawButton_Paint); + this.MouseEnter += new System.EventHandler(this.OwnerDrawButton_MouseEnter); + this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OwnerDrawButton_MouseMove); + this.MouseLeave += new System.EventHandler(this.OwnerDrawButton_MouseLeave); + this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OwnerDrawButton_MouseDown); + + } + #endregion + + #region Events + private void OwnerDrawButton_Paint(object sender, System.Windows.Forms.PaintEventArgs e) + { + // needs to be implemented by the derived class + } + + private void OwnerDrawButton_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) + { + m_ButtonState = ButtonState.TrackingInside; + Invalidate(); + } + + private void OwnerDrawButton_MouseEnter(object sender, System.EventArgs e) + { + if(m_ButtonState == ButtonState.TrackingOutside) + { + m_ButtonState = ButtonState.TrackingInside; + Invalidate(); + } + } + + private void OwnerDrawButton_MouseLeave(object sender, System.EventArgs e) + { + if(m_ButtonState == ButtonState.TrackingInside) + { + m_ButtonState = ButtonState.TrackingOutside; + Invalidate(); + } + } + + private void OwnerDrawButton_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) + { + if(m_ButtonState == ButtonState.Normal) + return; + + Rectangle bounds = new Rectangle(0, 0, this.Width, this.Height); + if(m_ButtonState == ButtonState.TrackingInside) + { + if( !bounds.Contains(e.X, e.Y) ) + OwnerDrawButton_MouseLeave(sender, e); + } + else if(m_ButtonState == ButtonState.TrackingOutside) + { + if( bounds.Contains(e.X, e.Y) ) + OwnerDrawButton_MouseEnter(sender, e); + } + } + + private void OwnerDrawButton_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) + { + if(m_ButtonState != ButtonState.Normal) + { + m_ButtonState = ButtonState.Normal; + Invalidate(); + } + } + + private void OwnerDrawButton_Resize(object sender, System.EventArgs e) + { + Invalidate(); + } + #endregion Events + } +} diff --git a/vCardEditor/View/UIToolbox/OwnerDrawButton.resx b/vCardEditor/View/UIToolbox/OwnerDrawButton.resx new file mode 100644 index 0000000..5ecdcb1 --- /dev/null +++ b/vCardEditor/View/UIToolbox/OwnerDrawButton.resx @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Private + + + False + + + OwnerDrawButton + + \ No newline at end of file diff --git a/vCardEditor/View/UIToolbox/TRASH01.ICO b/vCardEditor/View/UIToolbox/TRASH01.ICO new file mode 100644 index 0000000000000000000000000000000000000000..afcf3bab39ed8c21e744a8d2abff39b5ad122678 GIT binary patch literal 1078 zcmbVLJ95H641Fe5Pgu$XbUEA1E?~&1vv#rpmryBY=@5J1Nab>DJdx!l=m##kOU@~to^k6 z_9J_(H88;xtJMOMk16mNo})pX zpOLn0(>It3rK2P`bM<}OHgp9HcbW-hgIU{H;wC)>W=gnHImYBt@_6M4?D84Qd_>4j z0O4}Qoc8+6QMttl*nP*5dG~MtmV#ocxnPpBhnx>fj$h82^98XYhB 512 + false publish\ true Disk @@ -26,7 +27,6 @@ true 0 1.0.0.%2a - false false true @@ -70,6 +70,7 @@ + @@ -159,7 +160,6 @@ - Form @@ -170,6 +170,21 @@ Component + + Component + + + UserControl + + + Component + + + Component + + + Component + ResXFileCodeGenerator Resources.Designer.cs @@ -199,6 +214,21 @@ MainForm.cs + + CollapseBox.cs + + + CollapsibleGroupBox.cs + + + ExpandingPanel.cs + + + ImageButton.cs + + + OwnerDrawButton.cs + SettingsSingleFileGenerator @@ -225,6 +255,7 @@ false +