changeset 20:5f35edc84791

* Add translatable tab control for warfoundry:ticket:383
author IBBoard <dev@ibboard.co.uk>
date Sat, 21 Jan 2012 16:35:20 +0000
parents 3a0dea3d6996
children 031354c2a34c
files IBBoard.Windows.Forms.csproj Windows/Forms/I18N/ControlTranslator.cs Windows/Forms/IBBTabControl.cs
diffstat 3 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/IBBoard.Windows.Forms.csproj	Sat Sep 24 12:01:17 2011 +0100
+++ b/IBBoard.Windows.Forms.csproj	Sat Jan 21 16:35:20 2012 +0000
@@ -88,6 +88,9 @@
     <Compile Include="AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Windows\Forms\IBBTabControl.cs">
+      <SubType>Component</SubType>
+    </Compile>
     <Compile Include="Windows\Forms\IBBRadioButton.cs">
       <SubType>Component</SubType>
     </Compile>
--- a/Windows/Forms/I18N/ControlTranslator.cs	Sat Sep 24 12:01:17 2011 +0100
+++ b/Windows/Forms/I18N/ControlTranslator.cs	Sat Jan 21 16:35:20 2012 +0000
@@ -85,10 +85,17 @@
 				{
 					TranslateComponent(item, true, replacements);
 				}
-			}
-			else
-			{
-				TranslateControls(ctrl.Controls);
+			}
+			else if (ctrl is IBBTabControl)
+			{
+				foreach (TabPage page in ((IBBTabControl)ctrl).TabPages)
+				{
+					page.Text = Translation.GetTranslation(page.Name, page.Text);
+				}
+			}
+			else
+			{
+				TranslateControls(ctrl.Controls);
 			}
 		}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Windows/Forms/IBBTabControl.cs	Sat Jan 21 16:35:20 2012 +0000
@@ -0,0 +1,14 @@
+// This file (IBBTabControl.cs) is a part of the IBBoard.Windows.Forms library and is copyright 2012 IBBoard.
+//
+// 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;
+using IBBoard.Lang;
+
+namespace IBBoard.Windows.Forms
+{
+	public class IBBTabControl : TabControl, ITranslatable
+	{
+	}
+}