diff options
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageView.cs | 22 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs | 7 |
2 files changed, 24 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageView.cs index 684b22e7f6..25a5374bff 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ImageView.cs @@ -50,6 +50,24 @@ namespace MonoDevelop.Components } } + float xalign = 0.5f; + public float Xalign { + get { return xalign; } + set { + xalign = value; + QueueDraw (); + } + } + + float yalign = 0.5f; + public float Yalign { + get { return yalign; } + set { + yalign = value; + QueueDraw (); + } + } + protected override void OnSizeRequested (ref Gtk.Requisition requisition) { requisition.Width = (int)image.Width; @@ -60,8 +78,8 @@ namespace MonoDevelop.Components { if (image != null) { using (var ctx = CairoHelper.Create (evnt.Window)) { - var x = Allocation.X + (Allocation.Width - image.Width) / 2; - var y = Allocation.Y + (Allocation.Height - image.Height) / 2; + var x = Allocation.X + (Allocation.Width - image.Width) * xalign; + var y = Allocation.Y + (Allocation.Height - image.Height) * yalign; ctx.DrawImage (this, image, x, y); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs index 675a012a3d..e9e80f8a37 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs @@ -31,6 +31,7 @@ using System.Text; using Gtk; using MonoDevelop.Core; using System.Linq; +using MonoDevelop.Components; namespace MonoDevelop.Ide.Gui.Dialogs { @@ -43,7 +44,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs AlertButton[] buttons; Gtk.HBox hbox = new HBox (); - Gtk.Image image; + ImageView image; Gtk.Label label = new Label (); VBox labelsBox = new VBox (false, 6); @@ -99,9 +100,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs } if (!string.IsNullOrEmpty (message.Icon)) { - image = new Image (); + image = new ImageView (); image.Yalign = 0.00f; - image.Pixbuf = ImageService.GetPixbuf (message.Icon, IconSize.Dialog); + image.Image = ImageService.GetIcon (message.Icon, IconSize.Dialog); hbox.PackStart (image, false, false, 0); hbox.ReorderChild (image, 0); } |