view Translatable/TranslatableButton.cs @ 42:f04e973e5ea0 default tip

* Drop back to old Tooltips to support GTK# before 2.12 * Make sure we're not 2.12 specific to allow building on the server (running 2.10)
author IBBoard <dev@ibboard.co.uk>
date Sun, 07 Oct 2012 19:58:40 +0100
parents 73c1e3372b52
children
line wrap: on
line source

//  This file (TranslatableButton.cs) is a part of the IBBoard.GtkSharp project and is copyright 2010 IBBoard
//
// // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.

using System;
using Gtk;
using IBBoard.Lang;

namespace IBBoard.GtkSharp.Translatable
{
	[System.ComponentModel.ToolboxItem(true)]
	[System.ComponentModel.Category("Translatable")]
	public class TranslatableButton : Button, ITranslatable
	{
		public string Text
		{
			get
			{
				return Label;
			}
			set
			{
				Image origIcon = this.Image as Image;
				string stock = null;

				if (origIcon != null)
				{
					stock = origIcon.Stock;
				}

				this.Label = value;
				this.Image = origIcon;

				if (origIcon != null)
				{
					origIcon.Stock = stock;
				}
			}
		}
	}
}