private void InitializeComponent() { // handle creation // todo: doesn't look necessary... hwndThis = Handle; bool reorderEnabled = !Config.Desktop.LockMenu; components = new System.ComponentModel.Container(); contextMenu = new DropDownMenuReorderable(components, true, false); contextMenuForSetting = new ContextMenuStripEx(components, true); // todo: , false); tmiLabel_Group = new TitleMenuItem(MenuGenre.Group, true); tmiLabel_History = new TitleMenuItem(MenuGenre.History, true); tmiLabel_UserApp = new TitleMenuItem(MenuGenre.Application, true); tmiLabel_RecentFile = new TitleMenuItem(MenuGenre.RecentFile, true); contextMenu.SuspendLayout(); contextMenuForSetting.SuspendLayout(); SuspendLayout(); // // contextMenu // contextMenu.ProhibitedKey.Add(MENUKEY_ITEM_HISTORY); contextMenu.ProhibitedKey.Add(MENUKEY_ITEM_RECENT); contextMenu.ReorderEnabled = reorderEnabled; contextMenu.MessageParent = Handle; contextMenu.ImageList = QTUtility.ImageListGlobal; contextMenu.ItemClicked += dropDowns_ItemClicked; contextMenu.Closing += contextMenu_Closing; contextMenu.ReorderFinished += contextMenu_ReorderFinished; contextMenu.ItemRightClicked += dropDowns_ItemRightClicked; if(!QTUtility.IsXP) { contextMenu.CreateControl(); } // // ddmrGroups // ddmrGroups = new DropDownMenuReorderable(components, true, false); ddmrGroups.ReorderEnabled = reorderEnabled; ddmrGroups.ImageList = QTUtility.ImageListGlobal; ddmrGroups.ReorderFinished += dropDowns_ReorderFinished; ddmrGroups.ItemClicked += dropDowns_ItemClicked; ddmrGroups.ItemRightClicked += dropDowns_ItemRightClicked; // // tmiGroup // tmiGroup = new TitleMenuItem(MenuGenre.Group, false) {DropDown = ddmrGroups}; // // ddmrHistory // ddmrHistory = new DropDownMenuReorderable(components, true, false); ddmrHistory.ReorderEnabled = false; ddmrHistory.ImageList = QTUtility.ImageListGlobal; ddmrHistory.MessageParent = Handle; ddmrHistory.ItemClicked += dropDowns_ItemClicked; ddmrHistory.ItemRightClicked += dropDowns_ItemRightClicked; // // tmiHistory // tmiHistory = new TitleMenuItem(MenuGenre.History, false); tmiHistory.DropDown = ddmrHistory; // // ddmrUserapps // ddmrUserapps = new DropDownMenuReorderable(components); ddmrUserapps.ReorderEnabled = reorderEnabled; ddmrUserapps.ImageList = QTUtility.ImageListGlobal; ddmrUserapps.MessageParent = Handle; ddmrUserapps.ReorderFinished += dropDowns_ReorderFinished; ddmrUserapps.ItemClicked += dropDowns_ItemClicked; ddmrUserapps.ItemRightClicked += dropDowns_ItemRightClicked; // // tmiUserApp // tmiUserApp = new TitleMenuItem(MenuGenre.Application, false); tmiUserApp.DropDown = ddmrUserapps; // // ddmrRecentFile // ddmrRecentFile = new DropDownMenuReorderable(components, false, false, false); ddmrRecentFile.ImageList = QTUtility.ImageListGlobal; ddmrRecentFile.MessageParent = Handle; ddmrRecentFile.ItemClicked += dropDowns_ItemClicked; ddmrRecentFile.ItemRightClicked += dropDowns_ItemRightClicked; // // tmiRecentFile // tmiRecentFile = new TitleMenuItem(MenuGenre.RecentFile, false); tmiRecentFile.DropDown = ddmrRecentFile; // // contextMenuForSetting // tsmiTaskBar = new ToolStripMenuItem(); tsmiDesktop = new ToolStripMenuItem(); tsmiLockItems = new ToolStripMenuItem(); tsmiVSTitle = new ToolStripMenuItem(); tsmiTaskBar.Checked = Config.Desktop.TaskBarDblClickEnabled; tsmiDesktop.Checked = Config.Desktop.DesktopDblClickEnabled; tsmiLockItems.Checked = Config.Desktop.LockMenu; tsmiVSTitle.Checked = Config.Desktop.TitleBackground; tsmiOnGroup = new ToolStripMenuItem(); tsmiOnHistory = new ToolStripMenuItem(); tsmiOnUserApps = new ToolStripMenuItem(); tsmiOnRecentFile = new ToolStripMenuItem(); tsmiOneClick = new ToolStripMenuItem(); tsmiAppKeys = new ToolStripMenuItem(); tsmiOnGroup.Checked = Config.Desktop.IncludeGroup; tsmiOnHistory.Checked = Config.Desktop.IncludeRecentTab; tsmiOnUserApps.Checked = Config.Desktop.IncludeApplication; tsmiOnRecentFile.Checked = Config.Desktop.IncludeRecentFile; tsmiOneClick.Checked = Config.Desktop.OneClickMenu; tsmiAppKeys.Checked = Config.Desktop.EnableAppShortcuts; tsmiExperimental = new ToolStripMenuItem(QTUtility.TextResourcesDic["Misc_Strings"][6]); tsmiExperimental.DropDown.Items.Add(new ToolStripMenuItem(QTUtility.TextResourcesDic["Misc_Strings"][7])); //TODO does this respect RTL settings? tsmiExperimental.DropDownDirection = ToolStripDropDownDirection.Left; tsmiExperimental.DropDownItemClicked += tsmiExperimental_DropDownItemClicked; tsmiExperimental.DropDownOpening += tsmiExperimental_DropDownOpening; contextMenuForSetting.Items.AddRange(new ToolStripItem[] { tsmiTaskBar, tsmiDesktop, new ToolStripSeparator(), tsmiOnGroup, tsmiOnHistory, tsmiOnUserApps, tsmiOnRecentFile, new ToolStripSeparator(), tsmiLockItems, tsmiVSTitle, tsmiOneClick, tsmiAppKeys, tsmiExperimental }); contextMenuForSetting.ItemClicked += contextMenuForSetting_ItemClicked; RefreshStringResources(); // // QTCoTaskBar // ContextMenuStrip = contextMenuForSetting; Width = Config.Desktop.Width; MinSize = new Size(8, 22); Dock = DockStyle.Fill; MouseClick += desktopTool_MouseClick; MouseDoubleClick += desktopTool_MouseDoubleClick; contextMenu.ResumeLayout(false); contextMenuForSetting.ResumeLayout(false); ResumeLayout(false); }
private void InitializeComponent() { bool flag = (ConfigValues[1] & 2) == 0; components = new Container(); contextMenu = new DropDownMenuReorderable(components, true, false); contextMenuForSetting = new ContextMenuStripEx(components, true); labelGroupTitle = new TitleMenuItem(MenuGenre.Group, true); labelHistoryTitle = new TitleMenuItem(MenuGenre.History, true); labelUserAppTitle = new TitleMenuItem(MenuGenre.Application, true); labelRecentFileTitle = new TitleMenuItem(MenuGenre.RecentFile, true); contextMenu.SuspendLayout(); contextMenuForSetting.SuspendLayout(); SuspendLayout(); contextMenu.ProhibitedKey.Add("historyItem"); contextMenu.ProhibitedKey.Add("recentItem"); contextMenu.ReorderEnabled = flag; contextMenu.MessageParent = Handle; contextMenu.ImageList = QTUtility.ImageListGlobal; contextMenu.ItemClicked += contextMenu_ItemClicked; contextMenu.Closing += contextMenu_Closing; contextMenu.ReorderFinished += contextMenu_ReorderFinished; contextMenu.ItemRightClicked += dropDownMenues_ItemRightClicked; ddmrGroups = new DropDownMenuReorderable(components, true, false); ddmrGroups.ReorderEnabled = flag; ddmrGroups.ReorderFinished += groupsMenuItem_ReorderFinished; ddmrGroups.ItemRightClicked += dropDownMenues_ItemRightClicked; groupsMenuItem = new TitleMenuItem(MenuGenre.Group, false); groupsMenuItem.DropDown = ddmrGroups; groupsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal; groupsMenuItem.DropDownItemClicked += contextMenu_ItemClicked; ddmrHistory = new DropDownMenuReorderable(components, true, false); ddmrHistory.ReorderEnabled = false; ddmrHistory.MessageParent = Handle; ddmrHistory.ItemRightClicked += dropDownMenues_ItemRightClicked; historyMenuItem = new TitleMenuItem(MenuGenre.History, false); historyMenuItem.DropDown = ddmrHistory; historyMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal; historyMenuItem.DropDownItemClicked += contextMenu_ItemClicked; ddmrUserapps = new DropDownMenuReorderable(components); ddmrUserapps.ReorderEnabled = flag; ddmrUserapps.MessageParent = Handle; ddmrUserapps.ReorderFinished += userAppsMenuItem_ReorderFinished; ddmrUserapps.ItemRightClicked += dropDownMenues_ItemRightClicked; userAppsMenuItem = new TitleMenuItem(MenuGenre.Application, false); userAppsMenuItem.DropDown = ddmrUserapps; userAppsMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal; userAppsMenuItem.DropDownItemClicked += contextMenu_ItemClicked; ddmrRecentFile = new DropDownMenuReorderable(components, false, false, false); ddmrRecentFile.MessageParent = Handle; ddmrRecentFile.ItemRightClicked += dropDownMenues_ItemRightClicked; recentFileMenuItem = new TitleMenuItem(MenuGenre.RecentFile, false); recentFileMenuItem.DropDown = ddmrRecentFile; recentFileMenuItem.DropDown.ImageList = QTUtility.ImageListGlobal; recentFileMenuItem.DropDownItemClicked += contextMenu_ItemClicked; contextMenuForSetting.ShowImageMargin = false; tsmiTaskBar = new ToolStripMenuItem(); tsmiDesktop = new ToolStripMenuItem(); tsmiLockItems = new ToolStripMenuItem(); tsmiVSTitle = new ToolStripMenuItem(); tsmiTaskBar.Checked = (ConfigValues[1] & 8) == 0; tsmiDesktop.Checked = (ConfigValues[1] & 4) == 0; tsmiLockItems.Checked = (ConfigValues[1] & 2) == 2; tsmiVSTitle.Checked = (ConfigValues[1] & 1) == 0; tsmiOnGroup = new ToolStripMenuItem(); tsmiOnHistory = new ToolStripMenuItem(); tsmiOnUserApps = new ToolStripMenuItem(); tsmiOnRecentFile = new ToolStripMenuItem(); tsmiOneClick = new ToolStripMenuItem(); tsmiAppKeys = new ToolStripMenuItem(); tsmiOnGroup.Checked = (ConfigValues[2] & 0x80) == 0; tsmiOnHistory.Checked = (ConfigValues[2] & 0x40) == 0; tsmiOnUserApps.Checked = (ConfigValues[2] & 0x20) == 0; tsmiOnRecentFile.Checked = (ConfigValues[2] & 1) == 0; tsmiOneClick.Checked = (ConfigValues[2] & 0x10) != 0; tsmiAppKeys.Checked = (ConfigValues[2] & 8) == 0; contextMenuForSetting.Items.AddRange(new ToolStripItem[] { tsmiTaskBar, tsmiDesktop, new ToolStripSeparator(), tsmiOnGroup, tsmiOnHistory, tsmiOnUserApps, tsmiOnRecentFile, new ToolStripSeparator(), tsmiLockItems, tsmiVSTitle, tsmiOneClick, tsmiAppKeys }); contextMenuForSetting.ItemClicked += contextMenuForSetting_ItemClicked; contextMenuForSetting.Opening += contextMenuForSetting_Opening; ContextMenuStrip = contextMenuForSetting; Width = WidthOfBar; MinSize = new Size(30, 0x16); Dock = DockStyle.Fill; MouseClick += QTCoTaskBarClass_MouseClick; MouseDoubleClick += QTCoTaskBarClass_MouseDoubleClick; contextMenu.ResumeLayout(false); contextMenuForSetting.ResumeLayout(false); ResumeLayout(false); }