Mercurial > repos > IBBoard.GtkSharp
annotate 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 |
rev | line source |
---|---|
28
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (TranslatableButton.cs) is a part of the IBBoard.GtkSharp project and is copyright 2010 IBBoard |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 // // 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. |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using System; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using Gtk; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 using IBBoard.Lang; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 namespace IBBoard.GtkSharp.Translatable |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 { |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 [System.ComponentModel.ToolboxItem(true)] |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 [System.ComponentModel.Category("Translatable")] |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 public class TranslatableButton : Button, ITranslatable |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 { |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 public string Text |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 { |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 get |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 { |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 return Label; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 } |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 set |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 { |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 Image origIcon = this.Image as Image; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 string stock = null; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 if (origIcon != null) |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 { |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 stock = origIcon.Stock; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 } |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 this.Label = value; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 this.Image = origIcon; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 if (origIcon != null) |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
35 { |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
36 origIcon.Stock = stock; |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 } |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
38 } |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
39 } |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
40 } |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 } |
73c1e3372b52
Re #47: Add translatable GTK# widgets
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
42 |