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:
authorMichael Cummings <mcumming@microsoft.com>2019-08-09 16:52:42 +0300
committerMichael Cummings <mcumming@microsoft.com>2019-08-09 18:28:28 +0300
commita3a298263a68ac9567052281e36000c3406e651e (patch)
treee55669d70bc51e4254ff7717c0843d18825eca35 /Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs
parent2102683398a84ee16094fc4bcae3dac44ba31872 (diff)
Leverage SetContent from SetFormattedText before setting formatted text.
Diffstat (limited to 'Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs')
-rw-r--r--Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs28
1 files changed, 24 insertions, 4 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs b/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs
index 85cf7c28..afcebcf7 100644
--- a/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs
+++ b/Xwt.Gtk/Xwt.GtkBackend/ButtonBackend.cs
@@ -197,6 +197,28 @@ namespace Xwt.GtkBackend
Widget.Label = null;
}
+ private void SetFormattedContent (FormattedText label, ContentPosition position)
+ {
+ if (label != null && label.Text.Length == 0)
+ label = null;
+
+ Button b = (Button)Frontend;
+ if (label != null && image.Backend == null && b.Type == ButtonType.Normal) {
+ labelWidget = new Gtk.Label ();
+ label.ApplyToLabel (labelWidget);
+ Widget.Image = labelWidget;
+ return;
+ }
+
+ if (b.Type == ButtonType.Disclosure) {
+ return;
+ }
+
+ if (label != null && labelWidget != null) {
+ label.ApplyToLabel (labelWidget);
+ }
+ }
+
public void SetButtonStyle (ButtonStyle style)
{
switch (style) {
@@ -223,10 +245,8 @@ namespace Xwt.GtkBackend
public void SetFormattedText (FormattedText text)
{
- if (labelWidget != null) {
- labelWidget.Text = text.Text;
- text.ApplyToLabel (labelWidget);
- }
+ SetContent (text.Text, Widget.UseUnderline, this.image, ContentPosition.Center);
+ SetFormattedContent (text, ContentPosition.Center);
}
public override void EnableEvent (object eventId)