diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-24 02:03:20 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-24 02:03:30 +0400 |
commit | 75d9bd61fd6fdcad8dfd545f9ffe70a3ba6dad09 (patch) | |
tree | cfd9fcfd04ec8d688aec6b1bb0ab470a6b14275e /main/src | |
parent | 3ab70a991b9c685b0d4a786965ab1273441d1f5d (diff) |
[Ide] Fix Bug 2164 - Context menu submenu shows offscreen
The submenus were lazy-loading during realization, but
they needed to lazy-load before size request.
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs index 644c35d095..dacd57d56a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandMenu.cs @@ -71,6 +71,19 @@ namespace MonoDevelop.Components.Commands } } + bool populated; + void EnsurePopulated () + { + if (populated) + return; + populated = true; + if (commandEntrySet != null) { + manager.CreateMenu (commandEntrySet, this); + Update (); + commandEntrySet = null; + } + } + protected CommandMenu (IntPtr ptr): base (ptr) { } @@ -81,14 +94,17 @@ namespace MonoDevelop.Components.Commands manager.RegisterUserInteraction (); Update (); } + protected override void OnRealized () { base.OnRealized (); - if (commandEntrySet != null) { - manager.CreateMenu (commandEntrySet, this); - Update (); - commandEntrySet = null; - } + EnsurePopulated (); + } + + protected override void OnSizeRequested (ref Gtk.Requisition requisition) + { + EnsurePopulated (); + base.OnSizeRequested (ref requisition); } internal void Update () |