Mercurial > repos > IBBoard.Windows.Forms
changeset 7:02a7c7aaf2c1
* Fix line terminators
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 27 Jun 2009 19:03:23 +0000 |
parents | 97cab866aba9 |
children | 2cbc6ebae6b7 |
files | AssemblyInfo.cs Windows/Forms/ColorableStatusBar.cs Windows/Forms/ColorableStatusBarPanel.cs Windows/Forms/Delegates.cs Windows/Forms/IBBButton.cs Windows/Forms/IBBForm.cs Windows/Forms/IBBLabel.cs Windows/Forms/IBBMenuItem.cs Windows/Forms/IBBToolBarButton.cs Windows/Forms/ListViewColumnSorter.cs |
diffstat | 10 files changed, 404 insertions(+), 404 deletions(-) [+] |
line wrap: on
line diff
--- a/AssemblyInfo.cs Mon May 25 10:29:21 2009 +0000 +++ b/AssemblyInfo.cs Sat Jun 27 19:03:23 2009 +0000 @@ -1,58 +1,58 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly: AssemblyTitle("IBBoard.Windows.Forms")] -[assembly: AssemblyDescription("Custom System.Windows.Forms extensions, including translatable controls.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("IBBoard.Windows.Forms")] -[assembly: AssemblyCopyright("IBBoard, 2007-2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.0.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\<configuration>. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("IBBoard.Windows.Forms")] +[assembly: AssemblyDescription("Custom System.Windows.Forms extensions, including translatable controls.")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("IBBoard.Windows.Forms")] +[assembly: AssemblyCopyright("IBBoard, 2007-2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\<configuration>. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")]
--- a/Windows/Forms/ColorableStatusBar.cs Mon May 25 10:29:21 2009 +0000 +++ b/Windows/Forms/ColorableStatusBar.cs Sat Jun 27 19:03:23 2009 +0000 @@ -2,43 +2,43 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Windows.Forms; - -namespace IBBoard.Windows.Forms -{ - /// <summary> - /// Summary description for ColorableStatusBar. - /// </summary> - public class ColorableStatusBar : StatusBar - { - private Brush defaultBrush; - - public ColorableStatusBar() - { - defaultBrush = new SolidBrush(SystemColors.WindowText); - } - - //Code taken from MS Knowledge base - http://support.microsoft.com/kb/319311 - public void ColorableStatusBarDrawItem(object sender, StatusBarDrawItemEventArgs sbdevent) - { - if (sender is StatusBar) - { - System.Drawing.Graphics g = sbdevent.Graphics; - StatusBar sb = (StatusBar)sender; - RectangleF rectf = new RectangleF(sbdevent.Bounds.X, sbdevent.Bounds.Y, sbdevent.Bounds.Width, sbdevent.Bounds.Height); - - if (sbdevent.Panel is ColorableStatusBarPanel) - { - g.DrawString(sbdevent.Panel.Text, sb.Font, ((ColorableStatusBarPanel)sbdevent.Panel).Brush, rectf); - } - else - { - g.DrawString(sbdevent.Panel.Text, sb.Font, defaultBrush, rectf); - } - } - } - } -} +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace IBBoard.Windows.Forms +{ + /// <summary> + /// Summary description for ColorableStatusBar. + /// </summary> + public class ColorableStatusBar : StatusBar + { + private Brush defaultBrush; + + public ColorableStatusBar() + { + defaultBrush = new SolidBrush(SystemColors.WindowText); + } + + //Code taken from MS Knowledge base - http://support.microsoft.com/kb/319311 + public void ColorableStatusBarDrawItem(object sender, StatusBarDrawItemEventArgs sbdevent) + { + if (sender is StatusBar) + { + System.Drawing.Graphics g = sbdevent.Graphics; + StatusBar sb = (StatusBar)sender; + RectangleF rectf = new RectangleF(sbdevent.Bounds.X, sbdevent.Bounds.Y, sbdevent.Bounds.Width, sbdevent.Bounds.Height); + + if (sbdevent.Panel is ColorableStatusBarPanel) + { + g.DrawString(sbdevent.Panel.Text, sb.Font, ((ColorableStatusBarPanel)sbdevent.Panel).Brush, rectf); + } + else + { + g.DrawString(sbdevent.Panel.Text, sb.Font, defaultBrush, rectf); + } + } + } + } +}
--- a/Windows/Forms/ColorableStatusBarPanel.cs Mon May 25 10:29:21 2009 +0000 +++ b/Windows/Forms/ColorableStatusBarPanel.cs Sat Jun 27 19:03:23 2009 +0000 @@ -2,52 +2,52 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Windows.Forms; - -namespace IBBoard.Windows.Forms -{ - /// <summary> - /// Summary description for ColourableStatusBarPanel. - /// </summary> - public class ColorableStatusBarPanel : StatusBarPanel - { - //Note: We keep all external references consistant with .Net and use the American spelling of Colour - private Color textColour; - private SolidBrush brush; - - public ColorableStatusBarPanel() : base() - { - this.Style = StatusBarPanelStyle.OwnerDraw; - textColour = SystemColors.WindowText; - brush = new SolidBrush(textColour); - } - - public Color Color - { - get { return textColour; } - set - { - textColour = value; - brush.Color = value; - } - } - - public Brush Brush - { - get { return brush; } - } - - public void ResetColor() - { - Color = SystemColors.WindowText; - } - - public string TagString - { - get { return (Tag == null ? "" : Tag.ToString()); } - } - } -} +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace IBBoard.Windows.Forms +{ + /// <summary> + /// Summary description for ColourableStatusBarPanel. + /// </summary> + public class ColorableStatusBarPanel : StatusBarPanel + { + //Note: We keep all external references consistant with .Net and use the American spelling of Colour + private Color textColour; + private SolidBrush brush; + + public ColorableStatusBarPanel() : base() + { + this.Style = StatusBarPanelStyle.OwnerDraw; + textColour = SystemColors.WindowText; + brush = new SolidBrush(textColour); + } + + public Color Color + { + get { return textColour; } + set + { + textColour = value; + brush.Color = value; + } + } + + public Brush Brush + { + get { return brush; } + } + + public void ResetColor() + { + Color = SystemColors.WindowText; + } + + public string TagString + { + get { return (Tag == null ? "" : Tag.ToString()); } + } + } +}
--- a/Windows/Forms/Delegates.cs Mon May 25 10:29:21 2009 +0000 +++ b/Windows/Forms/Delegates.cs Sat Jun 27 19:03:23 2009 +0000 @@ -2,11 +2,11 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System; -using System.Windows.Forms; - -namespace IBBoard.Windows.Forms -{ - public delegate void ToolBarButtonRangeDelegate(ToolBarButton[] buttons); - public delegate void ToolBarButtonDelegate(ToolBarButton button); -} +using System; +using System.Windows.Forms; + +namespace IBBoard.Windows.Forms +{ + public delegate void ToolBarButtonRangeDelegate(ToolBarButton[] buttons); + public delegate void ToolBarButtonDelegate(ToolBarButton button); +}
--- a/Windows/Forms/IBBButton.cs Mon May 25 10:29:21 2009 +0000 +++ b/Windows/Forms/IBBButton.cs Sat Jun 27 19:03:23 2009 +0000 @@ -2,16 +2,16 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System; +using System; using System.Windows.Forms; -using IBBoard.Lang; - -namespace IBBoard.Windows.Forms -{ - /// <summary> - /// Summary description for IBBButton. - /// </summary> - public class IBBButton : Button, ITranslatable - { - } -} +using IBBoard.Lang; + +namespace IBBoard.Windows.Forms +{ + /// <summary> + /// Summary description for IBBButton. + /// </summary> + public class IBBButton : Button, ITranslatable + { + } +}
--- a/Windows/Forms/IBBForm.cs Mon May 25 10:29:21 2009 +0000 +++ b/Windows/Forms/IBBForm.cs Sat Jun 27 19:03:23 2009 +0000 @@ -2,16 +2,16 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System; +using System; using System.Windows.Forms; -using IBBoard.Lang; - -namespace IBBoard.Windows.Forms -{ - /// <summary> - /// Summary description for IBBForm. - /// </summary> - public class IBBForm : Form, ITranslatable - { - } -} +using IBBoard.Lang; + +namespace IBBoard.Windows.Forms +{ + /// <summary> + /// Summary description for IBBForm. + /// </summary> + public class IBBForm : Form, ITranslatable + { + } +}
--- a/Windows/Forms/IBBLabel.cs Mon May 25 10:29:21 2009 +0000 +++ b/Windows/Forms/IBBLabel.cs Sat Jun 27 19:03:23 2009 +0000 @@ -2,16 +2,16 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System; +using System; using System.Windows.Forms; -using IBBoard.Lang; - -namespace IBBoard.Windows.Forms -{ - /// <summary> - /// Summary description for IBBLabel. - /// </summary> - public class IBBLabel : Label, ITranslatable - { - } -} +using IBBoard.Lang; + +namespace IBBoard.Windows.Forms +{ + /// <summary> + /// Summary description for IBBLabel. + /// </summary> + public class IBBLabel : Label, ITranslatable + { + } +}
--- a/Windows/Forms/IBBMenuItem.cs Mon May 25 10:29:21 2009 +0000 +++ b/Windows/Forms/IBBMenuItem.cs Sat Jun 27 19:03:23 2009 +0000 @@ -2,41 +2,41 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; -using System.Data; +using System; +using System.Collections; +using System.ComponentModel; +using System.Drawing; +using System.Data; using System.Windows.Forms; -using IBBoard.Lang; - -namespace IBBoard.Windows.Forms -{ - /// <summary> - /// Summary description for IBBMenuItem. - /// </summary> - public class IBBMenuItem : System.Windows.Forms.MenuItem, ITranslatable - { - private string name = "emptyName"; - - public IBBMenuItem() : base(){} - - public IBBMenuItem(string text) : base(text) {} - - #region ITranslatable Members - - public new string Name - { - get - { - return name; - } - set - { - name = value; - } - } - - #endregion - } -} +using IBBoard.Lang; + +namespace IBBoard.Windows.Forms +{ + /// <summary> + /// Summary description for IBBMenuItem. + /// </summary> + public class IBBMenuItem : System.Windows.Forms.MenuItem, ITranslatable + { + private string name = "emptyName"; + + public IBBMenuItem() : base(){} + + public IBBMenuItem(string text) : base(text) {} + + #region ITranslatable Members + + public new string Name + { + get + { + return name; + } + set + { + name = value; + } + } + + #endregion + } +}
--- a/Windows/Forms/IBBToolBarButton.cs Mon May 25 10:29:21 2009 +0000 +++ b/Windows/Forms/IBBToolBarButton.cs Sat Jun 27 19:03:23 2009 +0000 @@ -2,50 +2,50 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System; -using System.Collections; -using System.ComponentModel; -using System.Drawing; -using System.Data; +using System; +using System.Collections; +using System.ComponentModel; +using System.Drawing; +using System.Data; using System.Windows.Forms; -using IBBoard.Lang; - -namespace IBBoard.Windows.Forms -{ - /// <summary> - /// Summary description for IBBMenuItem. - /// </summary> - public class IBBToolBarButton : System.Windows.Forms.ToolBarButton, ITranslatable - { - private string name = ""; - - #region ITranslatable Members - - public new string Name - { - get - { - return name; - } - set - { - name = value; - } - } - - - public new string Text - { - get - { - return ToolTipText; - } - set - { - ToolTipText = value; - } - } - - #endregion - } -} +using IBBoard.Lang; + +namespace IBBoard.Windows.Forms +{ + /// <summary> + /// Summary description for IBBMenuItem. + /// </summary> + public class IBBToolBarButton : System.Windows.Forms.ToolBarButton, ITranslatable + { + private string name = ""; + + #region ITranslatable Members + + public new string Name + { + get + { + return name; + } + set + { + name = value; + } + } + + + public new string Text + { + get + { + return ToolTipText; + } + set + { + ToolTipText = value; + } + } + + #endregion + } +}
--- a/Windows/Forms/ListViewColumnSorter.cs Mon May 25 10:29:21 2009 +0000 +++ b/Windows/Forms/ListViewColumnSorter.cs Sat Jun 27 19:03:23 2009 +0000 @@ -2,135 +2,135 @@ // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. -using System.Collections; -using System.Windows.Forms; -using System.Globalization; - -/// <summary> -/// This class is an implementation of the 'IComparer' interface. -/// </summary> -namespace IBBoard.Windows.Forms -{ - public class ListViewColumnSorter : IComparer - { - /// <summary> - /// Specifies the column to be sorted - /// </summary> - private int ColumnToSort; - /// <summary> - /// Specifies the order in which to sort (i.e. 'Ascending'). - /// </summary> - private SortOrder OrderOfSort; - /// <summary> - /// Case insensitive comparer object - /// </summary> - private CaseInsensitiveComparer ObjectCompare; - - /// <summary> - /// Class constructor. Initializes various elements - /// </summary> - public ListViewColumnSorter() - { - // Initialize the column to '0' - ColumnToSort = 0; - - // Initialize the sort order to 'none' - OrderOfSort = SortOrder.None; - - // Initialize the CaseInsensitiveComparer object - ObjectCompare = new CaseInsensitiveComparer(); - } - - /// <summary> - /// This method is inherited from the IComparer interface. It compares the two objects passed using a case insensitive comparison. - /// </summary> - /// <param name="x">First object to be compared</param> - /// <param name="y">Second object to be compared</param> - /// <returns>The result of the comparison. "0" if equal, negative if 'x' is less than 'y' and positive if 'x' is greater than 'y'</returns> - public int Compare(object x, object y) - { - int compareResult; - ListViewItem listviewX, listviewY; - - // Cast the objects to be compared to ListViewItem objects - listviewX = (ListViewItem)x; - listviewY = (ListViewItem)y; +using System.Collections; +using System.Windows.Forms; +using System.Globalization; + +/// <summary> +/// This class is an implementation of the 'IComparer' interface. +/// </summary> +namespace IBBoard.Windows.Forms +{ + public class ListViewColumnSorter : IComparer + { + /// <summary> + /// Specifies the column to be sorted + /// </summary> + private int ColumnToSort; + /// <summary> + /// Specifies the order in which to sort (i.e. 'Ascending'). + /// </summary> + private SortOrder OrderOfSort; + /// <summary> + /// Case insensitive comparer object + /// </summary> + private CaseInsensitiveComparer ObjectCompare; + + /// <summary> + /// Class constructor. Initializes various elements + /// </summary> + public ListViewColumnSorter() + { + // Initialize the column to '0' + ColumnToSort = 0; + + // Initialize the sort order to 'none' + OrderOfSort = SortOrder.None; + + // Initialize the CaseInsensitiveComparer object + ObjectCompare = new CaseInsensitiveComparer(); + } + + /// <summary> + /// This method is inherited from the IComparer interface. It compares the two objects passed using a case insensitive comparison. + /// </summary> + /// <param name="x">First object to be compared</param> + /// <param name="y">Second object to be compared</param> + /// <returns>The result of the comparison. "0" if equal, negative if 'x' is less than 'y' and positive if 'x' is greater than 'y'</returns> + public int Compare(object x, object y) + { + int compareResult; + ListViewItem listviewX, listviewY; + + // Cast the objects to be compared to ListViewItem objects + listviewX = (ListViewItem)x; + listviewY = (ListViewItem)y; double resultx, resulty; - - if (double.TryParse(listviewX.SubItems[ColumnToSort].Text, NumberStyles.Any, - NumberFormatInfo.InvariantInfo, out resultx) && double.TryParse(listviewY.SubItems[ColumnToSort].Text, NumberStyles.Any, - NumberFormatInfo.InvariantInfo, out resulty)) - { - if (OrderOfSort == SortOrder.Ascending) - { - // Ascending sort is selected, return normal result of compare operation - return resultx.CompareTo(resulty); - } - else if (OrderOfSort == SortOrder.Descending) - { - // Descending sort is selected, return negative result of compare operation - return resulty.CompareTo(resultx); - } - else - { - // Return '0' to indicate they are equal - return 0; - } - } - else - { - - // Compare the two items - compareResult = ObjectCompare.Compare(listviewX.SubItems[ColumnToSort].Text,listviewY.SubItems[ColumnToSort].Text); - - // Calculate correct return value based on object comparison - if (OrderOfSort == SortOrder.Ascending) - { - // Ascending sort is selected, return normal result of compare operation - return compareResult; - } - else if (OrderOfSort == SortOrder.Descending) - { - // Descending sort is selected, return negative result of compare operation - return (-compareResult); - } - else - { - // Return '0' to indicate they are equal - return 0; - } - } - } - - /// <summary> - /// Gets or sets the number of the column to which to apply the sorting operation (Defaults to '0'). - /// </summary> - public int SortColumn - { - set - { - ColumnToSort = value; - } - get - { - return ColumnToSort; - } - } - - /// <summary> - /// Gets or sets the order of sorting to apply (for example, 'Ascending' or 'Descending'). - /// </summary> - public SortOrder Order - { - set - { - OrderOfSort = value; - } - get - { - return OrderOfSort; - } - } - - } + + if (double.TryParse(listviewX.SubItems[ColumnToSort].Text, NumberStyles.Any, + NumberFormatInfo.InvariantInfo, out resultx) && double.TryParse(listviewY.SubItems[ColumnToSort].Text, NumberStyles.Any, + NumberFormatInfo.InvariantInfo, out resulty)) + { + if (OrderOfSort == SortOrder.Ascending) + { + // Ascending sort is selected, return normal result of compare operation + return resultx.CompareTo(resulty); + } + else if (OrderOfSort == SortOrder.Descending) + { + // Descending sort is selected, return negative result of compare operation + return resulty.CompareTo(resultx); + } + else + { + // Return '0' to indicate they are equal + return 0; + } + } + else + { + + // Compare the two items + compareResult = ObjectCompare.Compare(listviewX.SubItems[ColumnToSort].Text,listviewY.SubItems[ColumnToSort].Text); + + // Calculate correct return value based on object comparison + if (OrderOfSort == SortOrder.Ascending) + { + // Ascending sort is selected, return normal result of compare operation + return compareResult; + } + else if (OrderOfSort == SortOrder.Descending) + { + // Descending sort is selected, return negative result of compare operation + return (-compareResult); + } + else + { + // Return '0' to indicate they are equal + return 0; + } + } + } + + /// <summary> + /// Gets or sets the number of the column to which to apply the sorting operation (Defaults to '0'). + /// </summary> + public int SortColumn + { + set + { + ColumnToSort = value; + } + get + { + return ColumnToSort; + } + } + + /// <summary> + /// Gets or sets the order of sorting to apply (for example, 'Ascending' or 'Descending'). + /// </summary> + public SortOrder Order + { + set + { + OrderOfSort = value; + } + get + { + return OrderOfSort; + } + } + + } } \ No newline at end of file