Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Laval <jeremie.laval@gmail.com>2015-05-13 00:50:37 +0300
committerJérémie Laval <jeremie.laval@gmail.com>2015-05-13 00:50:37 +0300
commit48076d177e05f936552e61977c3221842e541e97 (patch)
tree8d047b1ad1ce1f3dc6b1f94c4ae6e536bf63618a /Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs
parentca15fd675b057bd536e2c766be4e4ff929eaa4ff (diff)
[Xwt.Gtk] Apply font settings to composite buttons
Diffstat (limited to 'Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs')
-rwxr-xr-xXwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs27
1 files changed, 23 insertions, 4 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs b/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs
index 69dd718f..a99fa4fa 100755
--- a/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs
+++ b/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs
@@ -36,6 +36,7 @@ namespace Xwt.GtkBackend
{
protected bool ignoreClickEvents;
ImageDescription image;
+ Pango.FontDescription customFont;
public ButtonBackend ()
{
@@ -62,6 +63,17 @@ namespace Xwt.GtkBackend
{
Widget.SetBackgroundColor (color);
}
+
+ public override object Font {
+ get {
+ return base.Font;
+ }
+ set {
+ base.Font = value;
+ customFont = value as Pango.FontDescription;
+ SetButtonType (ButtonType.Normal);
+ }
+ }
public void SetContent (string label, bool useMnemonic, ImageDescription image, ContentPosition position)
{
@@ -90,21 +102,23 @@ namespace Xwt.GtkBackend
if (image.Backend != null)
imageWidget = new ImageBox (ApplicationContext, image.WithDefaultSize (Gtk.IconSize.Button));
+ Gtk.Label labelWidget = null;
+
if (label != null && imageWidget == null) {
- contentWidget = new Gtk.Label (label) { UseUnderline = useMnemonic };
+ contentWidget = labelWidget = new Gtk.Label (label);
}
else if (label == null && imageWidget != null) {
contentWidget = imageWidget;
}
else if (label != null && imageWidget != null) {
Gtk.Box box = position == ContentPosition.Left || position == ContentPosition.Right ? (Gtk.Box) new Gtk.HBox (false, 3) : (Gtk.Box) new Gtk.VBox (false, 3);
- var lab = new Gtk.Label (label) { UseUnderline = useMnemonic };
+ labelWidget = new Gtk.Label (label) { UseUnderline = useMnemonic };
if (position == ContentPosition.Left || position == ContentPosition.Top) {
box.PackStart (imageWidget, false, false, 0);
- box.PackStart (lab, false, false, 0);
+ box.PackStart (labelWidget, false, false, 0);
} else {
- box.PackStart (lab, false, false, 0);
+ box.PackStart (labelWidget, false, false, 0);
box.PackStart (imageWidget, false, false, 0);
}
@@ -135,6 +149,11 @@ namespace Xwt.GtkBackend
}
}
}
+ if (labelWidget != null) {
+ labelWidget.UseUnderline = useMnemonic;
+ if (customFont != null)
+ labelWidget.ModifyFont (customFont);
+ }
} else
Widget.Label = null;
}