# HG changeset patch # User IBBoard # Date 1229685228 0 # Node ID d860e2c49f43d191ad4e487d9de561339ce6b5c2 Initial commit of IBBoard libraries diff -r 000000000000 -r d860e2c49f43 AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AssemblyInfo.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +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")] +[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\. 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("")] diff -r 000000000000 -r d860e2c49f43 IBBoardWF.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IBBoardWF.csproj Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,147 @@ + + + Local + 8.0.50727 + 2.0 + {E3790268-2082-4975-B1A3-C70B37842CE8} + Debug + AnyCPU + + + + + IBBoardWF + + + JScript + Grid + IE50 + false + Library + IBBoard + OnBuildSuccess + + + + + + + + + C:\Documents and Settings\ibboard\My Documents\Visual Studio 2005\Projects\IBBoardWF\bin\Debug\ + false + 285212672 + false + + + DEBUG;TRACE + + + true + 4096 + false + + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + + TRACE + + + false + 4096 + false + + + true + false + false + false + 4 + none + prompt + + + + System + + + System.Data + + + System.Drawing + + + System.Windows.Forms + + + System.XML + + + IBBoard + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + + + Code + + + Component + + + Component + + + + Component + + + Form + + + Component + + + Component + + + Component + + + Code + + + ColorableStatusBar.cs + + + ColorableStatusBarPanel.cs + + + IBBLabel.cs + + + IBBMenuItem.cs + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r d860e2c49f43 IBBoardWF.csproj.user --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IBBoardWF.csproj.user Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,58 @@ + + + 7.10.3077 + Debug + AnyCPU + + + + + + + 0 + ProjectFiles + 0 + + + false + false + false + false + false + + + Project + + + + + + + + + + + true + + + false + false + false + false + false + + + Project + + + + + + + + + + + true + + \ No newline at end of file diff -r 000000000000 -r d860e2c49f43 IBBoardWF.mdp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IBBoardWF.mdp Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 000000000000 -r d860e2c49f43 IBBoardWF.pidb Binary file IBBoardWF.pidb has changed diff -r 000000000000 -r d860e2c49f43 Windows/Forms/ColorableStatusBar.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/ColorableStatusBar.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,40 @@ +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace IBBoard.Windows.Forms +{ + /// + /// Summary description for ColorableStatusBar. + /// + 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); + } + } + } + } +} diff -r 000000000000 -r d860e2c49f43 Windows/Forms/ColorableStatusBar.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/ColorableStatusBar.resx Fri Dec 19 11:13:48 2008 +0000 @@ -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 -r 000000000000 -r d860e2c49f43 Windows/Forms/ColorableStatusBarPanel.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/ColorableStatusBarPanel.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,56 @@ +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace IBBoard.Windows.Forms +{ + /// + /// Summary description for ColourableStatusBarPanel. + /// + 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; + private object tag; + + 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 object Tag + { + get { return tag; } + set { tag = value; } + } + + public string TagString + { + get { return (tag == null ? "" : tag.ToString()); } + } + } +} diff -r 000000000000 -r d860e2c49f43 Windows/Forms/ColorableStatusBarPanel.resources diff -r 000000000000 -r d860e2c49f43 Windows/Forms/ColorableStatusBarPanel.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/ColorableStatusBarPanel.resx Fri Dec 19 11:13:48 2008 +0000 @@ -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 -r 000000000000 -r d860e2c49f43 Windows/Forms/Delegates.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/Delegates.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,8 @@ +using System; +using System.Windows.Forms; + +namespace IBBoard.Windows.Forms +{ + public delegate void ToolBarButtonRangeDelegate(ToolBarButton[] buttons); + public delegate void ToolBarButtonDelegate(ToolBarButton button); +} diff -r 000000000000 -r d860e2c49f43 Windows/Forms/IBBButton.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/IBBButton.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,13 @@ +using System; +using System.Windows.Forms; +using IBBoard.Lang; + +namespace IBBoard.Windows.Forms +{ + /// + /// Summary description for IBBButton. + /// + public class IBBButton : Button, ITranslatable + { + } +} diff -r 000000000000 -r d860e2c49f43 Windows/Forms/IBBForm.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/IBBForm.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,13 @@ +using System; +using System.Windows.Forms; +using IBBoard.Lang; + +namespace IBBoard.Windows.Forms +{ + /// + /// Summary description for IBBForm. + /// + public class IBBForm : Form, ITranslatable + { + } +} diff -r 000000000000 -r d860e2c49f43 Windows/Forms/IBBLabel.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/IBBLabel.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,13 @@ +using System; +using System.Windows.Forms; +using IBBoard.Lang; + +namespace IBBoard.Windows.Forms +{ + /// + /// Summary description for IBBLabel. + /// + public class IBBLabel : Label, ITranslatable + { + } +} diff -r 000000000000 -r d860e2c49f43 Windows/Forms/IBBLabel.resources diff -r 000000000000 -r d860e2c49f43 Windows/Forms/IBBLabel.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/IBBLabel.resx Fri Dec 19 11:13:48 2008 +0000 @@ -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 -r 000000000000 -r d860e2c49f43 Windows/Forms/IBBMenuItem.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/IBBMenuItem.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,38 @@ +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 description for IBBMenuItem. + /// + 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 + } +} diff -r 000000000000 -r d860e2c49f43 Windows/Forms/IBBMenuItem.resources diff -r 000000000000 -r d860e2c49f43 Windows/Forms/IBBMenuItem.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/IBBMenuItem.resx Fri Dec 19 11:13:48 2008 +0000 @@ -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 -r 000000000000 -r d860e2c49f43 Windows/Forms/IBBToolBarButton.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/IBBToolBarButton.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,47 @@ +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 description for IBBMenuItem. + /// + 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 + } +} diff -r 000000000000 -r d860e2c49f43 Windows/Forms/ListViewColumnSorter.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Windows/Forms/ListViewColumnSorter.cs Fri Dec 19 11:13:48 2008 +0000 @@ -0,0 +1,132 @@ +using System.Collections; +using System.Windows.Forms; +using System.Globalization; + +/// +/// This class is an implementation of the 'IComparer' interface. +/// +namespace IBBoard.Windows.Forms +{ + public class ListViewColumnSorter : IComparer + { + /// + /// Specifies the column to be sorted + /// + private int ColumnToSort; + /// + /// Specifies the order in which to sort (i.e. 'Ascending'). + /// + private SortOrder OrderOfSort; + /// + /// Case insensitive comparer object + /// + private CaseInsensitiveComparer ObjectCompare; + + /// + /// Class constructor. Initializes various elements + /// + 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(); + } + + /// + /// This method is inherited from the IComparer interface. It compares the two objects passed using a case insensitive comparison. + /// + /// First object to be compared + /// Second object to be compared + /// The result of the comparison. "0" if equal, negative if 'x' is less than 'y' and positive if 'x' is greater than 'y' + 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; + } + } + } + + /// + /// Gets or sets the number of the column to which to apply the sorting operation (Defaults to '0'). + /// + public int SortColumn + { + set + { + ColumnToSort = value; + } + get + { + return ColumnToSort; + } + } + + /// + /// Gets or sets the order of sorting to apply (for example, 'Ascending' or 'Descending'). + /// + public SortOrder Order + { + set + { + OrderOfSort = value; + } + get + { + return OrderOfSort; + } + } + + } +} \ No newline at end of file