protected void CloneMenu (MenuItem itemSrc)
{
base.CloneMenu (itemSrc); // Copy subitems
// Window list
MdiList = itemSrc.MdiList;
is_window_menu_item = itemSrc.is_window_menu_item;
// Remove items corresponding to window menu items, and add new items
// (Otherwise window menu items would show up twice, since the PopulateWindowMenu doesn't
// now them)
bool populated = false;
for (int i = MenuItems.Count - 1; i >= 0; i--) {
if (MenuItems [i].is_window_menu_item) {
MenuItems.RemoveAt (i);
populated = true;
}
}
if (populated)
PopulateWindowMenu ();
// Properties
BarBreak = itemSrc.BarBreak;
Break = itemSrc.Break;
Checked = itemSrc.Checked;
DefaultItem = itemSrc.DefaultItem;
Enabled = itemSrc.Enabled;
MergeOrder = itemSrc.MergeOrder;
MergeType = itemSrc.MergeType;
OwnerDraw = itemSrc.OwnerDraw;
//Parent = menuitem.Parent;
RadioCheck = itemSrc.RadioCheck;
Shortcut = itemSrc.Shortcut;
ShowShortcut = itemSrc.ShowShortcut;
Text = itemSrc.Text;
Visible = itemSrc.Visible;
Name = itemSrc.Name;
Tag = itemSrc.Tag;
// Events
Events[ClickEvent] = itemSrc.Events[ClickEvent];
Events[DrawItemEvent] = itemSrc.Events[DrawItemEvent];
Events[MeasureItemEvent] = itemSrc.Events[MeasureItemEvent];
Events[PopupEvent] = itemSrc.Events[PopupEvent];
Events[SelectEvent] = itemSrc.Events[SelectEvent];
}